This is the mail archive of the binutils@sourceware.org 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: GNU ld linker wrapping


On Fri, Jun 02, 2006 at 04:33:49PM -0500, Shawn Yarbrough wrote:
> The third-party 3.2.2 library uses the older, version 5, C++ standard
> library that was normal for g++ 3.2.2.  My code uses version 6.  How
> would I tell the linker to use version 5 only for linking the
> third-party library, and use version 6 for linking everything else in
> my app? 

For shared libraries without versioned symbols, I think you are out of
luck.  The linker can't help you as the libs are already finally linked,
so there isn't any possibility of "wrapping" them as you imagine.
Instead, you need some magic in the dynamic linker, ld.so.  Modifying
ld.so symbol resolution would be possible, but you likely won't find
much help, at least for free, if you attempt this.  Failing that, you'd
need to edit dynamic symbols so that references in the proprietary lib
are changed to only be satisfied by a similarly changed old libstdc++.
Note that objcopy doesn't allow renaming of dynamic syms, one reason
being that the sections describing dyamic symbols are loadable and thus
can't increase in size without affecting other loaded sections.  You'd
also need to adjust symbol hashes.

For static libs, you might be able to do something with ld -r.  Link the
proprietary static lib against the static version of the old libstdc++.
Then use objcopy to remove all the syms you don't want.  The resulting
.o might then be usable, but I suspect there will be some horrible
details that will bite you.

Frankly, I wouldn't try any of this myself.  You would be better off
using the same old version of g++ as that used to compile the
proprietary libs, or pressing your vendor for new libs.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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