aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-18 16:25:19 +0930
committerAlan Modra <amodra@gmail.com>2019-09-18 23:07:31 +0930
commite6f7f6d14f7e1acba0cf41726616a270e7d3c121 (patch)
tree746d1bc8b1493f816181195a8d9ffaf3f4e1fa8e /binutils
parent2b44a6a237320a390284b1a8237a6bed67d5401f (diff)
downloadgdb-e6f7f6d14f7e1acba0cf41726616a270e7d3c121.zip
gdb-e6f7f6d14f7e1acba0cf41726616a270e7d3c121.tar.gz
gdb-e6f7f6d14f7e1acba0cf41726616a270e7d3c121.tar.bz2
bfd_asymbol_* macros
The main point of this patch is to give bfd_get_section a better name, bfd_asymbol_section. bfd/ * bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section. (bfd_get_output_section): Delete. (bfd_asymbol_base): Delete. (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name), (bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy. (bfd_set_asymbol_name): New macro. * bfd-in2.h: Regenerate. * aout-cris.c: Update throughout to use bfd_asymbol_section. * aoutx.h: Likewise. * cofflink.c: Likewise. * dwarf2.c: Likewise. * ecoff.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-mips.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elfn32-mips.c: Likewise. * elfnn-aarch64.c: Likewise. * elfxx-mips.c: Likewise. * linker.c: Likewise. * pdp11.c: Likewise. * elf64-mmix.c (mmix_elf_reloc): Expand bfd_get_output_section. binutils/ * nm.c: Update bfd_get_section to bfd_asymbol_section throughout. * objcopy.c: Likewise. * objdump.c: Likewise. * rdcoff.c: Likewise. * objcopy.c (create_new_symbol): Use bfd_set_asymbol_name. (filter_symbols): Likewise. gas/ * symbols.c (S_IS_LOCAL): Update bfd_get_section to bfd_asymbol_section. gdb/ * arm-tdep.c (arm_record_special_symbol): Update bfd_get_section to bfd_asymbol_section. ld/ * ldcref.c (check_reloc_refs): Update bfd_get_section to bfd_asymbol_section.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog9
-rw-r--r--binutils/nm.c20
-rw-r--r--binutils/objcopy.c24
-rw-r--r--binutils/objdump.c6
-rw-r--r--binutils/rdcoff.c2
5 files changed, 35 insertions, 26 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index c26d278..9c791f6d 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,12 @@
+2019-09-18 Alan Modra <amodra@gmail.com>
+
+ * nm.c: Update bfd_get_section to bfd_asymbol_section throughout.
+ * objcopy.c: Likewise.
+ * objdump.c: Likewise.
+ * rdcoff.c: Likewise.
+ * objcopy.c (create_new_symbol): Use bfd_set_asymbol_name.
+ (filter_symbols): Likewise.
+
2019-09-18 Simon Marchi <simon.marchi@polymtl.ca>
* doc/Makefile.am (MOSTLYCLEANFILES): Clean all man pages,
diff --git a/binutils/nm.c b/binutils/nm.c
index 67b7ac7..0bded07 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -592,8 +592,8 @@ numeric_forward (const void *P_x, const void *P_y)
if (x == NULL || y == NULL)
bfd_fatal (bfd_get_filename (sort_bfd));
- xs = bfd_get_section (x);
- ys = bfd_get_section (y);
+ xs = bfd_asymbol_section (x);
+ ys = bfd_asymbol_section (y);
if (bfd_is_und_section (xs))
{
@@ -645,8 +645,8 @@ size_forward1 (const void *P_x, const void *P_y)
if (x == NULL || y == NULL)
bfd_fatal (bfd_get_filename (sort_bfd));
- xs = bfd_get_section (x);
- ys = bfd_get_section (y);
+ xs = bfd_asymbol_section (x);
+ ys = bfd_asymbol_section (y);
if (bfd_is_und_section (xs))
abort ();
@@ -774,7 +774,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
else
next = NULL;
- sec = bfd_get_section (sym);
+ sec = bfd_asymbol_section (sym);
/* Synthetic symbols don't have a full type set of data available, thus
we can't rely on that information for the symbol size. Ditto for
@@ -788,7 +788,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
else
{
if (from + size < fromend
- && sec == bfd_get_section (next))
+ && sec == bfd_asymbol_section (next))
sz = valueof (next) - valueof (sym);
else
sz = (bfd_get_section_vma (abfd, sec)
@@ -895,7 +895,7 @@ print_symbol (bfd * abfd,
if ((sym->flags & (BSF_SECTION_SYM | BSF_SYNTHETIC)) == 0)
version_string = bfd_get_symbol_version_string (abfd, sym, &hidden);
- if (bfd_is_und_section (bfd_get_section (sym)))
+ if (bfd_is_und_section (bfd_asymbol_section (sym)))
hidden = TRUE;
if (version_string && *version_string != '\0')
@@ -931,7 +931,7 @@ print_symbol (bfd * abfd,
lineno_cache_bfd = abfd;
}
- if (bfd_is_und_section (bfd_get_section (sym)))
+ if (bfd_is_und_section (bfd_asymbol_section (sym)))
{
static asection **secs;
static arelent ***relocs;
@@ -1001,10 +1001,10 @@ print_symbol (bfd * abfd,
}
}
}
- else if (bfd_get_section (sym)->owner == abfd)
+ else if (bfd_asymbol_section (sym)->owner == abfd)
{
if ((bfd_find_line (abfd, syms, sym, &filename, &lineno)
- || bfd_find_nearest_line (abfd, bfd_get_section (sym),
+ || bfd_find_nearest_line (abfd, bfd_asymbol_section (sym),
syms, sym->value, &filename,
&functionname, &lineno))
&& filename != NULL
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index ebb9933..ce4a4af 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1465,7 +1465,7 @@ create_new_symbol (struct addsym_node *ptr, bfd *obfd)
{
asymbol *sym = bfd_make_empty_symbol (obfd);
- bfd_asymbol_name (sym) = ptr->symdef;
+ bfd_set_asymbol_name (sym, ptr->symdef);
sym->value = ptr->symval;
sym->flags = ptr->flags;
if (ptr->section)
@@ -1503,7 +1503,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
bfd_boolean rem_leading_char;
bfd_boolean add_leading_char;
- undefined = bfd_is_und_section (bfd_get_section (sym));
+ undefined = bfd_is_und_section (bfd_asymbol_section (sym));
if (add_sym_list)
{
@@ -1521,7 +1521,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
if (new_name == name
&& (flags & BSF_SECTION_SYM) != 0)
new_name = (char *) find_section_rename (name, NULL);
- bfd_asymbol_name (sym) = new_name;
+ bfd_set_asymbol_name (sym, new_name);
name = new_name;
}
@@ -1532,7 +1532,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
|| (remove_leading_char
&& ((flags & (BSF_GLOBAL | BSF_WEAK)) != 0
|| undefined
- || bfd_is_com_section (bfd_get_section (sym)))));
+ || bfd_is_com_section (bfd_asymbol_section (sym)))));
/* Check if we will add a new leading character. */
add_leading_char =
@@ -1545,14 +1545,14 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
if (rem_leading_char && add_leading_char && !prefix_symbols_string)
{
name[0] = bfd_get_symbol_leading_char (obfd);
- bfd_asymbol_name (sym) = name;
+ bfd_set_asymbol_name (sym, name);
rem_leading_char = FALSE;
add_leading_char = FALSE;
}
/* Remove leading char. */
if (rem_leading_char)
- bfd_asymbol_name (sym) = ++name;
+ bfd_set_asymbol_name (sym, ++name);
/* Add new leading char and/or prefix. */
if (add_leading_char || prefix_symbols_string)
@@ -1571,7 +1571,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
}
strcpy (ptr, name);
- bfd_asymbol_name (sym) = n;
+ bfd_set_asymbol_name (sym, n);
name = n;
}
@@ -1579,7 +1579,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
keep = FALSE;
else if ((flags & BSF_KEEP) != 0 /* Used in relocation. */
|| ((flags & BSF_SECTION_SYM) != 0
- && ((*bfd_get_section (sym)->symbol_ptr_ptr)->flags
+ && ((*bfd_asymbol_section (sym)->symbol_ptr_ptr)->flags
& BSF_KEEP) != 0))
{
keep = TRUE;
@@ -1587,7 +1587,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
}
else if (relocatable /* Relocatable file. */
&& ((flags & (BSF_GLOBAL | BSF_WEAK)) != 0
- || bfd_is_com_section (bfd_get_section (sym))))
+ || bfd_is_com_section (bfd_asymbol_section (sym))))
keep = TRUE;
else if (bfd_decode_symclass (sym) == 'I')
/* Global symbols in $idata sections need to be retained
@@ -1598,13 +1598,13 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
else if ((flags & BSF_GLOBAL) != 0 /* Global symbol. */
|| (flags & BSF_WEAK) != 0
|| undefined
- || bfd_is_com_section (bfd_get_section (sym)))
+ || bfd_is_com_section (bfd_asymbol_section (sym)))
keep = strip_symbols != STRIP_UNNEEDED;
else if ((flags & BSF_DEBUGGING) != 0) /* Debugging symbol. */
keep = (strip_symbols != STRIP_DEBUG
&& strip_symbols != STRIP_UNNEEDED
&& ! convert_debugging);
- else if (bfd_coff_get_comdat_section (abfd, bfd_get_section (sym)))
+ else if (bfd_coff_get_comdat_section (abfd, bfd_asymbol_section (sym)))
/* COMDAT sections store special information in local
symbols, so we cannot risk stripping any of them. */
keep = TRUE;
@@ -1637,7 +1637,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
|| is_specified_symbol (name, keep_specific_htab)))
keep = TRUE;
- if (keep && is_strip_section (abfd, bfd_get_section (sym)))
+ if (keep && is_strip_section (abfd, bfd_asymbol_section (sym)))
keep = FALSE;
if (keep)
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 00541cb..4a7c8f9 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -995,7 +995,7 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *inf,
if ((sym->flags & (BSF_SECTION_SYM | BSF_SYNTHETIC)) == 0)
version_string = bfd_get_symbol_version_string (abfd, sym, &hidden);
- if (bfd_is_und_section (bfd_get_section (sym)))
+ if (bfd_is_und_section (bfd_asymbol_section (sym)))
hidden = TRUE;
name = sanitize_string (name);
@@ -1351,7 +1351,7 @@ objdump_print_addr (bfd_vma vma,
/* Adjust the vma to the reloc. */
vma += bfd_asymbol_value (sym);
- if (bfd_is_und_section (bfd_get_section (sym)))
+ if (bfd_is_und_section (bfd_asymbol_section (sym)))
skip_find = TRUE;
}
@@ -2234,7 +2234,7 @@ disassemble_bytes (struct disassemble_info * inf,
{
asection *sym_sec;
- sym_sec = bfd_get_section (*q->sym_ptr_ptr);
+ sym_sec = bfd_asymbol_section (*q->sym_ptr_ptr);
sym_name = bfd_get_section_name (aux->abfd, sym_sec);
if (sym_name == NULL || *sym_name == '\0')
sym_name = "*unknown*";
diff --git a/binutils/rdcoff.c b/binutils/rdcoff.c
index 7e58569..cbb5db1 100644
--- a/binutils/rdcoff.c
+++ b/binutils/rdcoff.c
@@ -816,7 +816,7 @@ parse_coff (bfd *abfd, asymbol **syms, long symcount, void *dhandle)
else
base = auxent.x_sym.x_misc.x_lnsz.x_lnno - 1;
- addr = bfd_get_section_vma (abfd, bfd_get_section (sym));
+ addr = bfd_get_section_vma (abfd, bfd_asymbol_section (sym));
++linenos;