undefined reference to `_fini', __USES_INITFINI__

Bug #1341110 reported by Hermann Kleier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-arm-none-eabi (Ubuntu)
New
Undecided
Unassigned

Bug Description

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 no 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_init_array().

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 explicitely specified objects (like crt0) from being loaded. But for the unaware this leads to the error message:

fini.c:(.text.__libc_fini_array+0x20): undefined reference to `_fini'

Is there a point of loading crt0.o unconditionally? Shouldn't this point be well-documented?

Tags: bot-comment
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1341110/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Revision history for this message
Hermann Kleier (hermann-kleier) wrote :

This bug report is for gcc-arm-none-eabi=4-8-2014q2-0trusty10. Note, that because of missing C++-headers (e.g. <cstdint>) the standard packet cannot compile C++-programs at all.

affects: ubuntu → gcc-arm-none-eabi (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.