This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: question of ld
- From: "H . J . Lu" <hjl at lucon dot org>
- To: Shiyi Ma <syma at avanticorp dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 16 May 2002 08:02:06 -0700
- Subject: Re: question of ld
- References: <3CE378E4.19AD9400@avanticorp.com>
On Thu, May 16, 2002 at 05:16:20PM +0800, Shiyi Ma wrote:
> Now I am doing a project under SunOS and Linux. And want to
> build a lib file which is combined of many object files. In the lib
> file, there are many symbols which should not be seen. So I want to
> strip some symols from the lib file.
Is that is a shared object or a relocatable object? You can't do it very
well with relocatable objects. But we have been doing it to shared
objects all the time in glibc on Linux.
> Under SunOS platform, there are some ld's flags to touch my
> goal.Ther are : -z muldefs -B reduce -M mapfile -B eliminate -z
> redlocsym. ( mapfile includes some symbols what I need ). And there are
> flags -z allextract and -z defaultextract to extract some lib files
> which include some object files. (These lib files are the results from
> some other source code and will make up of the lib file which I point
> out and I really need)
> I want to know which flags can do the same function under Linux
> just as the flags which I have pointed out under SunOS.
> In fact, I have tried some flags and failed. At first, I try to
> use -s to omit all symbols, but there are about half symbols left( for
> example : 20000->10000). Then I use -x and the result is the same as -s.
> What's the difference between the two flag? I also tried
> --retain-symbols-file FILE, --version-script FILE and -R FILE, but I
> don't
> know correct file format and failed. Who can tell me the right FILE
> format?
Do
# info ld
and search for --version-script is a good start. The easy one is
{
global:
foo;
local:
*;
};
or
MY_VERSION {
global:
foo;
local:
*;
};
H.J.