msp430-elf-g++ optimizing out main()

Wylder Keane <[email protected]> Tue, 23 Sep 2014 15:52:39 -0700
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <CAP1=f4zAuJc+2HxxzmUJ2hypFjp_qUvivdxvrfzN=1fFLutkhQ@mail.gmail.com>
I've been using the new msp430-elf-g++ released on 2014-09-03 to build and
debug, and while attempting to reduce the binary size I've added the
following arguments for the compilation and linking phases (except
gc-sections is linker only).

-fdata-sections -ffunction-section -nodefaultlibs --gc-sections

While greatly reducing the code space, it also seems to think main() isn't
a root and optimizes it away... needless to say this isn't very good.

As far as I can tell it is the combination of these compiler flags that
product the result, and I can reproduce it with the blink example by adding
those flags and changing the compiler to msp430-elf-g++.

If I remove either the --gc-sections, or the -nodefaultlibs flags, it then
complains that the .text section is over by 90Kb... so basically I need to
stip away all stdc++ implicit references to make the code fit, and unused
code in my codebase.

Does anyone have an idea as to how I can tell the compiler to not link in
the stdc++ library that seems to bloat the .text section?

-Wylder

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk

_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users