This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: combining object files and managing relocatable symbols
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Erik Leunissen <e dot leunissen at hccnet dot nl>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 20 Sep 2006 13:02:42 -0700
- Subject: Re: combining object files and managing relocatable symbols
- References: <45119D83.5020002@hccnet.nl>
On Wed, Sep 20, 2006 at 09:58:59PM +0200, Erik Leunissen wrote:
> I've got two ELF object files; let's call them A.o and B.o.
>
> A.o refers to a symbol X, which is defined in B.o
>
> What I want to accomplish is to create a new relocatable object file C.o
> from these object files such that:
> 1. the reference to X in A.o is resolved
> 2. symbol X in C.o is unavailable for further linking against. I guess
> this means reducing it to a local symbol.
>
> Doing a partial link does step 1 ( ld -r -nostdlib -o C.o A.o B.o ).
> However, I did not find a way to do step 2.
>
Have you tried
# objcopy --localize-symbol X C.o
H.J.