Bug 15430 - objcopy -R makes shared objects unusable
Summary: objcopy -R makes shared objects unusable
Status: RESOLVED WONTFIX
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.23
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-03 16:26 UTC by Omair Majid
Modified: 2013-05-03 22:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
readelf -t on the so file before and after running objcopy -R (1.22 KB, text/plain)
2013-05-03 16:26 UTC, Omair Majid
Details
readelf -s on the shared object before and after running objcopy -R (9.31 KB, text/plain)
2013-05-03 16:27 UTC, Omair Majid
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Omair Majid 2013-05-03 16:26:58 UTC
Created attachment 7012 [details]
readelf -t on the so file before and after running objcopy -R

When I try to remove the build id note from a shared library using "objcopy -R .note.gnu.build-id lib.so", the library becomes unusable.

$ objdump -T libjvm.so | grep jio_vfprint
00000000005715a0 g    DF .text	0000000000000026  SUNWprivate_1.1 jio_vfprintf

$ objcopy -R .note.gnu.build-id libjvm.so

$ objdump -T libjvm.so | grep jio_vfprint
00000000005715a0 g    DF .fini	0000000000000026  SUNWprivate_1.1 jio_vfprintf

The function is "moved" from the .text to the .fini section, which makes this shared object unusable (I get errors when linking this .so).
Comment 1 Omair Majid 2013-05-03 16:27:27 UTC
Created attachment 7013 [details]
readelf -s on the shared object before and after running objcopy -R
Comment 2 Alan Modra 2013-05-03 22:36:57 UTC
objcopy -R can't be used to remove loaded sections from a final linked executable.