/* Mach-O support for BFD.
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2017 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
if (!bfd_mach_o_read_symtab_symbols (abfd))
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("bfd_mach_o_canonicalize_symtab: unable to load symbols"));
return 0;
}
if (bfd_seek (abfd, sym->stroff, SEEK_SET) != 0)
goto err;
- if (_bfd_stringtab_emit (abfd, strtab) != TRUE)
+ if (!_bfd_stringtab_emit (abfd, strtab))
goto err;
/* Pad string table. */
|| cmd->ntoc != 0
|| cmd->nextrefsyms != 0)
{
- (*_bfd_error_handler) (_("sorry: modtab, toc and extrefsyms are not yet"
- " implemented for dysymtab commands."));
+ _bfd_error_handler (_("sorry: modtab, toc and extrefsyms are not yet"
+ " implemented for dysymtab commands."));
return FALSE;
}
/* We need to check that this can be done... */
if (nsect > 255)
{
- (*_bfd_error_handler) (_("mach-o: there are too many sections (%u)"
- " maximum is 255,\n"), nsect);
+ _bfd_error_handler (_("mach-o: there are too many sections (%u)"
+ " maximum is 255,\n"), nsect);
return FALSE;
}
/* Nothing to do. */
break;
default:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("unable to allocate data for load command 0x%lx"),
(unsigned long) cmd->type);
break;
return FALSE;
break;
default:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("unable to write unknown load command 0x%lx"),
(unsigned long) cmd->type);
return FALSE;
if (s->addr < vma)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("section address (%lx) below start of segment (%lx)"),
(unsigned long) s->addr, (unsigned long) vma);
return FALSE;
+ BFD_MACH_O_LC_SIZE;
break;
default:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("unable to layout unknown load command 0x%lx"),
(unsigned long) cmd->type);
ret = FALSE;
/* PR 17512: file: 0017eb76. */
if (section->align > 64)
{
- (*_bfd_error_handler) (_("bfd_mach_o_read_section_32: overlarge alignment value: 0x%x, using 32 instead"),
- section->align);
+ _bfd_error_handler
+ (_("bfd_mach_o_read_section_32: overlarge alignment value: 0x%x, "
+ "using 32 instead"), section->align);
section->align = 32;
}
section->reloff = bfd_h_get_32 (abfd, raw.reloff);
section->align = bfd_h_get_32 (abfd, raw.align);
if (section->align > 64)
{
- (*_bfd_error_handler) (_("bfd_mach_o_read_section_64: overlarge alignment value: 0x%x, using 32 instead"),
- section->align);
+ _bfd_error_handler
+ (_("bfd_mach_o_read_section_64: overlarge alignment value: 0x%x, "
+ "using 32 instead"), section->align);
section->align = 32;
}
section->reloff = bfd_h_get_32 (abfd, raw.reloff);
if (bfd_seek (abfd, symoff, SEEK_SET) != 0
|| bfd_bread (&raw, symwidth, abfd) != symwidth)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %lu"),
symwidth, (unsigned long) symoff);
return FALSE;
if (stroff >= sym->strsize)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("bfd_mach_o_read_symtab_symbol: name out of range (%lu >= %lu)"),
(unsigned long) stroff,
(unsigned long) sym->strsize);
/* Mach-O uses 0 to mean "no section"; not an error. */
if (section != 0)
{
- (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbol: "
- "symbol \"%s\" specified invalid section %d (max %lu): setting to undefined"),
- s->symbol.name, section, mdata->nsects);
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("bfd_mach_o_read_symtab_symbol: "
+ "symbol \"%s\" specified invalid section %d (max %lu): "
+ "setting to undefined"),
+ s->symbol.name, section, mdata->nsects);
}
s->symbol.section = bfd_und_section_ptr;
}
s->symbol.value = 0;
break;
default:
- (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbol: "
- "symbol \"%s\" specified invalid type field 0x%x: setting to undefined"),
- s->symbol.name, symtype);
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("bfd_mach_o_read_symtab_symbol: "
+ "symbol \"%s\" specified invalid type field 0x%x: "
+ "setting to undefined"), s->symbol.name, symtype);
s->symbol.section = bfd_und_section_ptr;
break;
}
sym->symbols = bfd_alloc2 (abfd, sym->nsyms, sizeof (bfd_mach_o_asymbol));
if (sym->symbols == NULL)
{
- (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbols: unable to allocate memory for symbols"));
+ _bfd_error_handler (_("bfd_mach_o_read_symtab_symbols: "
+ "unable to allocate memory for symbols"));
sym->nsyms = 0;
return FALSE;
}
break;
default:
command->len = 0;
- (*_bfd_error_handler)(_("%B: unknown load command 0x%lx"),
- abfd, (unsigned long) command->type);
+ _bfd_error_handler (_("%B: unknown load command 0x%lx"),
+ abfd, (unsigned long) command->type);
return FALSE;
}
&cputype, &cpusubtype);
if (cputype == bfd_arch_unknown)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("bfd_mach_o_scan: unknown architecture 0x%lx/0x%lx"),
header->cputype, header->cpusubtype);
return FALSE;
if (! (header.byteorder == BFD_ENDIAN_BIG
|| header.byteorder == BFD_ENDIAN_LITTLE))
{
- (*_bfd_error_handler) (_("unknown header byte-order value 0x%lx"),
- (unsigned long) header.byteorder);
+ _bfd_error_handler (_("unknown header byte-order value 0x%lx"),
+ (unsigned long) header.byteorder);
goto wrong;
}
static bfd_mach_o_uuid_command *
bfd_mach_o_lookup_uuid_command (bfd *abfd)
{
- bfd_mach_o_load_command *uuid_cmd;
+ bfd_mach_o_load_command *uuid_cmd = NULL;
int ncmd = bfd_mach_o_lookup_command (abfd, BFD_MACH_O_LC_UUID, &uuid_cmd);
- if (ncmd != 1)
+ if (ncmd != 1 || uuid_cmd == NULL)
return FALSE;
return &uuid_cmd->command.uuid;
}
if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_mach_o_flavour)
return NULL;
- if (abfd->my_archive)
+ if (abfd->my_archive && !bfd_is_thin_archive (abfd->my_archive))
base_bfd = abfd->my_archive;
/* BFD may have been opened from a stream. */
if (base_bfd->filename == NULL)