+2020-05-19 Alan Modra <amodra@gmail.com>
+
+ * emultempl/beos.em (sort_by_file_name): Use bfd_get_filename
+ rather than accessing bfd->filename directly.
+ * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise.
+ * emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
+ * emultempl/spuelf.em (embedded_spu_file): Likewise.
+ * ldlang.c (input_statement_is_archive_path, wild_sort),
+ (check_excluded_libs): Likewise.
+ * ldmain.c (add_archive_element): Likewise.
+ * ldmisc.c (vfinfo): Likewise.
+ * pe-dll.c (auto_export, generate_edata, pe_create_import_fixup),
+ (pe_dll_generate_implib, pe_process_import_defs): Likewise.
+ * plugin.c (plugin_object_p): Likewise.
+
2020-05-18 Douglas B Rupp <rupp@adacore.com>
* ldemul.h (ldemul_print_symbol): New.
asection *sb = (*rb)->section;
int i, a_sec, b_sec;
- i = filename_cmp (sa->owner->my_archive->filename,
- sb->owner->my_archive->filename);
+ i = filename_cmp (bfd_get_filename (sa->owner->my_archive),
+ bfd_get_filename (sb->owner->my_archive));
if (i != 0)
return i;
- i = filename_cmp (sa->owner->filename, sb->owner->filename);
+ i = filename_cmp (bfd_get_filename (sa->owner),
+ bfd_get_filename (sb->owner));
if (i != 0)
return i;
/* the tail idata4/5 are the only ones without relocs to an
bfd_hash_traverse (&link_info.hash->table, pr_sym, NULL);
for (a = link_info.input_bfds; a; a = a->link.next)
- printf ("*%s\n",a->filename);
+ printf ("*%s\n", bfd_get_filename (a));
}
#endif
members, so look for the first element with a .dll
extension, and use that for the remainder of the
comparisons. */
- pnt = strrchr (is3->the_bfd->filename, '.');
+ pnt = strrchr (bfd_get_filename (is3->the_bfd), '.');
if (pnt != NULL && filename_cmp (pnt, ".dll") == 0)
break;
}
{
/* Skip static members, ie anything with a .obj
extension. */
- pnt = strrchr (is2->the_bfd->filename, '.');
+ pnt = strrchr (bfd_get_filename (is2->the_bfd), '.');
if (pnt != NULL && filename_cmp (pnt, ".obj") == 0)
continue;
- if (filename_cmp (is3->the_bfd->filename,
- is2->the_bfd->filename))
+ if (filename_cmp (bfd_get_filename (is3->the_bfd),
+ bfd_get_filename (is2->the_bfd)))
{
is_ms_arch = 0;
break;
/* This fragment might have come from an .obj file in a Microsoft
import, and not an actual import record. If this is the case,
then leave the filename alone. */
- pnt = strrchr (is->the_bfd->filename, '.');
+ pnt = strrchr (bfd_get_filename (is->the_bfd), '.');
if (is_ms_arch && (filename_cmp (pnt, ".dll") == 0))
{
else /* sentinel */
seq = 'c';
-
/* PR 25993: It is possible that is->the_bfd-filename == is->filename.
In which case calling bfd_set_filename on one will free the memory
pointed to by the other. */
- if (is->filename == is->the_bfd->filename)
+ if (is->filename == bfd_get_filename (is->the_bfd))
{
new_name = xmalloc (strlen (is->filename) + 3);
sprintf (new_name, "%s.%c", is->filename, seq);
}
else
{
- new_name = xmalloc (strlen (is->the_bfd->filename) + 3);
- sprintf (new_name, "%s.%c", is->the_bfd->filename, seq);
+ new_name
+ = xmalloc (strlen (bfd_get_filename (is->the_bfd)) + 3);
+ sprintf (new_name, "%s.%c",
+ bfd_get_filename (is->the_bfd), seq);
bfd_set_filename (is->the_bfd, new_name);
new_name = xmalloc (strlen (is->filename) + 3);
bfd_hash_traverse (&link_info.hash->table, pr_sym, NULL);
for (a = link_info.input_bfds; a; a = a->link.next)
- printf ("*%s\n",a->filename);
+ printf ("*%s\n", bfd_get_filename (a));
}
#endif
members, so look for the first element with a .dll
extension, and use that for the remainder of the
comparisons. */
- pnt = strrchr (is3->the_bfd->filename, '.');
+ pnt = strrchr (bfd_get_filename (is3->the_bfd), '.');
if (pnt != NULL && filename_cmp (pnt, ".dll") == 0)
break;
}
{
/* Skip static members, ie anything with a .obj
extension. */
- pnt = strrchr (is2->the_bfd->filename, '.');
+ pnt = strrchr (bfd_get_filename (is2->the_bfd), '.');
if (pnt != NULL && filename_cmp (pnt, ".obj") == 0)
continue;
- if (filename_cmp (is3->the_bfd->filename,
- is2->the_bfd->filename))
+ if (filename_cmp (bfd_get_filename (is3->the_bfd),
+ bfd_get_filename (is2->the_bfd)))
{
is_ms_arch = 0;
break;
/* This fragment might have come from an .obj file in a Microsoft
import, and not an actual import record. If this is the case,
then leave the filename alone. */
- pnt = strrchr (is->the_bfd->filename, '.');
+ pnt = strrchr (bfd_get_filename (is->the_bfd), '.');
if (is_ms_arch && (filename_cmp (pnt, ".dll") == 0))
{
/* PR 25993: It is possible that is->the_bfd-filename == is->filename.
In which case calling bfd_set_filename on one will free the memory
pointed to by the other. */
- if (is->filename == is->the_bfd->filename)
+ if (is->filename == bfd_get_filename (is->the_bfd))
{
new_name = xmalloc (strlen (is->filename) + 3);
sprintf (new_name, "%s.%c", is->filename, seq);
}
else
{
- new_name = xmalloc (strlen (is->the_bfd->filename) + 3);
- sprintf (new_name, "%s.%c", is->the_bfd->filename, seq);
+ new_name
+ = xmalloc (strlen (bfd_get_filename (is->the_bfd)) + 3);
+ sprintf (new_name, "%s.%c",
+ bfd_get_filename (is->the_bfd), seq);
bfd_set_filename (is->the_bfd, new_name);
new_name = xmalloc (strlen (is->filename) + 3);
return FALSE;
/* Use the filename as the symbol marking the program handle struct. */
- sym = base_name (entry->the_bfd->filename);
+ sym = base_name (bfd_get_filename (entry->the_bfd));
handle = xstrdup (sym);
for (p = handle; *p; ++p)
cmd[0] = EMBEDSPU;
cmd[1] = flags;
cmd[2] = handle;
- cmd[3] = entry->the_bfd->filename;
+ cmd[3] = bfd_get_filename (entry->the_bfd);
cmd[4] = oname;
cmd[5] = NULL;
if (verbose)
if (sep != file_spec)
{
- const char *aname = f->the_bfd->my_archive->filename;
+ const char *aname = bfd_get_filename (f->the_bfd->my_archive);
*sep = 0;
match = name_match (file_spec, aname) == 0;
*sep = link_info.path_separator;
else if (file->the_bfd != NULL
&& file->the_bfd->my_archive != NULL
&& name_match (list_tmp->name,
- file->the_bfd->my_archive->filename) == 0)
+ bfd_get_filename (file->the_bfd->my_archive)) == 0)
return TRUE;
}
}
else
{
- ln = ls->section->owner->filename;
+ ln = bfd_get_filename (ls->section->owner);
la = FALSE;
}
if (fa)
fn = file->filename;
if (la)
- ln = ls->section->owner->filename;
+ ln = bfd_get_filename (ls->section->owner);
i = filename_cmp (fn, ln);
if (i > 0)
while (lib)
{
int len = strlen (lib->name);
- const char *filename = lbasename (abfd->filename);
+ const char *filename = lbasename (bfd_get_filename (abfd));
if (strcmp (lib->name, "ALL") == 0)
{
input = (lang_input_statement_type *)
xcalloc (1, sizeof (lang_input_statement_type));
input->header.type = lang_input_statement_enum;
- input->filename = abfd->filename;
- input->local_sym_name = abfd->filename;
+ input->filename = bfd_get_filename (abfd);
+ input->local_sym_name = bfd_get_filename (abfd);
input->the_bfd = abfd;
parent = bfd_usrdata (abfd->my_archive);
fprintf (fp, "%s generated", program_name);
else if (abfd->my_archive != NULL
&& !bfd_is_thin_archive (abfd->my_archive))
- fprintf (fp, "%s(%s)", abfd->my_archive->filename,
- abfd->filename);
+ fprintf (fp, "%s(%s)",
+ bfd_get_filename (abfd->my_archive),
+ bfd_get_filename (abfd));
else
- fprintf (fp, "%s", abfd->filename);
+ fprintf (fp, "%s", bfd_get_filename (abfd));
}
else if (*fmt == 'I')
{
if (i->the_bfd != NULL
&& i->the_bfd->my_archive != NULL
&& !bfd_is_thin_archive (i->the_bfd->my_archive))
- fprintf (fp, "(%s)%s", i->the_bfd->my_archive->filename,
+ fprintf (fp, "(%s)%s",
+ bfd_get_filename (i->the_bfd->my_archive),
i->local_sym_name);
else
fprintf (fp, "%s", i->filename);
const char * libname = NULL;
if (abfd && abfd->my_archive)
- libname = lbasename (abfd->my_archive->filename);
+ libname = lbasename (bfd_get_filename (abfd->my_archive));
key.name = key.its_name = (char *) n;
/* Next, exclude symbols from certain startup objects. */
- if (abfd && (p = lbasename (abfd->filename)))
+ if (abfd && (p = lbasename (bfd_get_filename (abfd))))
{
afptr = autofilter_objlist;
while (afptr->name)
}
else if (ex->type == EXCLUDEFORIMPLIB)
{
- if (filename_cmp (abfd->filename, ex->string) == 0)
+ if (filename_cmp (bfd_get_filename (abfd), ex->string) == 0)
return 0;
}
else if (strcmp (n, ex->string) == 0)
dll_name = pe_def_file->name;
else
{
- dll_name = abfd->filename;
+ dll_name = bfd_get_filename (abfd);
for (dlnp = dll_name; *dlnp; dlnp++)
if (*dlnp == '\\' || *dlnp == '/' || *dlnp == ':')
if (!(name_thunk_sym && name_thunk_sym->type == bfd_link_hash_defined))
{
b = make_singleton_name_thunk (name, link_info.output_bfd);
- add_bfd_to_link (b, b->filename, &link_info);
+ add_bfd_to_link (b, bfd_get_filename (b), &link_info);
/* If we ever use autoimport, we have to cast text section writable. */
config.text_read_only = FALSE;
{
b = make_import_fixup_entry (name, fixup_name, symname,
link_info.output_bfd);
- add_bfd_to_link (b, b->filename, &link_info);
+ add_bfd_to_link (b, bfd_get_filename (b), &link_info);
}
}
b = make_runtime_pseudo_reloc (name, fixup_name, addend, rel->howto->bitsize,
link_info.output_bfd);
- add_bfd_to_link (b, b->filename, &link_info);
+ add_bfd_to_link (b, bfd_get_filename (b), &link_info);
if (runtime_pseudo_relocs_created++ == 0)
{
b = pe_create_runtime_relocator_reference (link_info.output_bfd);
- add_bfd_to_link (b, b->filename, &link_info);
+ add_bfd_to_link (b, bfd_get_filename (b), &link_info);
}
}
{
if (ex->type != EXCLUDEFORIMPLIB)
continue;
- found = (filename_cmp (ex->string, ibfd->filename) == 0);
+ found = (filename_cmp (ex->string, bfd_get_filename (ibfd)) == 0);
}
/* If it matched, we must open a fresh BFD for it (the original
input BFD is still needed for the DLL's final link) and add
if (found)
{
bfd *newbfd = bfd_openr (ibfd->my_archive
- ? ibfd->my_archive->filename : ibfd->filename, NULL);
+ ? bfd_get_filename (ibfd->my_archive)
+ : bfd_get_filename (ibfd), NULL);
if (!newbfd)
{
- einfo (_("%X%P: bfd_openr %s: %E\n"), ibfd->filename);
+ einfo (_("%X%P: bfd_openr %s: %E\n"), bfd_get_filename (ibfd));
return;
}
if (ibfd->my_archive)
if (!bfd_check_format_matches (arbfd, bfd_archive, NULL))
{
einfo (_("%X%P: %s(%s): can't find member in non-archive file"),
- ibfd->my_archive->filename, ibfd->filename);
+ bfd_get_filename (ibfd->my_archive),
+ bfd_get_filename (ibfd));
return;
}
newbfd = NULL;
while ((newbfd = bfd_openr_next_archived_file (arbfd, newbfd)) != 0)
{
- if (filename_cmp (newbfd->filename, ibfd->filename) == 0)
+ if (filename_cmp (bfd_get_filename (newbfd),
+ bfd_get_filename (ibfd)) == 0)
break;
}
if (!newbfd)
{
einfo (_("%X%P: %s(%s): can't find member in archive"),
- ibfd->my_archive->filename, ibfd->filename);
+ bfd_get_filename (ibfd->my_archive),
+ bfd_get_filename (ibfd));
return;
}
}
if (!do_this_dll)
{
bfd *ar_head = make_head (output_bfd);
- add_bfd_to_link (ar_head, ar_head->filename, linfo);
+ add_bfd_to_link (ar_head, bfd_get_filename (ar_head), linfo);
do_this_dll = 1;
}
exp.internal_name = imp[i].internal_name;
exp.flag_data = imp[i].data;
exp.flag_noname = exp.name ? 0 : 1;
one = make_one (&exp, output_bfd, (! exp.flag_data) && include_jmp_stub);
- add_bfd_to_link (one, one->filename, linfo);
+ add_bfd_to_link (one, bfd_get_filename (one), linfo);
}
}
if (do_this_dll)
{
bfd *ar_tail = make_tail (output_bfd);
- add_bfd_to_link (ar_tail, ar_tail->filename, linfo);
+ add_bfd_to_link (ar_tail, bfd_get_filename (ar_tail), linfo);
}
free (dll_symname);
/* We create a dummy BFD, initially empty, to house whatever symbols
the plugin may want to add. */
- abfd = plugin_get_ir_dummy_bfd (ibfd->filename, ibfd);
+ abfd = plugin_get_ir_dummy_bfd (bfd_get_filename (ibfd), ibfd);
input = bfd_alloc (abfd, sizeof (*input));
if (input == NULL)
if (!bfd_plugin_open_input (ibfd, &file))
return NULL;
- if (file.name == ibfd->filename)
+ if (file.name == bfd_get_filename (ibfd))
{
/* We must copy filename attached to ibfd if it is not an archive
member since it may be freed by bfd_close below. */
input->use_mmap = FALSE;
input->offset = file.offset;
input->filesize = file.filesize;
- input->name = plugin_strdup (abfd, ibfd->filename);
+ input->name = plugin_strdup (abfd, bfd_get_filename (ibfd));
claimed = 0;