+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>
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)
{
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",
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);
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. */
/* 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);
}