public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53570] New: Unused symbols are not removed for fully static targets (avr-gcc)
@ 2012-06-04  7:06 jwatte at gmail dot com
  2012-06-04  7:08 ` [Bug c++/53570] " jwatte at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jwatte at gmail dot com @ 2012-06-04  7:06 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-06-09 16:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-04  7:06 [Bug c++/53570] New: Unused symbols are not removed for fully static targets (avr-gcc) jwatte at gmail dot com
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

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).