aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorDavid O'Brien <obrien@FreeBSD.org>2002-03-19 21:03:43 +0000
committerDavid O'Brien <obrien@FreeBSD.org>2002-03-19 21:03:43 +0000
commitfed2999dfbee78db259ad1916b915cc393d22a99 (patch)
tree2b1c2b8885cd5c4d6b191fb10b87b51ae5469b52 /ld
parent0c86755622594585a7bebffeda581202d9e77640 (diff)
downloadgdb-fed2999dfbee78db259ad1916b915cc393d22a99.zip
gdb-fed2999dfbee78db259ad1916b915cc393d22a99.tar.gz
gdb-fed2999dfbee78db259ad1916b915cc393d22a99.tar.bz2
2002-03-18 David O'Brien <obrien@FreeBSD.org>
* emultempl/elf32.em: Use lbasename vs. basename to fix problem where the contents of the buffer returned from basename function will are getting overwritten while still being used. Approved by: Alan Modra <amodra@bigpond.net.au> Message-ID: <20020318032031.GD1089@bubble.sa.bigpond.net.au>
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/emultempl/elf32.em11
2 files changed, 10 insertions, 7 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 378c00d..3b55884 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-18 David O'Brien <obrien@FreeBSD.org>
+
+ * emultempl/elf32.em: Use lbasename vs. basename to fix problem where
+ the contents of the buffer returned from basename function will are
+ getting overwritten while still being used.
+
Mon Mar 18 17:38:39 CET 2002 Jan Hubicka <jh@suse.cz>
Andreas Jaeger <aj@suse.de>
Andreas Schwab <schwab@suse.de>
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 675a328..077a8fc 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -165,7 +165,7 @@ gld${EMULATION_NAME}_vercheck (s)
soname = bfd_elf_get_dt_soname (s->the_bfd);
if (soname == NULL)
- soname = basename (bfd_get_filename (s->the_bfd));
+ soname = lbasename (bfd_get_filename (s->the_bfd));
for (l = global_vercheck_needed; l != NULL; l = l->next)
{
@@ -247,7 +247,7 @@ gld${EMULATION_NAME}_stat_needed (s)
soname = bfd_elf_get_dt_soname (s->the_bfd);
if (soname == NULL)
- soname = basename (s->filename);
+ soname = lbasename (s->filename);
if (strncmp (soname, global_needed->name, suffix - global_needed->name) == 0)
einfo ("%P: warning: %s, needed by %B, may conflict with %s\n",
@@ -351,7 +351,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 = lbasename (abfd->filename);
if (trace_file_tries)
info_msg (_("found %s at %s\n"), soname, name);
@@ -369,9 +369,6 @@ cat >>e${EMULATION_NAME}.c <<EOF
DT_NEEDED entry for this file. */
bfd_elf_set_dt_needed_name (abfd, "");
- /* Previos basename call was clobbered in lang_for_each_input_file. */
- soname = basename (abfd->filename);
-
/* Tell the ELF backend that the output file needs a DT_NEEDED
entry for this file if it is used to resolve the reference in
a regular object. */
@@ -976,7 +973,7 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
/* Rather than duplicating the logic above. Just use the
filename we recorded earlier. */
- filename = xstrdup (basename (entry->filename));
+ filename = lbasename (entry->filename);
bfd_elf_set_dt_needed_name (entry->the_bfd, filename);
}