Use int and bfd_signed_vma in x32 addend overflow check
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 11 May 2012 00:50:43 +0000 (00:50 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 11 May 2012 00:50:43 +0000 (00:50 +0000)
bfd/

* elf64-x86-64.c (elf_x86_64_relocate_section): Use int in x32
addend overflow check.

gas/

* config/tc-i386.c (tc_gen_reloc): Use bfd_signed_vma in x32
addend overflow check.

bfd/ChangeLog
bfd/elf64-x86-64.c
gas/ChangeLog
gas/config/tc-i386.c

index 806db7f1e73da2a8eff3e5bf256697df8e046819..e776f41dda6ba3123ec9d20b2d023a0f871b3db0 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): Use int in x32
+       addend overflow check.
+
 2012-05-10  DJ Delorie  <dj@redhat.com>
 
        * elf32-rx.c (rx_elf_object_p): Ignore empty segments.
index e98c32512ad019a30ee677b1b380b06747681ea9..1111d772389a1990da7c0b31dbdb263211853ace 100644 (file)
@@ -3686,7 +3686,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                          != (rel->r_addend & 0x80000000))
                        {
                          const char *name;
-                         long addend = rel->r_addend;
+                         int addend = rel->r_addend;
                          if (h && h->root.root.string)
                            name = h->root.root.string;
                          else
@@ -3694,7 +3694,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                                                     sym, NULL);
                          if (addend < 0)
                            (*_bfd_error_handler)
-                             (_("%B: addend -0x%lx in relocation %s against "
+                             (_("%B: addend -0x%x in relocation %s against "
                                 "symbol `%s' at 0x%lx in section `%A' is "
                                 "out of range"),
                               input_bfd, input_section, addend,
@@ -3702,7 +3702,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                               name, (unsigned long) rel->r_offset);
                          else
                            (*_bfd_error_handler)
-                             (_("%B: addend 0x%lx in relocation %s against "
+                             (_("%B: addend 0x%x in relocation %s against "
                                 "symbol `%s' at 0x%lx in section `%A' is "
                                 "out of range"),
                               input_bfd, input_section, addend,
index dfe45d29466d1c9d2602e3a888d7e6d44114de44..c9048e3c56866052fe01f273e8b8bcf91b2c5d43 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * config/tc-i386.c (tc_gen_reloc): Use bfd_signed_vma in x32
+       addend overflow check.
+
 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/tc-i386.c (tc_gen_reloc): Display signed hex number in
index e3440f097cf6dd3ba2b9fb697a5213355c445085..e33fb6ca33e3f45e31f665f62ebec93a6f3170ec 100644 (file)
@@ -9177,16 +9177,18 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
            /* Check addend overflow.  */
            if (!fits_in_signed_long (fixp->fx_offset))
              {
-               long long addend = fixp->fx_offset;
+               bfd_signed_vma 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"),
+                                 "addend -0x%" BFD_VMA_FMT "x 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"),
+                                 "addend 0x%" BFD_VMA_FMT "x in x32 "
+                                 "mode"),
                                bfd_get_reloc_code_name (code), addend);
              }
            break;