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.
This commit is contained in:
Alan Modra 2019-09-18 16:25:19 +09:30
parent 2b44a6a237
commit e6f7f6d14f
30 changed files with 143 additions and 99 deletions

View File

@ -1,3 +1,29 @@
2019-09-18 Alan Modra <amodra@gmail.com>
* 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): Part expand bfd_get_output_section.
2019-09-18 Simon Marchi <simon.marchi@polymtl.ca>
* Makefile.in: Re-generate.

View File

@ -169,14 +169,14 @@ MY (swap_ext_reloc_out) (bfd *abfd,
from the abs section, or as a symbol which has an abs value.
check for that here. */
if (bfd_is_abs_section (bfd_get_section (sym)))
if (bfd_is_abs_section (bfd_asymbol_section (sym)))
{
r_extern = 0;
r_index = N_ABS;
}
else if ((sym->flags & BSF_SECTION_SYM) == 0)
{
if (bfd_is_und_section (bfd_get_section (sym))
if (bfd_is_und_section (bfd_asymbol_section (sym))
/* Remember to check for weak symbols; they count as global. */
|| (sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
r_extern = 1;

View File

@ -1570,7 +1570,7 @@ translate_to_native_sym_flags (bfd *abfd,
to another. */
sym_pointer->e_type[0] &= ~N_TYPE;
sec = bfd_get_section (cache_ptr);
sec = bfd_asymbol_section (cache_ptr);
off = 0;
if (sec == NULL)
@ -2064,14 +2064,14 @@ NAME (aout, swap_ext_reloc_out) (bfd *abfd,
Absolute symbols can come in in two ways, either as an offset
from the abs section, or as a symbol which has an abs value.
check for that here. */
if (bfd_is_abs_section (bfd_get_section (sym)))
if (bfd_is_abs_section (bfd_asymbol_section (sym)))
{
r_extern = 0;
r_index = N_ABS;
}
else if ((sym->flags & BSF_SECTION_SYM) == 0)
{
if (bfd_is_und_section (bfd_get_section (sym))
if (bfd_is_und_section (bfd_asymbol_section (sym))
|| (sym->flags & BSF_GLOBAL) != 0)
r_extern = 1;
else

View File

@ -240,18 +240,15 @@ typedef unsigned long symindex;
/* General purpose part of a symbol X;
target specific parts are in libcoff.h, libaout.h, etc. */
#define bfd_get_section(x) ((x)->section)
#define bfd_get_output_section(x) ((x)->section->output_section)
#define bfd_set_section(x,y) ((x)->section) = (y)
#define bfd_asymbol_base(x) ((x)->section->vma)
#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
#define bfd_asymbol_name(x) ((x)->name)
/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
#define bfd_asymbol_bfd(x) ((x)->the_bfd)
#define bfd_asymbol_flavour(x) \
(((x)->flags & BSF_SYNTHETIC) != 0 \
#define bfd_asymbol_section(sy) ((sy)->section)
#define bfd_asymbol_value(sy) ((sy)->section->vma + (sy)->value)
#define bfd_asymbol_name(sy) ((sy)->name)
#define bfd_asymbol_bfd(sy) ((sy)->the_bfd)
#define bfd_asymbol_flavour(sy) \
(((sy)->flags & BSF_SYNTHETIC) != 0 \
? bfd_target_unknown_flavour \
: bfd_asymbol_bfd (x)->xvec->flavour)
: (sy)->the_bfd->xvec->flavour)
#define bfd_set_asymbol_name(sy, n) do { (sy)->name = (n); } while (0)
/* A canonical archive symbol. */
/* This is a type pun with struct ranlib on purpose! */

View File

@ -247,18 +247,15 @@ typedef unsigned long symindex;
/* General purpose part of a symbol X;
target specific parts are in libcoff.h, libaout.h, etc. */
#define bfd_get_section(x) ((x)->section)
#define bfd_get_output_section(x) ((x)->section->output_section)
#define bfd_set_section(x,y) ((x)->section) = (y)
#define bfd_asymbol_base(x) ((x)->section->vma)
#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
#define bfd_asymbol_name(x) ((x)->name)
/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
#define bfd_asymbol_bfd(x) ((x)->the_bfd)
#define bfd_asymbol_flavour(x) \
(((x)->flags & BSF_SYNTHETIC) != 0 \
#define bfd_asymbol_section(sy) ((sy)->section)
#define bfd_asymbol_value(sy) ((sy)->section->vma + (sy)->value)
#define bfd_asymbol_name(sy) ((sy)->name)
#define bfd_asymbol_bfd(sy) ((sy)->the_bfd)
#define bfd_asymbol_flavour(sy) \
(((sy)->flags & BSF_SYNTHETIC) != 0 \
? bfd_target_unknown_flavour \
: bfd_asymbol_bfd (x)->xvec->flavour)
: (sy)->the_bfd->xvec->flavour)
#define bfd_set_asymbol_name(sy, n) do { (sy)->name = (n); } while (0)
/* A canonical archive symbol. */
/* This is a type pun with struct ranlib on purpose! */

View File

@ -902,7 +902,7 @@ _bfd_coff_final_link (bfd *abfd,
bfd_asymbol_name(sym), FALSE, FALSE)
== NULL))
|| (((flaginfo.info->discard == discard_sec_merge
&& (bfd_get_section (sym)->flags & SEC_MERGE)
&& (bfd_asymbol_section (sym)->flags & SEC_MERGE)
&& ! bfd_link_relocatable (flaginfo.info))
|| flaginfo.info->discard == discard_l)
&& bfd_is_local_label_name (sub, bfd_asymbol_name(sym))))

View File

@ -2736,7 +2736,7 @@ lookup_symbol_in_function_table (struct comp_unit *unit,
bfd_vma best_fit_len = 0;
struct arange *arange;
const char *name = bfd_asymbol_name (sym);
asection *sec = bfd_get_section (sym);
asection *sec = bfd_asymbol_section (sym);
for (each_func = unit->function_table;
each_func;
@ -2784,7 +2784,7 @@ lookup_symbol_in_variable_table (struct comp_unit *unit,
unsigned int *linenumber_ptr)
{
const char *name = bfd_asymbol_name (sym);
asection *sec = bfd_get_section (sym);
asection *sec = bfd_asymbol_section (sym);
struct varinfo* each;
for (each = unit->variable_table; each; each = each->prev_var)
@ -4048,7 +4048,7 @@ info_hash_lookup_funcinfo (struct info_hash_table *hash_table,
struct info_list_node *node;
struct arange *arange;
const char *name = bfd_asymbol_name (sym);
asection *sec = bfd_get_section (sym);
asection *sec = bfd_asymbol_section (sym);
for (node = lookup_info_hash_table (hash_table, name);
node;
@ -4096,7 +4096,7 @@ info_hash_lookup_varinfo (struct info_hash_table *hash_table,
unsigned int *linenumber_ptr)
{
const char *name = bfd_asymbol_name (sym);
asection *sec = bfd_get_section (sym);
asection *sec = bfd_asymbol_section (sym);
struct varinfo* each;
struct info_list_node *node;
@ -4695,7 +4695,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
if (do_line)
{
BFD_ASSERT (section == NULL && offset == 0 && functionname_ptr == NULL);
section = bfd_get_section (symbol);
section = bfd_asymbol_section (symbol);
addr = symbol->value;
}
else

View File

@ -2312,7 +2312,7 @@ ecoff_get_extr (asymbol *sym, EXTR *esym)
symbol. */
if ((esym->asym.sc == scUndefined
|| esym->asym.sc == scSUndefined)
&& ! bfd_is_und_section (bfd_get_section (sym)))
&& ! bfd_is_und_section (bfd_asymbol_section (sym)))
esym->asym.sc = scAbs;
/* Adjust the FDR index for the symbol by that used for the input
@ -2719,7 +2719,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
{ _RCONST, RELOC_SECTION_RCONST }
};
name = bfd_get_section_name (abfd, bfd_get_section (sym));
name = bfd_get_section_name (abfd, bfd_asymbol_section (sym));
for (j = 0; j < ARRAY_SIZE (section_symndx); j++)
if (streq (name, section_symndx[j].name))

View File

@ -4057,8 +4057,8 @@ sym_is_global (bfd *abfd, asymbol *sym)
return (*bed->elf_backend_sym_is_global) (abfd, sym);
return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0
|| bfd_is_und_section (bfd_get_section (sym))
|| bfd_is_com_section (bfd_get_section (sym)));
|| bfd_is_und_section (bfd_asymbol_section (sym))
|| bfd_is_com_section (bfd_asymbol_section (sym)));
}
/* Filter global symbols of ABFD to include in the import library. All

View File

@ -16076,7 +16076,7 @@ arm_elf_find_function (bfd * abfd,
BFD_ARM_SPECIAL_SYM_TYPE_ANY))
continue;
/* Fall through. */
if (bfd_get_section (&q->symbol) == section
if (bfd_asymbol_section (&q->symbol) == section
&& q->symbol.value >= low_func
&& q->symbol.value <= offset)
{

View File

@ -2281,8 +2281,8 @@ mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
return (sym->flags & BSF_SECTION_SYM) == 0;
else
return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0
|| bfd_is_und_section (bfd_get_section (sym))
|| bfd_is_com_section (bfd_get_section (sym)));
|| bfd_is_und_section (bfd_asymbol_section (sym))
|| bfd_is_com_section (bfd_asymbol_section (sym)));
}
/* Set the right machine number for a MIPS ELF file. */

View File

@ -596,8 +596,8 @@ score_elf_got15_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
bfd *output_bfd, char **error_message)
{
if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
|| bfd_is_und_section (bfd_get_section (symbol))
|| bfd_is_com_section (bfd_get_section (symbol)))
|| bfd_is_und_section (bfd_asymbol_section (symbol))
|| bfd_is_com_section (bfd_asymbol_section (symbol)))
/* The relocation is against a global symbol. */
return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd,

View File

@ -497,8 +497,8 @@ score_elf_got15_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
bfd *output_bfd, char **error_message)
{
if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
|| bfd_is_und_section (bfd_get_section (symbol))
|| bfd_is_com_section (bfd_get_section (symbol)))
|| bfd_is_und_section (bfd_asymbol_section (symbol))
|| bfd_is_com_section (bfd_asymbol_section (symbol)))
/* The relocation is against a global symbol. */
return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd,

View File

@ -1315,7 +1315,7 @@ mmix_elf_reloc (bfd *abfd,
else
relocation = symbol->value;
reloc_target_output_section = bfd_get_output_section (symbol);
reloc_target_output_section = bfd_asymbol_section (symbol)->output_section;
/* Here the variable relocation holds the final address of the symbol we
are relocating against, plus any addend. */

View File

@ -3841,8 +3841,8 @@ mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
return (sym->flags & BSF_SECTION_SYM) == 0;
else
return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0
|| bfd_is_und_section (bfd_get_section (sym))
|| bfd_is_com_section (bfd_get_section (sym)));
|| bfd_is_und_section (bfd_asymbol_section (sym))
|| bfd_is_com_section (bfd_asymbol_section (sym)));
}
/* Set the right machine number for a MIPS ELF file. */

View File

@ -8042,7 +8042,7 @@ aarch64_elf_find_function (bfd * abfd,
(q->symbol.name, BFD_AARCH64_SPECIAL_SYM_TYPE_ANY)))
continue;
/* Fall through. */
if (bfd_get_section (&q->symbol) == section
if (bfd_asymbol_section (&q->symbol) == section
&& q->symbol.value >= low_func && q->symbol.value <= offset)
{
func = (asymbol *) q;

View File

@ -2531,8 +2531,8 @@ _bfd_mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
bfd *output_bfd, char **error_message)
{
if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
|| bfd_is_und_section (bfd_get_section (symbol))
|| bfd_is_com_section (bfd_get_section (symbol)))
|| bfd_is_und_section (bfd_asymbol_section (symbol))
|| bfd_is_com_section (bfd_asymbol_section (symbol)))
/* The relocation is against a global symbol. */
return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd,

View File

@ -1163,9 +1163,9 @@ generic_link_add_symbol_list (bfd *abfd,
| BSF_GLOBAL
| BSF_CONSTRUCTOR
| BSF_WEAK)) != 0
|| bfd_is_und_section (bfd_get_section (p))
|| bfd_is_com_section (bfd_get_section (p))
|| bfd_is_ind_section (bfd_get_section (p)))
|| bfd_is_und_section (bfd_asymbol_section (p))
|| bfd_is_com_section (bfd_asymbol_section (p))
|| bfd_is_ind_section (bfd_asymbol_section (p)))
{
const char *name;
const char *string;
@ -1191,7 +1191,7 @@ generic_link_add_symbol_list (bfd *abfd,
bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name, p->flags, bfd_get_section (p),
(info, abfd, name, p->flags, bfd_asymbol_section (p),
p->value, string, FALSE, FALSE, &bh)))
return FALSE;
h = (struct generic_link_hash_entry *) bh;
@ -1218,15 +1218,15 @@ generic_link_add_symbol_list (bfd *abfd,
if (info->output_bfd->xvec == abfd->xvec)
{
if (h->sym == NULL
|| (! bfd_is_und_section (bfd_get_section (p))
&& (! bfd_is_com_section (bfd_get_section (p))
|| bfd_is_und_section (bfd_get_section (h->sym)))))
|| (! bfd_is_und_section (bfd_asymbol_section (p))
&& (! bfd_is_com_section (bfd_asymbol_section (p))
|| bfd_is_und_section (bfd_asymbol_section (h->sym)))))
{
h->sym = p;
/* BSF_OLD_COMMON is a hack to support COFF reloc
reading, and it should go away when the COFF
linker is switched to the new version. */
if (bfd_is_com_section (bfd_get_section (p)))
if (bfd_is_com_section (bfd_asymbol_section (p)))
p->flags |= BSF_OLD_COMMON;
}
}
@ -2026,9 +2026,9 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
| BSF_GLOBAL
| BSF_CONSTRUCTOR
| BSF_WEAK)) != 0
|| bfd_is_und_section (bfd_get_section (sym))
|| bfd_is_com_section (bfd_get_section (sym))
|| bfd_is_ind_section (bfd_get_section (sym)))
|| bfd_is_und_section (bfd_asymbol_section (sym))
|| bfd_is_com_section (bfd_asymbol_section (sym))
|| bfd_is_ind_section (bfd_asymbol_section (sym)))
{
if (sym->udata.p != NULL)
h = (struct generic_link_hash_entry *) sym->udata.p;
@ -2044,7 +2044,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
the relocs in the output format being used. */
h = NULL;
}
else if (bfd_is_und_section (bfd_get_section (sym)))
else if (bfd_is_und_section (bfd_asymbol_section (sym)))
h = ((struct generic_link_hash_entry *)
bfd_wrapped_link_hash_lookup (output_bfd, info,
bfd_asymbol_name (sym),
@ -2601,15 +2601,15 @@ default_indirect_link_order (bfd *output_bfd,
| BSF_GLOBAL
| BSF_CONSTRUCTOR
| BSF_WEAK)) != 0
|| bfd_is_und_section (bfd_get_section (sym))
|| bfd_is_com_section (bfd_get_section (sym))
|| bfd_is_ind_section (bfd_get_section (sym)))
|| bfd_is_und_section (bfd_asymbol_section (sym))
|| bfd_is_com_section (bfd_asymbol_section (sym))
|| bfd_is_ind_section (bfd_asymbol_section (sym)))
{
/* sym->udata may have been set by
generic_link_add_symbol_list. */
if (sym->udata.p != NULL)
h = (struct bfd_link_hash_entry *) sym->udata.p;
else if (bfd_is_und_section (bfd_get_section (sym)))
else if (bfd_is_und_section (bfd_asymbol_section (sym)))
h = bfd_wrapped_link_hash_lookup (output_bfd, info,
bfd_asymbol_name (sym),
FALSE, FALSE, TRUE);

View File

@ -1352,7 +1352,7 @@ translate_to_native_sym_flags (bfd *abfd,
to another. */
sym_pointer->e_type[0] &= ~N_TYPE;
sec = bfd_get_section (cache_ptr);
sec = bfd_asymbol_section (cache_ptr);
off = 0;
if (sec == NULL)

View File

@ -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,

View File

@ -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

View File

@ -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)

View File

@ -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*";

View File

@ -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;

View File

@ -1,3 +1,8 @@
2019-09-18 Alan Modra <amodra@gmail.com>
* symbols.c (S_IS_LOCAL): Update bfd_get_section to
bfd_asymbol_section.
2019-09-18 Simon Marchi <simon.marchi@polymtl.ca>
* Makefile.in: Re-generate.

View File

@ -2310,14 +2310,14 @@ S_IS_LOCAL (symbolS *s)
if ((flags & BSF_LOCAL) && (flags & BSF_GLOBAL))
abort ();
if (bfd_get_section (s->bsym) == reg_section)
if (bfd_asymbol_section (s->bsym) == reg_section)
return 1;
if (flag_strip_local_absolute
/* Keep BSF_FILE symbols in order to allow debuggers to identify
the source file even when the object file is stripped. */
&& (flags & (BSF_GLOBAL | BSF_FILE)) == 0
&& bfd_get_section (s->bsym) == absolute_section)
&& bfd_asymbol_section (s->bsym) == absolute_section)
return 1;
name = S_GET_NAME (s);

View File

@ -1,3 +1,8 @@
2019-09-18 Alan Modra <amodra@gmail.com>
* arm-tdep.c (arm_record_special_symbol): Update bfd_get_section
to bfd_asymbol_section.
2019-09-18 Alan Modra <amodra@gmail.com>
* amd64-dicos-tdep.c (amd64_dicos_osabi_sniffer): Constify target.

View File

@ -8575,7 +8575,7 @@ arm_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile,
data = arm_objfile_data_key.emplace (objfile,
objfile->obfd->section_count);
arm_mapping_symbol_vec &map
= data->section_maps[bfd_get_section (sym)->index];
= data->section_maps[bfd_asymbol_section (sym)->index];
new_map_sym.value = sym->value;
new_map_sym.type = name[1];

View File

@ -1,3 +1,8 @@
2019-09-18 Alan Modra <amodra@gmail.com>
* ldcref.c (check_reloc_refs): Update bfd_get_section to
bfd_asymbol_section.
2019-09-18 Simon Marchi <simon.marchi@polymtl.ca>
* Makefile.in: Re-generate.

View File

@ -705,14 +705,14 @@ check_reloc_refs (bfd *abfd, asection *sec, void *iarg)
if (q->sym_ptr_ptr != NULL
&& *q->sym_ptr_ptr != NULL
&& ((global
&& (bfd_is_und_section (bfd_get_section (*q->sym_ptr_ptr))
|| bfd_is_com_section (bfd_get_section (*q->sym_ptr_ptr))
&& (bfd_is_und_section (bfd_asymbol_section (*q->sym_ptr_ptr))
|| bfd_is_com_section (bfd_asymbol_section (*q->sym_ptr_ptr))
|| ((*q->sym_ptr_ptr)->flags & (BSF_GLOBAL
| BSF_WEAK)) != 0))
|| (!global
&& ((*q->sym_ptr_ptr)->flags & (BSF_LOCAL
| BSF_SECTION_SYM)) != 0
&& bfd_get_section (*q->sym_ptr_ptr) == info->defsec))
&& bfd_asymbol_section (*q->sym_ptr_ptr) == info->defsec))
&& (symname != NULL
? strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), symname) == 0
: ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0))