]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Display signed hex number in x32 addend overflow check
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 10 May 2012 20:46:34 +0000 (20:46 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 10 May 2012 20:46:34 +0000 (20:46 +0000)
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/ChangeLog
bfd/elf64-x86-64.c
gas/ChangeLog
gas/config/tc-i386.c
ld/testsuite/ChangeLog
ld/testsuite/ld-x86-64/ilp32-11.d

index fa2f5fa8327a0be27a34990697f3777163f5a86c..a46ed85e1606043ee09931b6f4b22f26e2343f23 100644 (file)
@@ -1,3 +1,8 @@
+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
index a9429b8c6cbb6cf1932510052256ba8d7f859a52..e98c32512ad019a30ee677b1b380b06747681ea9 100644 (file)
@@ -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;
                        }
index f9a6e269fea87e81a6fcfc958cd09638cbe6e0c2..dfe45d29466d1c9d2602e3a888d7e6d44114de44 100644 (file)
@@ -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.
index ab5233df4ad10da0c3d23d75a13e1d3334eb7387..e3440f097cf6dd3ba2b9fb697a5213355c445085 100644 (file)
@@ -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:
index 1cd1b4ebbe42f6a9c45e428e94bdf7cf0e76ba6d..09cb6b92a362c146caeac12de39aba8fdf0f3387 100644 (file)
@@ -1,3 +1,7 @@
+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.
index 7240c5805e48cfee1977684096c72c537db934cf..56bb8b3bcfe3a4115a535cf0dc704f01fe41b1ef 100644 (file)
@@ -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