aboutsummaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-05-19 12:35:03 +0930
committerAlan Modra <amodra@gmail.com>2020-05-19 12:35:03 +0930
commit765cf5f623dbc2de8c8791bce9a29fcc3492436c (patch)
tree1e87eff4df1606a321398a0a43997673ffc0a0d0 /bfd/opncls.c
parent0e1d094e96739f71f5041731a1769021421a71ca (diff)
downloadgdb-765cf5f623dbc2de8c8791bce9a29fcc3492436c.zip
gdb-765cf5f623dbc2de8c8791bce9a29fcc3492436c.tar.gz
gdb-765cf5f623dbc2de8c8791bce9a29fcc3492436c.tar.bz2
Use bfd_get_filename throughout bfd
* 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.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 99097a9..5d3437d 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -126,8 +126,7 @@ _bfd_delete_bfd (bfd *abfd)
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);
}
@@ -709,7 +708,7 @@ _maybe_make_executable (bfd * 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". */
@@ -718,7 +717,7 @@ _maybe_make_executable (bfd * abfd)
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))));
}
@@ -1400,7 +1399,7 @@ find_separate_debug_file (bfd * abfd,
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;
@@ -1420,8 +1419,9 @@ find_separate_debug_file (bfd * abfd,
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);
@@ -1430,7 +1430,7 @@ find_separate_debug_file (bfd * abfd,
free (base);
return NULL;
}
- memcpy (dir, abfd->filename, dirlen);
+ memcpy (dir, fname, dirlen);
dir[dirlen] = '\0';
}
else
@@ -1442,7 +1442,7 @@ find_separate_debug_file (bfd * abfd,
/* 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;
@@ -1909,7 +1909,7 @@ get_build_id_name (bfd *abfd, void *build_id_out_p)
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;