This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question of ld


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]