Fix GCC9 warning on elf32-arm.c:elf32_arm_final_link_relocate
authorSergio Durigan Junior <sergiodj@redhat.com>
Mon, 21 Jan 2019 20:36:41 +0000 (15:36 -0500)
committerSergio Durigan Junior <sergiodj@redhat.com>
Mon, 28 Jan 2019 15:50:23 +0000 (10:50 -0500)
Fedora Rawhide has just switched to GCC9, and now GDB doesn't compile
because of a BFD warning:

  BUILDSTDERR: ../../bfd/elf32-arm.c: In function 'elf32_arm_final_link_relocate':
  BUILDSTDERR: ../../bfd/elf32-arm.c:10907:10: error: absolute value function 'labs' given an argument of type 'bfd_signed_vma' {aka 'long long int'} but has parameter of type 'long int' which may cause truncation of value [-Werror=absolute-value]
  BUILDSTDERR: 10907 |  value = labs (relocation);
  BUILDSTDERR:       |          ^~~~

You can take a look at the full build log here:

  https://kojipkgs.fedoraproject.org//work/tasks/4828/32174828/build.log

The fix is (apparently) simple: instead of using 'labs', we should use
'llabs', since we're passing a 'bfd_signed_vma' to it, which is at
least a 'long long int', as far as I have checked.  This is what this
patch does.

bfd/ChangeLog:
2019-01-25  Sergio Durigan Junior  <sergiodj@redhat.com>

* elf32-arm.c (elf32_arm_final_link_relocate): Use 'llabs' instead
of 'labs' (and fix GCC warning).

bfd/ChangeLog
bfd/elf32-arm.c

index 69fa844cf7160366a9d23f69879e658ed00e9ed3..5547cd26b9bb10e414b21c690066dad130646e04 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-21  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       * elf32-arm.c (elf32_arm_final_link_relocate): Use 'llabs' instead
+       of 'labs' (and fix GCC warning).
+
 2019-01-25  Nick Clifton  <nickc@redhat.com>
 
        * po/ru.po: Updated Russian translation.
index 53baea269bd32be09e5135a310d135e04ce619fb..28ee9d55a85cf8f998f1720d0f7d00304bae940b 100644 (file)
@@ -10904,7 +10904,7 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
 
        /* PR 21523: Use an absolute value.  The user of this reloc will
           have already selected an ADD or SUB insn appropriately.  */
-       value = labs (relocation);
+       value = llabs (relocation);
 
        if (value >= 0x1000)
          return bfd_reloc_overflow;
This page took 0.038476 seconds and 4 git commands to generate.