Subject: Re: The mysterious NEEDED
To: Jason R Thorpe <>
From: Matthias Drochner <>
List: tech-toolchain
Date: 11/01/2002 14:38:40
This is a multipart MIME message.

Content-Type: text/plain; charset=us-ascii said:
>   bfd_elf_set_dt_needed_soname (abfd, soname);
> It is obviously a bug.  There is another use of basename in that file
> which uses xstrdup() before recording the result.
> I will check in a fix, and also fix it in the master FSF Binutils
> sources. 

There is appearently something between the basename() call
and this bfd call which also indirectly calls basename().
I still get these bogus NEEDEDs.
The appended patch is verified to fix the problem.

best regards

Content-Type: text/plain ; name="ldfix"; charset=us-ascii
Content-Description: ldfix
Content-Disposition: attachment; filename="ldfix"

Index: gnu/dist/toolchain/ld/emultempl/elf32.em
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/ld/emultempl/elf32.em,v
retrieving revision 1.2
diff -u -r1.2 elf32.em
--- gnu/dist/toolchain/ld/emultempl/elf32.em	2002/10/31 23:21:17	1.2
+++ gnu/dist/toolchain/ld/emultempl/elf32.em	2002/11/01 13:32:47
@@ -329,7 +329,7 @@
     einfo ("%F%P:%B: bfd_stat failed: %E\n", abfd);
   /* First strip off everything before the last '/'.  */
-  soname = basename (abfd->filename);
+  soname = xstrdup(basename (abfd->filename));
   if (trace_file_tries)
     info_msg (_("found %s at %s\n"), soname, name);