public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: Hardcoded path named in DT_NEEDED entry
       [not found] ` <200105171756.NAA12613@ives.lkg.dec.com>
@ 2001-05-17 11:34   ` H . J . Lu
  2001-05-18  8:29     ` Bharadwaj Yadavalli
  0 siblings, 1 reply; 2+ messages in thread
From: H . J . Lu @ 2001-05-17 11:34 UTC (permalink / raw)
  To: Bharadwaj Yadavalli; +Cc: binutils

On Thu, May 17, 2001 at 01:56:58PM -0400, Bharadwaj Yadavalli wrote:
> 
> > > I have a couple of shared objects (say libs.so and libb.so)
> > > that I'd like to link to while compiling a program (say foo.c). 
> > > The result of this compilation is intended to be another .so 
> > > file (say libfoo.so).
> > > 
> > > I am using the following command to do so:
> > > 
> > > gcc -D__linux -D_REENTRANT -mieee -mcpu=ev6 -O4 \ 
> > >    -shared-o foo.so foo.c full-path-to-liba.so \ 
> > >    full-path-to-libb.so -lm -lpthread -lc -ldl
> > > 
> > > However libfoo.so has full-path-to-liba.so and 
> > > full-path-to-libb.so in its DT_NEEDED entry. I expect 
> > > to move liba.so and libb.so to a more conventional 
> > > location when I use libfoo.so. What do I need to 
> > > do to just list liba.so and libb.so in DT_NEEDED
> > > and not their full names?
> > 
> > Get binutils 2.11.90.0.8 from
> > 
> > http://ftp.kernel.org/pub/linux/devel/binutils/
> > 
> > Yes, I have fixed it. Let me know if it is still a problem.
> 
> I pulled down the above version.
> 
> % ld -v 
> GNU ld version 2.11.90.0.8 (with BFD 2.11.90.0.8)
> 
> 
> The DT_NEEDED entries still have the full pathnames.
> 
> Also, I continue to get the following link-time warning
> (with the earlier version as well)
> 
> /usr/bin/ld: warning: type and size of dynamic symbol `__gmon_start__' are not defined
> 
> Just thought I'll bring it to your attention.
> 

Oops. I missed that one. Thanks. Here is a patch. I will check it in
shortly. Speak now if anyone objects.


H.J.
----
2001-05-17  H.J. Lu  <hjl@gnu.org>

	* elflink.h (elf_link_add_object_symbols): Set DT_NEEDED to
	basename of the bfd filename.

--- elflink.h.needed	Thu May 17 11:26:31 2001
+++ elflink.h	Thu May 17 11:28:13 2001
@@ -1247,7 +1247,7 @@ elf_link_add_object_symbols (abfd, info)
 	 elf_dt_name, we don't make a DT_NEEDED entry at all, even if
 	 there is a DT_SONAME entry.  */
       add_needed = true;
-      name = bfd_get_filename (abfd);
+      name = basename (bfd_get_filename (abfd));
       if (elf_dt_name (abfd) != NULL)
 	{
 	  name = elf_dt_name (abfd);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Hardcoded path named in DT_NEEDED entry
  2001-05-17 11:34   ` Hardcoded path named in DT_NEEDED entry H . J . Lu
@ 2001-05-18  8:29     ` Bharadwaj Yadavalli
  0 siblings, 0 replies; 2+ messages in thread
From: Bharadwaj Yadavalli @ 2001-05-18  8:29 UTC (permalink / raw)
  To: H . J . Lu; +Cc: binutils, amodra

On Thu May 17 14:33:54 2001 H . J . Lu <hjl@lucon.org> wrote :
> Oops. I missed that one. Thanks. Here is a patch. I will check it in
> shortly. Speak now if anyone objects.

Never mind. I am able to get the linker not to list full path
name using a comination of -L an -l i.e.,

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

where liba.so and libb.so are my local libraries that I
know will be in the LD_LIBRARY_PATH when I use libfoo.so.

Please DO NOT apply this patch. As Alan Modra pointed out in an
earlier mail, applying this patch violates the ELF ABI spec.


Thanks for all the help and time.

Bharadwaj

> ----
> 2001-05-17  H.J. Lu  <hjl@gnu.org>
> 
> 	* elflink.h (elf_link_add_object_symbols): Set DT_NEEDED to
> 	basename of the bfd filename.
> 
> --- elflink.h.needed	Thu May 17 11:26:31 2001
> +++ elflink.h	Thu May 17 11:28:13 2001
> @@ -1247,7 +1247,7 @@ elf_link_add_object_symbols (abfd, info)
>  	 elf_dt_name, we don't make a DT_NEEDED entry at all, even if
>  	 there is a DT_SONAME entry.  */
>        add_needed = true;
> -      name = bfd_get_filename (abfd);
> +      name = basename (bfd_get_filename (abfd));
>        if (elf_dt_name (abfd) != NULL)
>  	{
>  	  name = elf_dt_name (abfd);
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-05-18  8:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010517102807.A25725@lucon.org>
     [not found] ` <200105171756.NAA12613@ives.lkg.dec.com>
2001-05-17 11:34   ` Hardcoded path named in DT_NEEDED entry H . J . Lu
2001-05-18  8:29     ` Bharadwaj Yadavalli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).