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]

Re: DT_NEEDED



On Fri, 18 May 2001 17:48:38 +0930 amodra@one.net.au wrote:

> I suspect some of your recent changes to elflink.h are in 
> violation of the ELF spec.
> http://www.sco.com/developer/devspecs/gabi41.pdf says:
>
>
> "Names in the dependency list are copies either of the DT_SONAME strings
> or the path names of the shared objects used to build the object file.
> For example, if the link editor builds an executable file using one
> shared object with a DT_SONAME entry of lib1 and another shared
> object library with the path name /usr/lib/lib2, the executable file
> will contain lib1 and /usr/lib/lib2 in its dependency list.

Having been the "bug" reporter I feel obliged to speak up.

On reading the above referenced spec. closely, I am inclined to 
agree with Alan Modra. Also it seems to me that the linker, prior
to HJ's fix has been behaving in accordance with the spec. In 
other words, it was adding the full path names of .so files to 
the dependency list of the linked output since they *did not*
have DT_SONAME strings.

With this background, (where we don't use HJ's patch) consider the
following scenario. Assume I have a couple of shared objects (say
liba.so and libb.so) that were built without DT_SONAME entry (i.e.,
have no name). I'd like to use these to rollup my own SO - say
libfoo.so.  I know that when I use libfoo.so, I'll ensure that libb.so
and libb.so will be in my LD_LIBRARY_PATH and in a place other than
they were at the time of building libfoo.so. How do I instruct the
linker NOT to place the full path names of liba.so and libb.so in
DT_NEEDED entries of libfoo.so? I tried using both the following
commands:

gcc -shared -o libfoo.so foo.c /full/path/to/liba.so  /full/path/to/libb.so

as well as 

gcc -L/full/path/to -shared -o libfoo.so foo.c -la  -lb

but got the full path of liba.so and libb.so listed in the dependency
list of libfoo.so.

Although a couple of possibile "solutions" come to mind, I am
wondering if this is even a problem and if I am missing something
obvious to achieve what I want - i.e., choose which file's full path
name should be in the dependency list and which shouldn't _in case 
the input SO's do not have a DT_SONAME entry._

Thanks in advance for all the help,

Bharadwaj


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