• Jozef Lawrynowicz's avatar
    MSP430: Remove .init/.fini sections · 884b05b5
    Jozef Lawrynowicz authored
    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
    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
Makefile.in 4.19 KB