for (i = 0; i < count; i++)
{
if (!(*bed->_bfd_mach_o_canonicalize_one_reloc)(abfd, &native_relocs[i],
- &res[i], syms))
+ &res[i], syms, res))
goto err;
}
free (native_relocs);
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. */
break;
default:
_bfd_error_handler
- (_("unable to allocate data for load command 0x%lx"),
- (unsigned long) cmd->type);
+ (_("unable to allocate data for load command %#x"),
+ cmd->type);
break;
}
break;
default:
_bfd_error_handler
- (_("unable to write unknown load command 0x%lx"),
- (unsigned long) cmd->type);
+ (_("unable to write unknown load command %#x"),
+ cmd->type);
return FALSE;
}
}
{
_bfd_error_handler
/* xgettext:c-format */
- (_("section address (%lx) below start of segment (%lx)"),
- (unsigned long) s->addr, (unsigned long) vma);
+ (_("section address (%#Lx) below start of segment (%#Lx)"),
+ s->addr, vma);
return FALSE;
}
break;
default:
_bfd_error_handler
- (_("unable to layout unknown load command 0x%lx"),
- (unsigned long) cmd->type);
+ (_("unable to layout unknown load command %#x"),
+ cmd->type);
ret = FALSE;
break;
}
if (section->align > 64)
{
_bfd_error_handler
- (_("bfd_mach_o_read_section_32: overlarge alignment value: 0x%x, "
+ (_("bfd_mach_o_read_section_32: overlarge alignment value: %#lx, "
"using 32 instead"), section->align);
section->align = 32;
}
if (section->align > 64)
{
_bfd_error_handler
- (_("bfd_mach_o_read_section_64: overlarge alignment value: 0x%x, "
+ (_("bfd_mach_o_read_section_64: overlarge alignment value: %#lx, "
"using 32 instead"), section->align);
section->align = 32;
}
{
_bfd_error_handler
/* xgettext:c-format */
- (_("bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %lu"),
- symwidth, (unsigned long) symoff);
+ (_("bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %u"),
+ symwidth, symoff);
return FALSE;
}
{
_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);
+ (_("bfd_mach_o_read_symtab_symbol: name out of range (%lu >= %u)"),
+ stroff,
+ sym->strsize);
return FALSE;
}
}
else
{
+ /* See PR 21840 for a reproducer. */
+ if ((sym->strsize + 1) == 0)
+ return FALSE;
sym->strtab = bfd_alloc (abfd, sym->strsize + 1);
if (sym->strtab == NULL)
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 %#x"),
+ abfd, command->type);
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 %#x"),
+ header.byteorder);
goto wrong;
}