aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-09-30 13:00:18 +0930
committerAlan Modra <amodra@gmail.com>2016-09-30 15:17:44 +0930
commit4eca02287cf48e60ee89338ddd35f8d0d8257a51 (patch)
tree8ca78e581fa1260b8a1073e7e1a92d46e8bfabf6 /bfd/elf.c
parent4519d071387f374932616b588ddb4ec8cabe2a52 (diff)
downloadgdb-4eca02287cf48e60ee89338ddd35f8d0d8257a51.zip
gdb-4eca02287cf48e60ee89338ddd35f8d0d8257a51.tar.gz
gdb-4eca02287cf48e60ee89338ddd35f8d0d8257a51.tar.bz2
Remove syntactic sugar
Now that _bfd_error_handler is not a function pointer. * aout-adobe.c: Replace (*_bfd_error_handler) (...) with _bfd_error_handler (...) throughout. * aout-cris.c, * aoutx.h, * archive.c, * bfd.c, * binary.c, * cache.c, * coff-alpha.c, * coff-arm.c, * coff-h8300.c, * coff-i860.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * cpu-arm.c, * cpu-m68k.c, * cpu-sh.c, * dwarf2.c, * ecoff.c, * elf-eh-frame.c, * elf-m10300.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cris.c, * elf32-crx.c, * elf32-dlx.c, * elf32-frv.c, * elf32-hppa.c, * elf32-i370.c, * elf32-i386.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-x86-64.c, * elfcode.h, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * hpux-core.c, * i386linux.c, * ieee.c, * ihex.c, * libbfd.c, * linker.c, * m68klinux.c, * mach-o.c, * merge.c, * mmo.c, * oasys.c, * osf-core.c, * pdp11.c, * pe-mips.c, * peXXigen.c, * pef.c, * plugin.c, * reloc.c, * rs6000-core.c, * sco5-core.c, * som.c, * sparclinux.c, * srec.c, * stabs.c, * syms.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * xcofflink.c: Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c85
1 files changed, 43 insertions, 42 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 7d0b8a9..c096191 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -350,7 +350,7 @@ bfd_elf_string_from_elf_section (bfd *abfd,
if (strindex >= hdr->sh_size)
{
unsigned int shstrndx = elf_elfheader(abfd)->e_shstrndx;
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: invalid string offset %u >= %lu for section `%s'"),
abfd, strindex, (unsigned long) hdr->sh_size,
(shindex == shstrndx && strindex == hdr->sh_name
@@ -489,9 +489,9 @@ bfd_elf_get_elf_syms (bfd *ibfd,
if (!(*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym))
{
symoffset += (esym - (bfd_byte *) extsym_buf) / extsym_size;
- (*_bfd_error_handler) (_("%B symbol number %lu references "
- "nonexistent SHT_SYMTAB_SHNDX section"),
- ibfd, (unsigned long) symoffset);
+ _bfd_error_handler (_("%B symbol number %lu references "
+ "nonexistent SHT_SYMTAB_SHNDX section"),
+ ibfd, (unsigned long) symoffset);
if (alloc_intsym != NULL)
free (alloc_intsym);
intsym_buf = NULL;
@@ -691,8 +691,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
}
if (idx >= shnum)
{
- ((*_bfd_error_handler)
- (_("%B: invalid SHT_GROUP entry"), abfd));
+ _bfd_error_handler
+ (_("%B: invalid SHT_GROUP entry"), abfd);
idx = 0;
}
dest->shdr = elf_elfsections (abfd)[idx];
@@ -710,7 +710,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
{
elf_tdata (abfd)->group_sect_ptr = NULL;
elf_tdata (abfd)->num_group = num_group = -1;
- (*_bfd_error_handler) (_("%B: no valid group sections found"), abfd);
+ _bfd_error_handler
+ (_("%B: no valid group sections found"), abfd);
bfd_set_error (bfd_error_bad_value);
}
}
@@ -777,8 +778,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
if (elf_group_name (newsect) == NULL)
{
- (*_bfd_error_handler) (_("%B: no group info for section %A"),
- abfd, newsect);
+ _bfd_error_handler (_("%B: no group info for section %A"),
+ abfd, newsect);
return FALSE;
}
return TRUE;
@@ -825,7 +826,7 @@ _bfd_elf_setup_sections (bfd *abfd)
sh_link. We don't want to proceed. */
if (linksec == NULL)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: sh_link [%d] in section `%A' is incorrect"),
s->owner, s, elfsec);
result = FALSE;
@@ -837,7 +838,7 @@ _bfd_elf_setup_sections (bfd *abfd)
else if (this_hdr->sh_type == SHT_GROUP
&& elf_next_in_group (s) == NULL)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: SHT_GROUP section [index %d] has no SHF_GROUP sections"),
abfd, elf_section_data (s)->this_idx);
result = FALSE;
@@ -857,7 +858,7 @@ _bfd_elf_setup_sections (bfd *abfd)
/* PR binutils/18758: Beware of corrupt binaries with invalid group data. */
if (shdr == NULL || shdr->bfd_section == NULL || shdr->contents == NULL)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: section group entry number %u is corrupt"),
abfd, i);
result = FALSE;
@@ -881,7 +882,7 @@ _bfd_elf_setup_sections (bfd *abfd)
else
{
/* There are some unknown sections in the group. */
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: unknown [%d] section `%s' in group [%s]"),
abfd,
(unsigned int) idx->shdr->sh_type,
@@ -1147,7 +1148,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
{
if (!bfd_init_section_compress_status (abfd, newsect))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: unable to initialize compress status for section %s"),
abfd, name);
return FALSE;
@@ -1157,7 +1158,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
{
if (!bfd_init_section_decompress_status (abfd, newsect))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: unable to initialize decompress status for section %s"),
abfd, name);
return FALSE;
@@ -1944,7 +1945,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
}
if (sections_being_created [shindex])
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: warning: loop in section dependencies detected"), abfd);
return FALSE;
}
@@ -2051,7 +2052,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
Unusual, but possible. Warn, but continue. */
if (elf_onesymtab (abfd) != 0)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: warning: multiple symbol tables detected - ignoring the table in section %u"),
abfd, shindex);
goto success;
@@ -2133,7 +2134,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
Unusual, but possible. Warn, but continue. */
if (elf_dynsymtab (abfd) != 0)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: warning: multiple dynamic symbol tables detected - ignoring the table in section %u"),
abfd, shindex);
goto success;
@@ -2244,9 +2245,9 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
/* Check for a bogus link to avoid crashing. */
if (hdr->sh_link >= num_sec)
{
- ((*_bfd_error_handler)
- (_("%B: invalid link %lu for reloc section %s (index %u)"),
- abfd, hdr->sh_link, name, shindex));
+ _bfd_error_handler
+ (_("%B: invalid link %lu for reloc section %s (index %u)"),
+ abfd, hdr->sh_link, name, shindex);
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name,
shindex);
goto success;
@@ -2429,7 +2430,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
if ((hdr->sh_flags & SHF_ALLOC) != 0)
/* FIXME: How to properly handle allocated section reserved
for applications? */
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: don't know how to handle allocated, application "
"specific section `%s' [0x%8x]"),
abfd, name, hdr->sh_type);
@@ -2444,7 +2445,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
else if (hdr->sh_type >= SHT_LOPROC
&& hdr->sh_type <= SHT_HIPROC)
/* FIXME: We should handle this section. */
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: don't know how to handle processor specific section "
"`%s' [0x%8x]"),
abfd, name, hdr->sh_type);
@@ -2455,7 +2456,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
/* SHF_OS_NONCONFORMING indicates that special knowledge is
required to correctly process the section and the file should
be rejected with an error message. */
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: don't know how to handle OS specific section "
"`%s' [0x%8x]"),
abfd, name, hdr->sh_type);
@@ -2468,7 +2469,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
}
else
/* FIXME: We should handle this section. */
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: don't know how to handle section `%s' [0x%8x]"),
abfd, name, hdr->sh_type);
@@ -3171,7 +3172,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *fsarg)
/* PR 17512: file: 0eb809fe, 8b0535ee. */
if (asect->alignment_power >= (sizeof (bfd_vma) * 8) - 1)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: error: Alignment power %d of section `%A' is too big"),
abfd, asect, asect->alignment_power);
arg->failed = TRUE;
@@ -3201,7 +3202,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *fsarg)
allow the link to proceed. This can happen when users link
non-bss input sections to bss output sections, or emit data
to a bss output section via a linker script. */
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("warning: section `%A' type changed to PROGBITS"), asect);
this_hdr->sh_type = sh_type;
}
@@ -3726,7 +3727,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
if (discarded_section (s))
{
asection *kept;
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: sh_link of section `%A' points to discarded section `%A' of `%B'"),
abfd, d->this_hdr.bfd_section,
s, s->owner);
@@ -3749,7 +3750,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
/* Handle objcopy. */
if (s->output_section == NULL)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: sh_link of section `%A' points to removed section `%A' of `%B'"),
abfd, d->this_hdr.bfd_section, s, s->owner);
bfd_set_error (bfd_error_bad_value);
@@ -5291,7 +5292,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
|| (!m->p_paddr_valid
&& p->p_paddr < (bfd_vma) off))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: Not enough room for program headers, try linking with -N"),
abfd);
bfd_set_error (bfd_error_bad_value);
@@ -5377,7 +5378,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
&& (s_start < p_end
|| p_end < p_start))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: section %A lma %#lx adjusted to %#lx"), abfd, sec,
(unsigned long) s_start, (unsigned long) p_end);
adjust = 0;
@@ -5513,7 +5514,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
if (!ELF_SECTION_IN_SEGMENT_1 (this_hdr, p, check_vma, 0)
&& !ELF_TBSS_SPECIAL (this_hdr, p))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: section `%A' can't be allocated in segment %d"),
abfd, sec, j);
print_segment_map (m);
@@ -5560,7 +5561,7 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
else if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
if (hdr->sh_size != 0)
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: warning: allocated section `%s' not in segment"),
abfd,
(hdr->bfd_section == NULL
@@ -5749,7 +5750,7 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
if (m->includes_filehdr || m->includes_phdrs)
{
/* PR 17512: file: 2195325e. */
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: warning: non-load segment includes file header and/or program header"),
abfd);
return FALSE;
@@ -6235,7 +6236,7 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr)
{
/* This case can occur when using --strip-symbol on a symbol
which is used in a relocation entry. */
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: symbol `%s' required but not present"),
abfd, bfd_asymbol_name (asym_ptr));
bfd_set_error (bfd_error_no_symbols);
@@ -6574,9 +6575,9 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
something. They are allowed by the ELF spec however, so only
a warning is produced. */
if (segment->p_type == PT_LOAD)
- (*_bfd_error_handler) (_("\
+ _bfd_error_handler (_("\
%B: warning: Empty loadable segment detected, is this intentional ?"),
- ibfd);
+ ibfd);
map->count = 0;
*pointer_to_map = map;
@@ -7187,9 +7188,9 @@ rewrite:
{
/* PR 17512: file: f17299af. */
if (segment->p_align > (bfd_vma) 1 << ((sizeof (bfd_vma) * 8) - 2))
- (*_bfd_error_handler) (_("\
+ _bfd_error_handler (_("\
%B: warning: segment alignment of 0x%llx is too large"),
- ibfd, (long long) segment->p_align);
+ ibfd, (long long) segment->p_align);
else
maxpagesize = segment->p_align;
}
@@ -7994,7 +7995,7 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bfd_boolean default_imported_symver)
if (hdr->sh_info == 0 || hdr->sh_size < sizeof (Elf_External_Verneed))
{
error_return_bad_verref:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: .gnu.version_r invalid entry"), abfd);
bfd_set_error (bfd_error_bad_value);
error_return_verref:
@@ -8121,7 +8122,7 @@ error_return_verref:
if (hdr->sh_info == 0 || hdr->sh_size < sizeof (Elf_External_Verdef))
{
error_return_bad_verdef:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: .gnu.version_d invalid entry"), abfd);
bfd_set_error (bfd_error_bad_value);
error_return_verdef:
@@ -8672,7 +8673,7 @@ _bfd_elf_validate_reloc (bfd *abfd, arelent *areloc)
return TRUE;
fail:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: unsupported relocation type %s"),
abfd, areloc->howto->name);
bfd_set_error (bfd_error_bad_value);