public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* GNU ld linker wrapping
@ 2006-06-02 22:18 Shawn Yarbrough
  0 siblings, 0 replies; 3+ messages in thread
From: Shawn Yarbrough @ 2006-06-02 22:18 UTC (permalink / raw)
  To: binutils

I'm hoping to use the linker to "protect" me from closed-source
third-party libraries I can't get rid of.  Some are static and some
are shared.  Some of the libraries use old versions of gcc/g++ such
as g++-3.2.2.

My first idea, not yet attempted, is to use a thin C library to wrap
the third-party 3.2.2 C++ library, only wrapping the few functions I
need and ignoring all others, and then link the resulting C library
against my own 3.4.5 ABI C++ code.

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?

Related to this I'm also wondering how to pull the third-party
library into my wrapper library so that I only have to distribute one
file.

Suggestions for better ways to attack this problem would also be
welcome.

Thanks,

Shawn Yarbrough
Senior E-Trading Developer
Gelber Group, LLC
syarbrough@gelbergroup.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: GNU ld linker wrapping
  2006-06-02 21:50 Shawn Yarbrough
@ 2006-06-05  3:29 ` Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2006-06-05  3:29 UTC (permalink / raw)
  To: Shawn Yarbrough; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* GNU ld linker wrapping
@ 2006-06-02 21:50 Shawn Yarbrough
  2006-06-05  3:29 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn Yarbrough @ 2006-06-02 21:50 UTC (permalink / raw)
  To: binutils

Is this the right place to ask linking questions?

I'm hoping to use the linker to "protect" me from closed-source third-party libraries I can't get rid of.  Some are static and some are shared.  Some of the libraries use old versions of gcc/g++ such as g++-3.2.2.

My first idea, not yet attempted, is to use a thin C library to wrap the third-party 3.2.2 C++ library, only wrapping the few functions I need and ignoring all others, and then link the resulting C library against my own 3.4.5 ABI C++ code.

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?

Related to this I'm also wondering how to pull the third-party library into my wrapper library so that I only have to distribute one file.

Suggestions for better ways to attack this problem would also be welcome.

Thanks,

Shawn Yarbrough
Senior E-Trading Developer
Gelber Group, LLC
syarbrough@gelbergroup.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-05  2:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-02 22:18 GNU ld linker wrapping Shawn Yarbrough
  -- strict thread matches above, loose matches on Subject: below --
2006-06-02 21:50 Shawn Yarbrough
2006-06-05  3:29 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).