This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

PATCH: Fix [BUG] runpath broken for .so's in ld


On Tue, Oct 15, 2002 at 01:19:09PM -0700, Kenny Simpson wrote:
> The runpath of a shared object is not always being
> searched when linking an executable.
> 
> The behavior I'm seeing is the following:
>   I have an external library (libext1.so), which lives
> in ~/ext1.
>   A shared library (libfoo.so) is created which links
> against libext.so and records a DT_RUNPATH for ~/ext1.
>   Another shared library (libbar.so) is created with a
> DT_RUNPATH for some other directory (ext2/libext2.so).
>   I attempt to create a binary (baz) that links
> against libfoo, and libbar.
>   The link fails as libext1 cannot be found.
> 
> Just to codify the above:
> 
> mkdir ext1;
> mkdir ext2;
> 
> dummy.c:
>         /* empty */
> 
> main.c:
>         int main() { return 0; }
> 
> Makefile:
>         ext1/libext1.so: dummy.c
>                 gcc -shared dummy.c -o $@
> 
>         ext2/libext2.so: dummy.c
>                 gcc -shared dummy.c -o $@
> 
>         libfoo.so: ext1/libext1.so
>                 gcc -shared -Lext1 -Wl,-rpath,ext1
> -Wl,--enable-new-dtags -lext1 -o $@
> 
>         libbar.so: ext2/libext2.so
>                 gcc -shared -Lext2 -Wl,-rpath,ext2
> -Wl,--enable-new-dtags -lext2 -o $@
> 
>         baz: main.c libbar.so libfoo.so
>                 gcc main.c -L. -Wl,-rpath,. -lfoo
> -lbar -o $@
> 
> make baz
> 

Thanks for your bug repart. It will be nice to provide a tar file so that I don't
have to recreate each file by hand. Here is a patch. It is late. Alan, could you
please double check it? Also please check my patch still works right for the bug

http://sources.redhat.com/ml/binutils/2000-08/msg00242.html

tried to fix.

Thanks.


H.J.

Attachment: bfd-runpatch.patch
Description: Text document


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