This is the mail archive of the
mailing list for the binutils project.
Re: Shared library question
- From: "H. J. Lu" <hjl at lucon dot org>
- To: "Zagorodnev, Grigory" <Grigory_Zagorodnev at stl dot sarov dot ru>
- Cc: 'Jakub Jelinek' <jakub at redhat dot com>,"'binutils at sources dot redhat dot com'" <binutils at sources dot redhat dot com>
- Date: Thu, 18 Jul 2002 12:00:24 -0700
- Subject: Re: Shared library question
- References: <51524B6C689ED4118D4F0090273ACE329288BF@odyssey.stl.sarov.ru>
On Thu, Jul 18, 2002 at 08:09:02PM +0400, Zagorodnev, Grigory wrote:
> >> Actually I found the reason and made the fix for _my_particular_case. But
> >> seems to be a linker bug. Should it be reflected in separate report or
> >Please provide a small testcase to show the bug. I will look into it.
> Given test case reproduces the _desired_ situation: 'old' application is
> still running, new - could not be built. You should see final 'PASSED'
> Now, if you uncomment marked line in the version.map file and run the test
> again, you will see the failure: 'old' application is unable to run.
> And, of cource you will not see 'PASSED' message.
> Note: just run make.
Your Makefile is wrong.
is not the same as
After fixing that, I got
- Build the 'old' library first
gcc -shared -Wl,-soname=libfoo.so -o libfoo.so libfoo.c
- Next, build the application linked against it
gcc main.c -L. -lfoo
- Make sure that it runs (you should see 'foo is there' message)
foo is there
- Now build the 'new' library
gcc -shared -DLIB_X -Wl,-soname=libfoo.so -o libfoo.so libfoo.c
- Make sure that the application is still runable
foo is there
- Now try build application linked against 'new' library
(you should see unresolved reference message)
gcc main.c -L. -lfoo 2>/dev/null
make: [all] Error 1 (ignored)
BTW, there was a bug in glibc, which would cause your problem. It was
2002-04-02 Ulrich Drepper <email@example.com>
* elf/do-lookup.h (do_lookup): 2 is the first user-defined version
number [PR libc/3111].
Please make sure your glibc is ok.