+2020-05-19 Alan Modra <amodra@gmail.com>
+
+ * aix5ppc-core.c (xcoff64_core_file_matches_executable_p): Use
+ bfd_get_filename rather than accessing bfd->filename directly.
+ * aout-target.h (MY (object_p)): Likewise.
+ * aoutx.h (aout_find_nearest_line, aout_link_write_symbols): Likewise.
+ * archive.c (find_nested_archive, _bfd_generic_read_ar_hdr_mag),
+ (_bfd_construct_extended_name_table, _bfd_bsd44_write_ar_hdr),
+ (_bfd_archive_bsd44_construct_extended_name_table),
+ (_bfd_write_archive_contents, _bfd_compute_and_write_armap),
+ (_bfd_bsd_write_armap): Likewise.
+ * bfd.c (bfd_errmsg, _bfd_doprnt): Likewise.
+ * cache.c (bfd_open_file): Likewise.
+ * ecoff.c (_bfd_ecoff_write_armap): Likewise.
+ * ecofflink.c (bfd_ecoff_debug_accumulate_other): Likewise.
+ * elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
+ * elf32-frv.c (elf32_frv_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_final_link): Likewise.
+ * elf32-nds32.c (nds32_elf_output_symbol_hook),
+ (patch_tls_desc_to_ie): Likewise.
+ * elf32-spu.c (sort_bfds, print_one_overlay_section),
+ (spu_elf_auto_overlay): Likewise.
+ * elf64-hppa.c (elf_hppa_final_link): Likewise.
+ * elf64-ia64-vms.c (elf64_ia64_size_dynamic_sections): Likewise.
+ * elfcore.h (elf_core_file_matches_executable_p): Likewise.
+ * elflink.c (bfd_elf_size_dynamic_sections),
+ (elf_link_input_bfd): Likewise.
+ * linker.c (_bfd_generic_link_output_symbols): Likewise.
+ * mach-o.c (bfd_mach_o_follow_dsym),
+ (bfd_mach_o_close_and_cleanup): Likewise.
+ * opncls.c (_bfd_delete_bfd, _maybe_make_executable),
+ (find_separate_debug_file, get_build_id_name): Likewise.
+ * pdp11.c (aout_find_nearest_line, aout_link_write_symbols): Likewise.
+ * plugin.c (bfd_plugin_open_input): Likewise.
+ * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Likewise.
+ * som.c (som_write_armap): Likewise.
+ * srec.c (srec_write_record, srec_write_symbols): Likewise.
+ * vms-lib.c (_bfd_vms_lib_get_imagelib_file),
+ (_bfd_vms_lib_write_archive_contents): Likewise.
+ * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
+
2020-05-19 Alan Modra <amodra@gmail.com>
PR 25713
}
str1 = strrchr (path, '/');
- str2 = strrchr (exec_bfd->filename, '/');
+ str2 = strrchr (bfd_get_filename (exec_bfd), '/');
/* Step over character '/'. */
str1 = str1 != NULL ? str1 + 1 : path;
- str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename;
+ str2 = str2 != NULL ? str2 + 1 : bfd_get_filename (exec_bfd);
if (strcmp (str1, str2) == 0)
return_value = TRUE;
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
#endif
- if (stat (abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
+ if (stat (bfd_get_filename (abfd), &buf) == 0
+ && (buf.st_mode & S_IXUSR) != 0)
abfd->flags |= EXEC_P;
}
#endif /* ENTRY_CAN_BE_ZERO */
bfd_size_type filelen, funclen;
char *buf;
- *filename_ptr = abfd->filename;
+ *filename_ptr = bfd_get_filename (abfd);
*functionname_ptr = NULL;
*line_ptr = 0;
if (disriminator_ptr)
discarding such symbols. */
if (strip != strip_all
&& (strip != strip_some
- || bfd_hash_lookup (flaginfo->info->keep_hash, input_bfd->filename,
+ || bfd_hash_lookup (flaginfo->info->keep_hash,
+ bfd_get_filename (input_bfd),
FALSE, FALSE) != NULL)
&& discard != discard_all)
{
H_PUT_8 (output_bfd, 0, outsym->e_other);
H_PUT_16 (output_bfd, 0, outsym->e_desc);
strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
- input_bfd->filename, FALSE);
+ bfd_get_filename (input_bfd), FALSE);
if (strtab_index == (bfd_size_type) -1)
return FALSE;
PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
bfd *abfd;
/* PR 15140: Don't allow a nested archive pointing to itself. */
- if (filename_cmp (filename, arch_bfd->filename) == 0)
+ if (filename_cmp (filename, bfd_get_filename (arch_bfd)) == 0)
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
abfd != NULL;
abfd = abfd->archive_next)
{
- if (filename_cmp (filename, abfd->filename) == 0)
+ if (filename_cmp (filename, bfd_get_filename (abfd)) == 0)
return abfd;
}
abfd = open_nested_file (filename, arch_bfd);
char *
_bfd_append_relative_path (bfd *arch, char *elt_name)
{
- const char *arch_name = arch->filename;
+ const char *arch_name = bfd_get_filename (arch);
const char *base_name = lbasename (arch_name);
size_t prefix_len;
char *filename;
if (bfd_is_thin_archive (abfd))
{
- const char *filename = current->filename;
+ const char *filename = bfd_get_filename (current);
/* If the element being added is a member of another archive
(i.e., we are flattening), use the containing archive's name. */
if (current->my_archive
&& ! bfd_is_thin_archive (current->my_archive))
- filename = current->my_archive->filename;
+ filename = bfd_get_filename (current->my_archive);
/* If the path is the same as the previous path seen,
reuse it. This can happen when flattening a thin
/* If the path is relative, adjust it relative to
the containing archive. */
if (! IS_ABSOLUTE_PATH (filename)
- && ! IS_ABSOLUTE_PATH (abfd->filename))
- normal = adjust_relative_path (filename, abfd->filename);
+ && ! IS_ABSOLUTE_PATH (bfd_get_filename (abfd)))
+ normal = adjust_relative_path (filename, bfd_get_filename (abfd));
else
normal = filename;
continue;
}
- normal = normalize (abfd, current->filename);
+ normal = normalize (abfd, bfd_get_filename (current));
if (normal == NULL)
return FALSE;
const char *normal;
unsigned int thislen;
long stroff;
- const char *filename = current->filename;
+ const char *filename = bfd_get_filename (current);
if (bfd_is_thin_archive (abfd))
{
(i.e., we are flattening), use the containing archive's name. */
if (current->my_archive
&& ! bfd_is_thin_archive (current->my_archive))
- filename = current->my_archive->filename;
+ filename = bfd_get_filename (current->my_archive);
/* If the path is the same as the previous path seen,
reuse it. This can happen when flattening a thin
archive that contains other archives.
if (last_filename && filename_cmp (last_filename, filename) == 0)
normal = last_filename;
else if (! IS_ABSOLUTE_PATH (filename)
- && ! IS_ABSOLUTE_PATH (abfd->filename))
- normal = adjust_relative_path (filename, abfd->filename);
+ && ! IS_ABSOLUTE_PATH (bfd_get_filename (abfd)))
+ normal = adjust_relative_path (filename, bfd_get_filename (abfd));
else
normal = filename;
}
current != NULL;
current = current->archive_next)
{
- const char *normal = normalize (abfd, current->filename);
+ const char *normal = normalize (abfd, bfd_get_filename (current));
int has_space = 0;
unsigned int len;
if (is_bsd44_extended_name (hdr->ar_name))
{
/* This is a BSD 4.4 extended name. */
- const char *fullname = normalize (abfd, abfd->filename);
+ const char *fullname = normalize (abfd, bfd_get_filename (abfd));
unsigned int len = strlen (fullname);
unsigned int padded_len = (len + 3) & ~3;
if (!current->arelt_data)
{
current->arelt_data =
- bfd_ar_hdr_from_filesystem (arch, current->filename, current);
+ bfd_ar_hdr_from_filesystem (arch, bfd_get_filename (current),
+ current);
if (!current->arelt_data)
goto input_err;
/* Put in the file name. */
BFD_SEND (arch, _bfd_truncate_arname,
- (arch, current->filename, (char *) arch_hdr (current)));
+ (arch, bfd_get_filename (current),
+ (char *) arch_hdr (current)));
}
if (makemap && ! hasobjects)
/* Drop all the files called __.SYMDEF, we're going to make our own. */
while (arch->archive_head
- && strcmp (arch->archive_head->filename, "__.SYMDEF") == 0)
+ && strcmp (bfd_get_filename (arch->archive_head), "__.SYMDEF") == 0)
arch->archive_head = arch->archive_head->archive_next;
/* Map over each element. */
{
struct stat statbuf;
- if (stat (arch->filename, &statbuf) == 0)
+ if (stat (bfd_get_filename (arch), &statbuf) == 0)
bfd_ardata (arch)->armap_timestamp = (statbuf.st_mtime
+ ARMAP_TIME_OFFSET);
uid = getuid();
char *buf;
const char *msg = bfd_errmsg (input_error);
- if (asprintf (&buf, _(bfd_errmsgs [error_tag]), input_bfd->filename, msg)
- != -1)
+ if (asprintf (&buf, _(bfd_errmsgs [error_tag]),
+ bfd_get_filename (input_bfd), msg) != -1)
return buf;
/* Ick, what to do on out of memory? */
else if (abfd->my_archive
&& !bfd_is_thin_archive (abfd->my_archive))
result = fprintf (stream, "%s(%s)",
- abfd->my_archive->filename,
- abfd->filename);
+ bfd_get_filename (abfd->my_archive),
+ bfd_get_filename (abfd));
else
- result = fprintf (stream, "%s", abfd->filename);
+ result = fprintf (stream, "%s", bfd_get_filename (abfd));
}
else
PRINT_TYPE (void *, p);
{
case read_direction:
case no_direction:
- abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_RB);
+ abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd), FOPEN_RB);
break;
case both_direction:
case write_direction:
if (abfd->opened_once)
{
- abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_RUB);
+ abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd),
+ FOPEN_RUB);
if (abfd->iostream == NULL)
- abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB);
+ abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd),
+ FOPEN_WUB);
}
else
{
the --info option. */
struct stat s;
- if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
- unlink_if_ordinary (abfd->filename);
+ if (stat (bfd_get_filename (abfd), &s) == 0 && s.st_size != 0)
+ unlink_if_ordinary (bfd_get_filename (abfd));
#endif
- abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB);
+ abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd),
+ FOPEN_WUB);
abfd->opened_once = TRUE;
}
break;
complain that the index is out of date. Actually, the Ultrix
linker just checks the archive name; the GNU linker may check the
date. */
- stat (abfd->filename, &statbuf);
+ stat (bfd_get_filename (abfd), &statbuf);
_bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
(long) (statbuf.st_mtime + 60));
fdr.issBase = output_symhdr->issMax;
fdr.cbSs = 0;
fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr,
- input_bfd->filename);
+ bfd_get_filename (input_bfd));
if (fdr.rss == -1)
return FALSE;
fdr.isymBase = output_symhdr->isymMax;
input file basename is crt0.o only once. */
if (silence_segment_error == 1)
silence_segment_error =
- (strlen (input_bfd->filename) == 6
- && filename_cmp (input_bfd->filename, "crt0.o") == 0)
- || (strlen (input_bfd->filename) > 6
- && filename_cmp (input_bfd->filename
- + strlen (input_bfd->filename) - 7,
+ (strlen (bfd_get_filename (input_bfd)) == 6
+ && filename_cmp (bfd_get_filename (input_bfd), "crt0.o") == 0)
+ || (strlen (bfd_get_filename (input_bfd)) > 6
+ && filename_cmp (bfd_get_filename (input_bfd)
+ + strlen (bfd_get_filename (input_bfd)) - 7,
"/crt0.o") == 0)
? -1 : 0;
#endif
input file basename is crt0.o only once. */
if (silence_segment_error == 1)
silence_segment_error =
- (strlen (input_bfd->filename) == 6
- && filename_cmp (input_bfd->filename, "crt0.o") == 0)
- || (strlen (input_bfd->filename) > 6
- && filename_cmp (input_bfd->filename
- + strlen (input_bfd->filename) - 7,
+ (strlen (bfd_get_filename (input_bfd)) == 6
+ && filename_cmp (bfd_get_filename (input_bfd), "crt0.o") == 0)
+ || (strlen (bfd_get_filename (input_bfd)) > 6
+ && filename_cmp (bfd_get_filename (input_bfd)
+ + strlen (bfd_get_filename (input_bfd)) - 7,
"/crt0.o") == 0)
? -1 : 0;
if (!silence_segment_error
/* Do not attempt to sort non-regular files. This is here
especially for configure scripts and kernel builds which run
tests with "ld [...] -o /dev/null". */
- if (stat (abfd->filename, &buf) != 0
+ if (stat (bfd_get_filename (abfd), &buf) != 0
|| !S_ISREG(buf.st_mode))
return TRUE;
if (bfd_is_const_section (input_sec))
source = input_sec->name;
else
- source = input_sec->owner->filename;
+ source = bfd_get_filename (input_sec->owner);
fprintf (sym_ld_script, "\t%s = 0x%08lx;\t /* %s */\n",
h->root.root.string,
if (!rz)
{
- printf ("%s: %s @ 0x%08x\n", __func__, ibfd->filename,
+ printf ("%s: %s @ 0x%08x\n", __func__, bfd_get_filename (ibfd),
(int) rel->r_offset);
BFD_ASSERT(0); /* Unsupported pattern. */
}
bfd *const *abfd1 = a;
bfd *const *abfd2 = b;
- return filename_cmp ((*abfd1)->filename, (*abfd2)->filename);
+ return filename_cmp (bfd_get_filename (*abfd1), bfd_get_filename (*abfd2));
}
static unsigned int
if (fprintf (script, " %s%c%s (%s)\n",
(sec->owner->my_archive != NULL
- ? sec->owner->my_archive->filename : ""),
+ ? bfd_get_filename (sec->owner->my_archive) : ""),
info->path_separator,
- sec->owner->filename,
+ bfd_get_filename (sec->owner),
sec->name) <= 0)
return -1;
if (sec->segment_mark)
sec = call_fun->sec;
if (fprintf (script, " %s%c%s (%s)\n",
(sec->owner->my_archive != NULL
- ? sec->owner->my_archive->filename : ""),
+ ? bfd_get_filename (sec->owner->my_archive) : ""),
info->path_separator,
- sec->owner->filename,
+ bfd_get_filename (sec->owner),
sec->name) <= 0)
return -1;
for (call = call_fun->call_list; call; call = call->next)
if (sec != NULL
&& fprintf (script, " %s%c%s (%s)\n",
(sec->owner->my_archive != NULL
- ? sec->owner->my_archive->filename : ""),
+ ? bfd_get_filename (sec->owner->my_archive) : ""),
info->path_separator,
- sec->owner->filename,
+ bfd_get_filename (sec->owner),
sec->name) <= 0)
return -1;
if (sec != NULL
&& fprintf (script, " %s%c%s (%s)\n",
(sec->owner->my_archive != NULL
- ? sec->owner->my_archive->filename : ""),
+ ? bfd_get_filename (sec->owner->my_archive) : ""),
info->path_separator,
- sec->owner->filename,
+ bfd_get_filename (sec->owner),
sec->name) <= 0)
return -1;
for (call = call_fun->call_list; call; call = call->next)
qsort (bfd_arr, bfd_count, sizeof (*bfd_arr), sort_bfds);
for (i = 1; i < bfd_count; ++i)
- if (filename_cmp (bfd_arr[i - 1]->filename, bfd_arr[i]->filename) == 0)
+ if (filename_cmp (bfd_get_filename (bfd_arr[i - 1]),
+ bfd_get_filename (bfd_arr[i])) == 0)
{
if (bfd_arr[i - 1]->my_archive == bfd_arr[i]->my_archive)
{
if (bfd_arr[i - 1]->my_archive && bfd_arr[i]->my_archive)
/* xgettext:c-format */
info->callbacks->einfo (_("%s duplicated in %s\n"),
- bfd_arr[i]->filename,
- bfd_arr[i]->my_archive->filename);
+ bfd_get_filename (bfd_arr[i]),
+ bfd_get_filename (bfd_arr[i]->my_archive));
else
info->callbacks->einfo (_("%s duplicated\n"),
- bfd_arr[i]->filename);
+ bfd_get_filename (bfd_arr[i]));
ok = FALSE;
}
}
/* Do not attempt to sort non-regular files. This is here
especially for configure scripts and kernel builds which run
tests with "ld [...] -o /dev/null". */
- if (stat (abfd->filename, &buf) != 0
+ if (stat (bfd_get_filename (abfd), &buf) != 0
|| !S_ISREG(buf.st_mode))
return TRUE;
elf_ia64_vms_ident (abfd)))
return FALSE;
- soname = vms_get_module_name (abfd->filename, TRUE);
+ soname = vms_get_module_name (bfd_get_filename (abfd), TRUE);
if (soname == NULL)
return FALSE;
strindex = dynstrsec->size;
corename = elf_tdata (core_bfd)->core->program;
if (corename != NULL)
{
- const char* execname = strrchr (exec_bfd->filename, '/');
+ const char* execname = strrchr (bfd_get_filename (exec_bfd), '/');
- execname = execname ? execname + 1 : exec_bfd->filename;
+ execname = execname ? execname + 1 : bfd_get_filename (exec_bfd);
if (strcmp (execname, corename) != 0)
return FALSE;
{
size_t indx;
- name = lbasename (output_bfd->filename);
+ name = lbasename (bfd_get_filename (output_bfd));
def.vd_hash = bfd_elf_hash (name);
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
name, FALSE);
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
elf_dt_name (vn->vn_bfd) != NULL
? elf_dt_name (vn->vn_bfd)
- : lbasename (vn->vn_bfd->filename),
+ : lbasename (bfd_get_filename
+ (vn->vn_bfd)),
FALSE);
if (indx == (size_t) -1)
return FALSE;
{
_bfd_error_handler (_("warning: --enable-non-contiguous-regions "
"discards section `%s' from '%s'\n"),
- isec->name, isec->owner->filename);
+ isec->name, bfd_get_filename (isec->owner));
continue;
}
osym.st_shndx = SHN_ABS;
if (!elf_link_output_symstrtab (flinfo,
(input_bfd->lto_output ? NULL
- : input_bfd->filename),
+ : bfd_get_filename (input_bfd)),
&osym, bfd_abs_section_ptr,
NULL))
return FALSE;
#ifdef DEBUG
printf ("Encountered a complex symbol!");
printf (" (input_bfd %s, section %s, reloc %ld\n",
- input_bfd->filename, o->name,
+ bfd_get_filename (input_bfd), o->name,
(long) (rel - internal_relocs));
printf (" symbol: idx %8.8lx, name %s\n",
r_symndx, sym_name);
newsym = bfd_make_empty_symbol (input_bfd);
if (!newsym)
return FALSE;
- newsym->name = input_bfd->filename;
+ newsym->name = bfd_get_filename (input_bfd);
newsym->value = 0;
newsym->flags = BSF_LOCAL | BSF_FILE;
newsym->section = sec;
if (abfd->my_archive && !bfd_is_thin_archive (abfd->my_archive))
base_bfd = abfd->my_archive;
/* BFD may have been opened from a stream. */
- if (base_bfd->filename == NULL)
+ if (bfd_get_filename (base_bfd) == NULL)
{
bfd_set_error (bfd_error_invalid_operation);
return NULL;
}
- base_basename = lbasename (base_bfd->filename);
+ base_basename = lbasename (bfd_get_filename (base_bfd));
uuid_cmd = bfd_mach_o_lookup_uuid_command (abfd);
if (uuid_cmd == NULL)
It seems apple's GDB checks all files in the dSYM bundle directory.
http://opensource.apple.com/source/gdb/gdb-1708/src/gdb/macosx/macosx-tdep.c
*/
- dsym_filename = (char *)bfd_malloc (strlen (base_bfd->filename)
+ dsym_filename = (char *)bfd_malloc (strlen (bfd_get_filename (base_bfd))
+ strlen (dsym_subdir) + 1
+ strlen (base_basename) + 1);
if (dsym_filename == NULL)
return NULL;
sprintf (dsym_filename, "%s%s/%s",
- base_bfd->filename, dsym_subdir, base_basename);
+ bfd_get_filename (base_bfd), dsym_subdir, base_basename);
dsym_bfd = bfd_mach_o_find_dsym (dsym_filename, uuid_cmd,
bfd_get_arch_info (abfd));
but it is small, and happens when we are closing down, so it
should not matter too much. */
char *dsym_filename = (char *)(fat_bfd
- ? fat_bfd->filename
- : mdata->dsym_bfd->filename);
+ ? bfd_get_filename (fat_bfd)
+ : bfd_get_filename (mdata->dsym_bfd));
#endif
bfd_close (mdata->dsym_bfd);
mdata->dsym_bfd = NULL;
objalloc_free ((struct objalloc *) abfd->memory);
}
- if (abfd->filename)
- free ((char *) abfd->filename);
+ free ((char *) bfd_get_filename (abfd));
free (abfd->arelt_data);
free (abfd);
}
{
struct stat buf;
- if (stat (abfd->filename, &buf) == 0
+ if (stat (bfd_get_filename (abfd), &buf) == 0
/* Do not attempt to change non-regular files. This is
here especially for configure scripts and kernel builds
which run tests with "ld [...] -o /dev/null". */
unsigned int mask = umask (0);
umask (mask);
- chmod (abfd->filename,
+ chmod (bfd_get_filename (abfd),
(0777
& (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask))));
}
debug_file_directory = ".";
/* BFD may have been opened from a stream. */
- if (abfd->filename == NULL)
+ if (bfd_get_filename (abfd) == NULL)
{
bfd_set_error (bfd_error_invalid_operation);
return NULL;
if (include_dirs)
{
- for (dirlen = strlen (abfd->filename); dirlen > 0; dirlen--)
- if (IS_DIR_SEPARATOR (abfd->filename[dirlen - 1]))
+ const char *fname = bfd_get_filename (abfd);
+ for (dirlen = strlen (fname); dirlen > 0; dirlen--)
+ if (IS_DIR_SEPARATOR (fname[dirlen - 1]))
break;
dir = (char *) bfd_malloc (dirlen + 1);
free (base);
return NULL;
}
- memcpy (dir, abfd->filename, dirlen);
+ memcpy (dir, fname, dirlen);
dir[dirlen] = '\0';
}
else
/* Compute the canonical name of the bfd object with all symbolic links
resolved, for use in the global debugfile directory. */
- canon_dir = lrealpath (abfd->filename);
+ canon_dir = lrealpath (bfd_get_filename (abfd));
for (canon_dirlen = strlen (canon_dir); canon_dirlen > 0; canon_dirlen--)
if (IS_DIR_SEPARATOR (canon_dir[canon_dirlen - 1]))
break;
bfd_size_type s;
bfd_byte *d;
- if (abfd == NULL || abfd->filename == NULL || build_id_out == NULL)
+ if (abfd == NULL || bfd_get_filename (abfd) == NULL || build_id_out == NULL)
{
bfd_set_error (bfd_error_invalid_operation);
return NULL;
size_t filelen, funclen;
char *buf;
- *filename_ptr = abfd->filename;
+ *filename_ptr = bfd_get_filename (abfd);
*functionname_ptr = 0;
*line_ptr = 0;
if (discriminator_ptr)
discarding such symbols. */
if (strip != strip_all
&& (strip != strip_some
- || bfd_hash_lookup (flaginfo->info->keep_hash, input_bfd->filename,
+ || bfd_hash_lookup (flaginfo->info->keep_hash,
+ bfd_get_filename (input_bfd),
FALSE, FALSE) != NULL)
&& discard != discard_all)
{
H_PUT_8 (output_bfd, N_TEXT, outsym->e_type);
strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
- input_bfd->filename, FALSE);
+ bfd_get_filename (input_bfd), FALSE);
if (strtab_index == (bfd_size_type) -1)
return FALSE;
PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
while (iobfd->my_archive
&& !bfd_is_thin_archive (iobfd->my_archive))
iobfd = iobfd->my_archive;
- file->name = iobfd->filename;
+ file->name = bfd_get_filename (iobfd);
if (!iobfd->iostream && !bfd_open_file (iobfd))
return 0;
}
str1 = strrchr (path, '/');
- str2 = strrchr (exec_bfd->filename, '/');
+ str2 = strrchr (bfd_get_filename (exec_bfd), '/');
/* step over character '/' */
str1 = str1 != NULL ? str1 + 1 : path;
- str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename;
+ str2 = str2 != NULL ? str2 + 1 : bfd_get_filename (exec_bfd);
if (strcmp (str1, str2) == 0)
ret = TRUE;
unsigned int module_count;
/* We'll use this for the archive's date and mode later. */
- if (stat (abfd->filename, &statbuf) != 0)
+ if (stat (bfd_get_filename (abfd), &statbuf) != 0)
{
bfd_set_error (bfd_error_system_call);
return FALSE;
static bfd_boolean
srec_write_header (bfd *abfd)
{
- unsigned int len = strlen (abfd->filename);
+ unsigned int len = strlen (bfd_get_filename (abfd));
/* I'll put an arbitrary 40 char limit on header size. */
if (len > 40)
len = 40;
return srec_write_record (abfd, 0, (bfd_vma) 0,
- (bfd_byte *) abfd->filename,
- (bfd_byte *) abfd->filename + len);
+ (bfd_byte *) bfd_get_filename (abfd),
+ (bfd_byte *) bfd_get_filename (abfd) + len);
}
static bfd_boolean
bfd_size_type len;
asymbol **table = bfd_get_outsymbols (abfd);
- len = strlen (abfd->filename);
+ len = strlen (bfd_get_filename (abfd));
if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3
- || bfd_bwrite (abfd->filename, len, abfd) != len
+ || bfd_bwrite (bfd_get_filename (abfd), len, abfd) != len
|| bfd_bwrite ("\r\n", (bfd_size_type) 2, abfd) != 2)
return FALSE;
_bfd_vms_lib_get_imagelib_file (bfd *el)
{
bfd *archive = el->my_archive;
- const char *modname = el->filename;
+ const char *modname = bfd_get_filename (el);
int modlen = strlen (modname);
char *filename;
int j;
{
/* xgettext:c-format */
_bfd_error_handler(_("could not open shared image '%s' from '%s'"),
- filename, archive->filename);
+ filename, bfd_get_filename (archive));
bfd_release (archive, filename);
return NULL;
}
unsigned int nl;
modules[i].abfd = current;
- modules[i].name = vms_get_module_name (current->filename, FALSE);
+ modules[i].name = vms_get_module_name (bfd_get_filename (current), FALSE);
modules[i].ref = 1;
/* FIXME: silently truncate long names ? */
if (abfd->my_archive == NULL || bfd_is_thin_archive (abfd->my_archive))
{
- if (!bfd_xcoff_split_import_path (abfd, abfd->filename,
+ if (!bfd_xcoff_split_import_path (abfd, bfd_get_filename (abfd),
&n->path, &n->file))
return FALSE;
n->member = "";
if (!archive_info->impfile)
{
if (!bfd_xcoff_split_import_path (archive_info->archive,
- archive_info->archive->filename,
+ bfd_get_filename (archive_info
+ ->archive),
&archive_info->imppath,
&archive_info->impfile))
return FALSE;