Why objcopy/strip doesn't accept wildcard when localize/keep/weaken symbols.
Wang Li
charles@linux.net.cn
Tue Apr 29 07:41:00 GMT 2003
I need to localized all symbols in an object except some specific one in
order to avoid symbol conflict in linking.
For example,
ld -r -o objcopy-r.o objcopy.o other-objs.o ....
Then I want localize all symbols except 'main' and redefine the 'main' to
'objcopy_main'. So I hope to do:
objcopy -w -L !objcopy_main --redefine-sym main=objcopy_main objcopy-r.o
objcopy-ok.o
And do this to some other these objects and get strip-ok.o, readelf-ok.o
.....
Then I can make a simple main function to call them just like 'busybox'.
This work can help me to reduce the
total binary size in embedded system (Especially for the static-only
machine).
But now, objcopy doesn't support wildcard for symbols. If I want to do the
previous work. the only way is write
a script to localize each symbol respectively. Is it too trouble?
So I read the source of object copy, and create a patch to add a new option
'--wildcard' to 'objcopy'. That works
for me now. :) The patch should be applied to CVS tree of binutils.
I think this feature is valuable so I sent it here and hope it can be useful
for others.
Charles April 29.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-objcopy.patch
Type: application/octet-stream
Size: 3788 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20030429/dc4de284/attachment.obj>
More information about the Binutils
mailing list