You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support for constructors and destructors could be "easily" added by extending the .text section of the default NEORV32 linker script (provided by @GideonZ):
Adding function calls to __libc_init_array and __libc_fini_array would add some code/library overhead even if there are not constructors/destructors at all.
I am not sure if this should be added to the current setups, which targets plain C code. One option would be to make "define switches" for the according functions calls so the user can explicitly enable this functionality when compiling an application. Another option would be to call the __libc_init_array and __libc_fini_array function directly form main (in C code) is they are required.
I am not sure about c++ applications at all - I have never tested that because I am not really familiar with that. What do you think??
The text was updated successfully, but these errors were encountered:
Hi Stephan... Shall I just create a pull request with some minor changes
to the linker script and to the crt0.s to support constructors? Maybe a
tiny C++ example?
@jpf91 @GideonZ
Triggered by the discussion in #313:
Support for constructors and destructors could be "easily" added by extending the
.text
section of the default NEORV32 linker script (provided by @GideonZ):Adding this to the linker script does not hurt as the linker will remove all the included functions if they are not explicitly called.
The con-/destructor array of function pointers have to be called from
crt0
before and aftermain
is calles, respectively:For plain C code it is very unlikely that there are any constructors or destructors at all unless explicitly defined, for example:
Adding function calls to
__libc_init_array
and__libc_fini_array
would add some code/library overhead even if there are not constructors/destructors at all.I am not sure if this should be added to the current setups, which targets plain C code. One option would be to make "define switches" for the according functions calls so the user can explicitly enable this functionality when compiling an application. Another option would be to call the
__libc_init_array
and__libc_fini_array
function directly formmain
(in C code) is they are required.I am not sure about c++ applications at all - I have never tested that because I am not really familiar with that. What do you think??
The text was updated successfully, but these errors were encountered: