To crt0 or not to crt0
In contrast to Sourcery CodeBench 2014.05-36, your tool chain loads crt0.o unconditionally. I admit, crt0.o is required for ISO C compatibility. Without crt0.o there is not exit()/atexit(). But does a BARE METAL main() ever return? Shouldn't a bare metal main() have __attribute__ ((noreturn)) set by default?
Other tasks of crt0.o, notably the initialization of static data, are commonly handled by the Reset_Handler(). It could be argued that the Reset_Handler() should invoke _mainCRTStartup() for the initialization of static data rather than doing it by itself. But, because you have defined __USES_INITFINI__, this would leave the needless calls to atexit() and to __libc_
So it all boils down to the question whether or not to define __USES_INITFINI__. IMHO there is no point of doing so in a bare metal environment.
Anyway, loading crt0.o does not impose a serious problem for my environment because I use an ld-wrapper that prevents specified object from being loaded. But for the unaware this leads to the error message:
fini.c:
Is there a point of loading crt0.o unconditionally? Shouldn't this point be well-documented?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Ubuntu Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- actionparsnip
- Solved:
- Last query:
- Last reply: