mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-03 04:12:10 +08:00
* elf32-xtensa.c (vsprint_msg): Add prototype.
(build_encoding_error_message): Delete. Code moved into.... (elf_xtensa_do_reloc): ....here, and changed to give better error messages for out of range literals.
This commit is contained in:
parent
0a665bfd86
commit
2db662bee4
@ -1,3 +1,10 @@
|
||||
2005-07-15 Bob Wilson <bob.wilson@acm.org>
|
||||
|
||||
* elf32-xtensa.c (vsprint_msg): Add prototype.
|
||||
(build_encoding_error_message): Delete. Code moved into....
|
||||
(elf_xtensa_do_reloc): ....here, and changed to give better
|
||||
error messages for out of range literals.
|
||||
|
||||
2005-07-15 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* elflink.c (bfd_elf_record_link_assignment): Remove output_bfd param.
|
||||
|
@ -36,7 +36,7 @@
|
||||
/* Local helper functions. */
|
||||
|
||||
static bfd_boolean add_extra_plt_sections (bfd *, int);
|
||||
static char *build_encoding_error_message (xtensa_opcode, bfd_vma);
|
||||
static char *vsprint_msg (const char *, const char *, int, ...) ATTRIBUTE_PRINTF(2,4);
|
||||
static bfd_reloc_status_type bfd_elf_xtensa_reloc
|
||||
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
||||
static bfd_boolean do_fix_for_relocatable_link
|
||||
@ -1742,7 +1742,30 @@ elf_xtensa_do_reloc (reloc_howto_type *howto,
|
||||
|| xtensa_operand_set_field (isa, opcode, opnd, fmt, slot,
|
||||
sbuff, newval))
|
||||
{
|
||||
*error_message = build_encoding_error_message (opcode, relocation);
|
||||
const char *opname = xtensa_opcode_name (isa, opcode);
|
||||
const char *msg;
|
||||
|
||||
msg = "cannot encode";
|
||||
if (is_direct_call_opcode (opcode))
|
||||
{
|
||||
if ((relocation & 0x3) != 0)
|
||||
msg = "misaligned call target";
|
||||
else
|
||||
msg = "call target out of range";
|
||||
}
|
||||
else if (opcode == get_l32r_opcode ())
|
||||
{
|
||||
if ((relocation & 0x3) != 0)
|
||||
msg = "misaligned literal target";
|
||||
else if (is_alt_relocation (howto->type))
|
||||
msg = "literal target out of range (too many literals)";
|
||||
else if (self_address > relocation)
|
||||
msg = "literal target out of range (try using text-section-literals)";
|
||||
else
|
||||
msg = "literal placed after use";
|
||||
}
|
||||
|
||||
*error_message = vsprint_msg (opname, ": %s", strlen (msg) + 2, msg);
|
||||
return bfd_reloc_dangerous;
|
||||
}
|
||||
|
||||
@ -1767,7 +1790,7 @@ elf_xtensa_do_reloc (reloc_howto_type *howto,
|
||||
}
|
||||
|
||||
|
||||
static char * ATTRIBUTE_PRINTF(2,4)
|
||||
static char *
|
||||
vsprint_msg (const char *origmsg, const char *fmt, int arglen, ...)
|
||||
{
|
||||
/* To reduce the size of the memory leak,
|
||||
@ -1797,32 +1820,6 @@ vsprint_msg (const char *origmsg, const char *fmt, int arglen, ...)
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
build_encoding_error_message (xtensa_opcode opcode, bfd_vma target_address)
|
||||
{
|
||||
const char *opname = xtensa_opcode_name (xtensa_default_isa, opcode);
|
||||
const char *msg;
|
||||
|
||||
msg = "cannot encode";
|
||||
if (is_direct_call_opcode (opcode))
|
||||
{
|
||||
if ((target_address & 0x3) != 0)
|
||||
msg = "misaligned call target";
|
||||
else
|
||||
msg = "call target out of range";
|
||||
}
|
||||
else if (opcode == get_l32r_opcode ())
|
||||
{
|
||||
if ((target_address & 0x3) != 0)
|
||||
msg = "misaligned literal target";
|
||||
else
|
||||
msg = "literal target out of range";
|
||||
}
|
||||
|
||||
return vsprint_msg (opname, ": %s", strlen (msg) + 2, msg);
|
||||
}
|
||||
|
||||
|
||||
/* This function is registered as the "special_function" in the
|
||||
Xtensa howto for handling simplify operations.
|
||||
bfd_perform_relocation / bfd_install_relocation use it to
|
||||
|
Loading…
Reference in New Issue
Block a user