This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: How can I change a global symbol to local?
- From: "H. J. Lu" <hjl at lucon dot org>
- To: ShiYi Ma <shiyi at synopsys dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 27 Nov 2002 09:24:34 -0800
- Subject: Re: How can I change a global symbol to local?
- References: <3DE49713.41C49F76@synopsys.com>
On Wed, Nov 27, 2002 at 05:57:39PM +0800, ShiYi Ma wrote:
> Hi all :
> Is there any method to change a global symbol to local in an
> static library?
> My platform is RedHat7.2. Using gcc 3.2 and ld 2.11.90.0.8.
> Now I should link 2 static libraries to one binary and all
> process should not use shared library. In the 2
> libraries there are few symbols shareing the same name. So ld will show
> warning "multiple definition". It looks
> like very hard to strip one given name symbol from one static library.
> Also strip symbol will affect the binary's
> debug. So my goal is just changing one symbol from global to local. Is
> there any possibility of implementing it
> without any platform or tools update?
> Thanks all very much. Any feedback is welcome.
>
You can do one of those:
1. Use objcopy
-L --localize-symbol <name> Force symbol <name> to be marked as a local
--localize-symbols <file> -L for all symbols listed in <file>
2. If your ld is newer enough, you can use
-z muldefs Allow multiple definitions
In thise case, the first definition will be used.
H.J.