aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-05-10 20:46:34 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-05-10 20:46:34 +0000
commit6f2c9068edbe878242f511eb13f03f1a6945f96c (patch)
tree869d00e1dab70bb53720caacba9a8d1b69b3bb70
parent95554aad6c78f459750b8edda9e1832063083132 (diff)
downloadgdb-6f2c9068edbe878242f511eb13f03f1a6945f96c.zip
gdb-6f2c9068edbe878242f511eb13f03f1a6945f96c.tar.gz
gdb-6f2c9068edbe878242f511eb13f03f1a6945f96c.tar.bz2
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.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-x86-64.c25
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-i386.c15
-rw-r--r--ld/testsuite/ChangeLog4
-rw-r--r--ld/testsuite/ld-x86-64/ilp32-11.d2
6 files changed, 43 insertions, 13 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fa2f5fa..a46ed85 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
+ * elf64-x86-64.c (elf_x86_64_relocate_section): Display signed
+ hex number in x32 addend overflow check.
+
+2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
+
* elf64-x86-64.c (elf_x86_64_reloc_type_class): Handle
R_X86_64_RELATIVE64.
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index a9429b8..e98c325 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;
}
diff --git a/gas/ChangeLog b/gas/ChangeLog
index f9a6e26..dfe45d2 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/tc-i386.c (tc_gen_reloc): Display signed hex number in
+ x32 addend overflow check.
+
2012-05-09 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (tc_gen_reloc): Use fits_in_signed_long.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index ab5233d..e3440f0 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -9177,10 +9177,17 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
/* Check addend overflow. */
if (!fits_in_signed_long (fixp->fx_offset))
{
- as_bad_where (fixp->fx_file, fixp->fx_line,
- _("cannot represent relocation %s with addend %lld in x32 mode"),
- bfd_get_reloc_code_name (code),
- (long long) fixp->fx_offset);
+ long long addend = fixp->fx_offset;
+ if (addend < 0)
+ as_bad_where (fixp->fx_file, fixp->fx_line,
+ _("cannot represent relocation %s with "
+ "addend -0x%llx in x32 mode"),
+ bfd_get_reloc_code_name (code), -addend);
+ else
+ as_bad_where (fixp->fx_file, fixp->fx_line,
+ _("cannot represent relocation %s with "
+ "addend 0x%llx in x32 mode"),
+ bfd_get_reloc_code_name (code), addend);
}
break;
case BFD_RELOC_X86_64_DTPOFF64:
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 1cd1b4e..09cb6b9 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
+ * ld-x86-64/ilp32-11.d: Updated.
+
+2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
+
* ld-x86-64/pr13082-1a.d: Check RELACOUNT.
* ld-x86-64/pr13082-1b.d: Likewise.
diff --git a/ld/testsuite/ld-x86-64/ilp32-11.d b/ld/testsuite/ld-x86-64/ilp32-11.d
index 7240c58..56bb8b3 100644
--- a/ld/testsuite/ld-x86-64/ilp32-11.d
+++ b/ld/testsuite/ld-x86-64/ilp32-11.d
@@ -1,3 +1,3 @@
#as: --x32
#ld: -shared -melf32_x86_64
-#error: .*addend 2147483647 in relocation R_X86_64_64 against symbol `.text' at 0x0 in section `.data.rel.local' is out of range
+#error: .*addend 0x7fffffff in relocation R_X86_64_64 against symbol `.text' at 0x0 in section `.data.rel.local' is out of range