summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorPeter Valchev <pvalchev@cvs.openbsd.org>2002-12-02 23:10:31 +0000
committerPeter Valchev <pvalchev@cvs.openbsd.org>2002-12-02 23:10:31 +0000
commit1d8e045ff1cb05da50dc432ff2e7d7fa3c392b3e (patch)
treea4ceaf0a02471ed022d5c06c305ad0b62fab7376 /gnu/usr.bin
parent8620a81f22b44f2421847718b7e326fb27c9b1d1 (diff)
xstrdup the return value of basename() before recording it in the bfd,
fixes the "NEEDED crtend.o" problem that appeared in varios ports and had to be workarounded. from thorpej@NetBSD, thanks to drahn@ for pointing it out; ok drahn espie
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/binutils/ld/emultempl/elf32.em5
1 files changed, 3 insertions, 2 deletions
diff --git a/gnu/usr.bin/binutils/ld/emultempl/elf32.em b/gnu/usr.bin/binutils/ld/emultempl/elf32.em
index a575368f716..8d4b0636fd0 100644
--- a/gnu/usr.bin/binutils/ld/emultempl/elf32.em
+++ b/gnu/usr.bin/binutils/ld/emultempl/elf32.em
@@ -392,7 +392,7 @@ gld${EMULATION_NAME}_try_needed (name, force)
int force;
{
bfd *abfd;
- const char *soname;
+ char *soname;
abfd = bfd_openr (name, bfd_get_target (output_bfd));
if (abfd == NULL)
@@ -478,7 +478,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
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);
@@ -489,6 +489,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
{
/* Return true to indicate that we found the file, even though
we aren't going to do anything with it. */
+ free (soname);
return true;
}