public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jwatte at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53570] New: Unused symbols are not removed for fully static targets (avr-gcc) Date: Mon, 04 Jun 2012 07:06:00 -0000 [thread overview] Message-ID: <bug-53570-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53570 Bug #: 53570 Summary: Unused symbols are not removed for fully static targets (avr-gcc) Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: jwatte@gmail.com Using built-in specs. COLLECT_GCC=avr-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/avr/4.7.0/lto-wrapper Target: avr Configured with: /build/src/gcc-4.7.0/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++ --disable-libssp --disable-nls --target=avr --with-as=/usr/bin/avr-as --with-ld=/usr/bin/avr-ld --with-gnu-as --with-gnu-ld Thread model: single gcc version 4.7.0 (GCC) This is a problem report for how the linker is not smart enough to remove unused functions, even with -Os. This makes it very hard to create libraries of functions where only some functions may be used in any particular binary. Note: "r" option to ar is passed in, so the linker should have all the symbol information it needs to make the determination. See the attached test program, especially the "lib.cpp" file. There is nothing in the C++ standard that requires the compiler or linker to include the not_called symbol, or the some_large_function symbol, when they are not used. On a small target like the AVR, including those symbols is too wasteful. To reproduce: - untar this archive - run ./make.sh - avr-objdump --disassemble main, and find the unused symbols still included
next reply other threads:[~2012-06-04 7:06 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-06-04 7:06 jwatte at gmail dot com [this message] 2012-06-04 7:08 ` [Bug c++/53570] " jwatte at gmail dot com 2012-06-04 8:33 ` pinskia at gcc dot gnu.org 2012-06-04 8:37 ` pinskia at gcc dot gnu.org 2012-06-04 18:07 ` jwatte at gmail dot com 2012-06-09 16:50 ` ebotcazou at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-53570-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).