Help with selective stripping

"Terence P. Spielman" <terence@interval.net>
2 Jan 1997 23:14:05 -0500

          From comp.compilers

Related articles
Help with selective stripping terence@interval.net (Terence P. Spielman) (1997-01-02)
| List of all articles for this month |
From: "Terence P. Spielman" <terence@interval.net>
Newsgroups: gnu.gcc.help,comp.compilers
Date: 2 Jan 1997 23:14:05 -0500
Organization: Interval Systems, Inc.
Summary: Request fro help with selective stripping
Keywords: linker, question, comment

I am trying to package a library for distribution which is actually
composed of several other libraries (lib*.a).
All the libraries are statically linked, so what I attempted
to so is
1) ar x lib*.a --> fast way to get the .o files
2) ar cr libnew.a *.o --> create new composite library
3) ranlib libnew.a


This works fine.


However, I have the additional constraint that we only want to expose
a handful of functions in this library. I was hoping to incrementally
link all the .o's into another .o, then selectively strip symbols and
the re archive the single composite/stripped .o into a new library.
i.e...


1) ar x lib*.a --> get all the .o's again
2) ld -r libnew.o *.o --> incrementally link .o's to resolve internals
3) strip -K keepsymbol1 -K keepsymbol2 ... libnew.o
4) ar cr libnew.a libnew.o
5) ranlib libnew.a


Unfortunately, step number 3 never works. No matter what I try, I
can't seem to get strip to only keep a handful of external symbols.


This is the first time I am using incrmental linking and selective
stripping (I usually just strip the resultant executables, but since
I'm shipping a library, this is not possible). Can anyone assist or
instruct me on how to accomplish my goal, what I am doing wrong, or
where to look for answers?


Thanks!
Terence Spielman
terence@interval.net
[Are there any linkers which give you a usable tree-structured name space?
I've long thought that would be useful for large projects. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.