From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27669 invoked by alias); 18 Jul 2002 19:00:26 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 27658 invoked from network); 18 Jul 2002 19:00:25 -0000 Received: from unknown (HELO rwcrmhc53.attbi.com) (204.127.198.39) by sources.redhat.com with SMTP; 18 Jul 2002 19:00:25 -0000 Received: from ocean.lucon.org ([12.234.143.38]) by rwcrmhc53.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020718190025.WZMO26053.rwcrmhc53.attbi.com@ocean.lucon.org>; Thu, 18 Jul 2002 19:00:25 +0000 Received: by ocean.lucon.org (Postfix, from userid 1000) id 5F70B125D8; Thu, 18 Jul 2002 12:00:24 -0700 (PDT) Date: Thu, 18 Jul 2002 12:01:00 -0000 From: "H. J. Lu" To: "Zagorodnev, Grigory" Cc: 'Jakub Jelinek' , "'binutils@sources.redhat.com'" Subject: Re: Shared library question Message-ID: <20020718120024.A2851@lucon.org> References: <51524B6C689ED4118D4F0090273ACE329288BF@odyssey.stl.sarov.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <51524B6C689ED4118D4F0090273ACE329288BF@odyssey.stl.sarov.ru>; from Grigory_Zagorodnev@stl.sarov.ru on Thu, Jul 18, 2002 at 08:09:02PM +0400 X-SW-Source: 2002-07/txt/msg00461.txt.bz2 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 > it > >> seems to be a linker bug. Should it be reflected in separate report or > not? > > > >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' > message. > > 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. LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH); a.out is not the same as LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) a.out After fixing that, I got # make - 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 -Wl,--version-script,version.map - 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) - PASSED BTW, there was a bug in glibc, which would cause your problem. It was fixed by 2002-04-02 Ulrich Drepper * elf/do-lookup.h (do_lookup): 2 is the first user-defined version number [PR libc/3111]. Please make sure your glibc is ok. H.J.