]> sourceware.org Git - newlib-cygwin.git/commit
MSP430: Remove .init/.fini sections
authorJozef Lawrynowicz <jozef.l@mittosystems.com>
Wed, 24 Jul 2019 09:45:49 +0000 (10:45 +0100)
committerJeff Johnston <jjohnstn@redhat.com>
Wed, 24 Jul 2019 20:22:00 +0000 (16:22 -0400)
commit884b05b54e4595433c85f8ca9820e88b4c723e38
tree1ae9409fd161498b74f5728d956d651160edc866
parent6b843b82a87b4616ba22712ec27b717f61b72630
MSP430: Remove .init/.fini sections

The .init/.fini sections are not required for msp430-elf, and add unnecessary
code bloat to the CRT library. These sections are specified as "unused" by
the MSP430 EABI.

.init existed to call __crt0_run_{init,preinit}_array which run through
the functions in .{init,preinit}_array.
__crt0_run_{init,preinit}_array are already dynamically included like the
other crt0 functions, so these can be placed before the call to main,
which ensures they are still called if needed.
With these functions moved, .init has no purpose and can be removed.

.fini existed to call __crt0_run_fini_array.
However, the "__msp430_fini" symbol which marks the start of .fini has
never been used, so no termination routines have ever been run for
msp430. On returning from main(), _exit() is called which just loops
forever.
So there is no current expectation that __crt0_run_fini_array will
get called by the CRT code. Further work is to ensure functions
registered with atexit can be optionally called during program termination,
and then __crt0_run_fini_array can be registered with atexit during
program initialization.

The mechanisms for supporting the "-minrt" option have also been removed.
"-minrt" enabled a "minimum runtime environment" by removing calls to
functions which run global static initializers and constructors. Since
this behaviour is now dynamic, and these functions are only included
when needed, the minrt versions of the CRT object files are no longer
required.
libgloss/msp430/Makefile.in
libgloss/msp430/crt0.S
libgloss/msp430/crtn.S [deleted file]
libgloss/msp430/msp430-sim.ld
libgloss/msp430/msp430xl-sim.ld
This page took 0.03165 seconds and 5 git commands to generate.