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: Hardcoded path named in DT_NEEDED entry


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);


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