This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Symbol versioning in dlopen modules
- From: "H . J . Lu" <hjl at lucon dot org>
- To: Zoltan Hidvegi <hzoli at austin dot ibm dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 3 Jun 2002 10:56:19 -0700
- Subject: Re: Symbol versioning in dlopen modules
- References: <200206031722.MAA54148@vlad.austin.ibm.com>
On Mon, Jun 03, 2002 at 12:22:11PM -0500, Zoltan Hidvegi wrote:
> I have an application running on Linux which privides an API to
> clients that it loads using dlopen. The problem is that this
> application itself is sometimes loaded dynamically in an environment
> where functions with the same name as my API functions may exist. To
> avoid that, was trying to use symbol versioning:
>
> void prefix_foo(int) { ... }
> __asm__(".symver prefix_foo, foo@@myapp1.0");
>
> Normally versioning is used in shared libraries, and when the linker
> sees a shared library linked to a target, it will find out the symbol
> versions from the shared library and replaces references to the
> unversioned symbol to the versioned references. The problem is that
> when I link dlopen client, I use -shared to create a dynamically
> loadable module, so the API is not linked in as a shared library,
> therefore the linker cannot set the version dependencies for the
> unefined symbols in my application. Is there a way I can specify the
> required version in the header file? I.e., when someone includes my
> header, I would like to add something in the header that tells the
> linker that I always want to bind foo to foo@@myapp1.0. I tried
>
Yes, it should work. It is similar to
http://sources.redhat.com/ml/libc-alpha/2000-11/msg00260.html
http://sources.redhat.com/ml/binutils/2000-11/msg00108.html
You may have to use my Linux binutils to do it.
H.J.