From 227b1b0012e1e6b406667e15583353bcc4c42094 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 10 May 2012 20:46:31 +0000 Subject: Display signed hex number in x32 addend overflow check bfd/ * elf64-x86-64.c (elf_x86_64_relocate_section): Display signed hex number in x32 addend overflow check. gas/ * config/tc-i386.c (tc_gen_reloc): Display signed hex number in x32 addend overflow check. ld/testsuite/ * ld-x86-64/ilp32-11.d: Updated. --- bfd/elf64-x86-64.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'bfd/elf64-x86-64.c') diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index a9429b8c6c..e98c32512a 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3686,19 +3686,28 @@ elf_x86_64_relocate_section (bfd *output_bfd, != (rel->r_addend & 0x80000000)) { const char *name; + long addend = rel->r_addend; if (h && h->root.root.string) name = h->root.root.string; else name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, NULL); - (*_bfd_error_handler) - (_("%B: addend %ld in relocation %s against " - "symbol `%s' at 0x%lx in section `%A' is " - "out of range"), - input_bfd, input_section, - (long) rel->r_addend, - x86_64_elf_howto_table[r_type].name, - name, (unsigned long) rel->r_offset); + if (addend < 0) + (*_bfd_error_handler) + (_("%B: addend -0x%lx in relocation %s against " + "symbol `%s' at 0x%lx in section `%A' is " + "out of range"), + input_bfd, input_section, addend, + x86_64_elf_howto_table[r_type].name, + name, (unsigned long) rel->r_offset); + else + (*_bfd_error_handler) + (_("%B: addend 0x%lx in relocation %s against " + "symbol `%s' at 0x%lx in section `%A' is " + "out of range"), + input_bfd, input_section, addend, + x86_64_elf_howto_table[r_type].name, + name, (unsigned long) rel->r_offset); bfd_set_error (bfd_error_bad_value); return FALSE; } -- cgit v1.2.1