This is the mail archive of the binutils@sourceware.org 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]

Re: How to prohibit shared library binding in absolute path?


Hello Pan,

* Pan ruochen wrote on Mon, Mar 21, 2011 at 07:28:47AM CET:
> I link an application against some shared libraries in absolute-path format.
> The linker writes the absolute path into the output application.
> 
> $gcc -fpic -shared -fvisibility=hidden -O2 -o libs1.so s1.c
> $gcc -fpic -shared -fvisibility=hidden -O2 -o libs2.so s2.c
> $gcc -O2 -o foo -Wl,-rpath=. main.c /home/admin/x1/libs1.so libs2.so

To avoid that, give the libraries a soname to get that recorded in
DT_NEEDED of consumers, rather than the name of the library used for
linking: -Wl,-soname,libs1.so

Cheers,
Ralf


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