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

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