$ make
g++ -fpic -O1 -g0 -ffunction-sections -fdata-sections *.cpp -c
g++ -Wl,--gc-sections -Wl,--print-gc-sections -z defs lib2.o \
lib1.o -shared -o lib2.so
(...)
/usr/bin/ld: Removing unused section '.text' in file 'lib1.o'
/usr/bin/ld: Removing unused section '.data' in file 'lib1.o'
/usr/bin/ld: Removing unused section '.bss' in file 'lib1.o'
^^^^^^^^^^^^^^
what about .text._ZN1X1fEv ?
it's unused in lib2.so
(...)
lib1.o: In function `X::f()':
lib1.cpp:(.text._ZN1X1fEv+0x5): undefined reference to `h()'
collect2: ld returned 1 exit status
$ objdump -h lib1.o|egrep '\.text\.'
3 .text._ZN1X1gEv 00000002 (...)
4 .text._ZN1X1fEv 0000000e (...)
--
Summary: --gc-sections doesn't work as expected.
Product: binutils
Version: 2.17
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: pluto at agmk dot net
CC: bug-binutils at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=4563
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
_______________________________________________
bug-binutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-binutils