This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: Using a shared library to partly replace an archive library - ld changed behaviour


Could someone please run this test on Solaris and report the result
to me? I'd like to know what Solaris does before I make the change. I
had the impression that on Solaris, a weak definition in relocatable
file will override the strong one in DSO.


H.J.
-----
On Fri, Apr 29, 2005 at 04:37:15PM +0100, Graham Hudspith wrote:
> H. J. Lu wrote:
> 
> >
> >Can you try one thing for me?
> >
> >1. Build and run your original test on RH9.
> >2. Send me your output on RH9.
> >3. Copy the binaries to FC3.
> >4. Run the same binaries, which are built on RH9, on FC3.
> >5. Send me your output on FC3.
> >
> > 
> >
> H. J. ,
> 
>    Thanks for your persistence. Here are the results of building and
>    running my example under RH9:
> 
> [opt-testing@fender modified]$ make
> gcc -B./ -O -g   -c -o main.o main.c
> gcc -B./ -O -g -fPIC -c foo.c -o shared.o
> gcc -B./ -shared -o libshared1.so shared.o
> gcc -B./ -O -g -fPIC -c bar.c -o bar.o
> ar rv libfoo.a bar.o
> a - bar.o
> gcc -B./ -o main1 main.o libshared1.so libfoo.a -Wl,-rpath,.
> gcc -B./ -o main2 main.o libfoo.a
> gcc -B./ -shared -o libshared3.so shared.o libfoo.a
> gcc -B./ -o main3 main.o libshared3.so libfoo.a -Wl,-rpath,.
> ./main1
> Shared library
> Real bar
> ./main2
> Real bar
> ./main3
> Shared library
> Real bar
> 
>    As you can, all three examples work correctly. Now, copying the
>    binaries across to an FC3 system:
> 
> [gwh@snowball modified]$ make
> ./main1
> Shared library
> Real bar
> ./main2
> Real bar
> ./main3
> Shared library
> Real bar
> 
>    So, the RH9 binaries execute correctly under FC3. Now to BUILD and
>    run under FC3:
> 
> [gwh@snowball modified]$ make
> gcc -B./ -O -g   -c -o main.o main.c
> gcc -B./ -O -g -fPIC -c foo.c -o shared.o
> gcc -B./ -shared -o libshared1.so shared.o
> gcc -B./ -O -g -fPIC -c bar.c -o bar.o
> ar rv libfoo.a bar.o
> ar: creating libfoo.a
> a - bar.o
> gcc -B./ -o main1 main.o libshared1.so libfoo.a -Wl,-rpath,.
> gcc -B./ -o main2 main.o libfoo.a
> gcc -B./ -shared -o libshared3.so shared.o libfoo.a
> gcc -B./ -o main3 main.o libshared3.so libfoo.a -Wl,-rpath,.
> ./main1
> Real bar
> ./main2
> Real bar
> ./main3
> Shared library
> Real bar
> 
>    You can see that the run of "main1" has failed.
> 
>    I've attached the source-code again, just so we know which set we
>    are talking about.
> 
>    Regards,
> 
>        Graham.
> 




Attachment: original.tar.gz
Description: GNU Zip compressed data


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