]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/coff-arm.c
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / bfd / coff-arm.c
index ca107b117fb37ff4d12a13b2132326af00542db8..84477eaa8fee51c159caab5dfa7ea154e83f5a4e 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for ARM COFF files.
-   Copyright (C) 1990-2018 Free Software Foundation, Inc.
+   Copyright (C) 1990-2020 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -24,6 +24,8 @@
 #include "libbfd.h"
 #include "coff/arm.h"
 #include "coff/internal.h"
+#include "cpu-arm.h"
+#include "coff-arm.h"
 
 #ifdef COFF_WITH_PE
 #include "coff/pe.h"
@@ -31,6 +33,9 @@
 
 #include "libcoff.h"
 
+/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1.  */
+#define OCTETS_PER_BYTE(ABFD, SEC) 1
+
 /* Macros for manipulation the bits in the flags field of the coff data
    structure.  */
 #define APCS_26_FLAG(abfd) \
@@ -94,7 +99,7 @@ coff_arm_reloc (bfd *abfd,
                arelent *reloc_entry,
                asymbol *symbol ATTRIBUTE_UNUSED,
                void * data,
-               asection *input_section ATTRIBUTE_UNUSED,
+               asection *input_section,
                bfd *output_bfd,
                char **error_message ATTRIBUTE_UNUSED)
 {
@@ -112,11 +117,11 @@ coff_arm_reloc (bfd *abfd,
   if (diff != 0)
     {
       reloc_howto_type *howto = reloc_entry->howto;
-      unsigned char *addr = (unsigned char *) data + reloc_entry->address;
+      bfd_size_type octets = (reloc_entry->address
+                             * OCTETS_PER_BYTE (abfd, input_section));
+      unsigned char *addr = (unsigned char *) data + octets;
 
-      if (! bfd_reloc_offset_in_range (howto, abfd, input_section,
-                                      reloc_entry->address
-                                      * bfd_octets_per_byte (abfd)))
+      if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
        return bfd_reloc_outofrange;
 
       switch (howto->size)
@@ -814,7 +819,7 @@ coff_thumb_pcrel_12 (bfd *abfd,
                                  b12);
 }
 
-static const struct reloc_howto_struct *
+static reloc_howto_type *
 coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code)
 {
 #define ASTD(i,j)       case i: return aoutarm_std_reloc_howto + j
@@ -1274,9 +1279,8 @@ coff_arm_relocate_section (bfd *output_bfd,
            continue;
          /* FIXME - it is not clear which targets need this next test
             and which do not.  It is known that it is needed for the
-            VxWorks and EPOC-PE targets, but it is also known that it
-            was suppressed for other ARM targets.  This ought to be
-            sorted out one day.  */
+            VxWorks targets but it is also known that it was suppressed
+            for other ARM targets.  This ought to be sorted out one day.  */
 #ifdef ARM_COFF_BUGFIX
          /* We must not ignore the symbol value.  If the symbol is
             within the same section, the relocation should have already
@@ -1990,7 +1994,7 @@ bfd_arm_get_bfd_for_interworking (bfd *                    abfd,
       sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME,
                                         flags);
       if (sec == NULL
-         || ! bfd_set_section_alignment (abfd, sec, 2))
+         || !bfd_set_section_alignment (sec, 2))
        return FALSE;
     }
 
@@ -2004,7 +2008,7 @@ bfd_arm_get_bfd_for_interworking (bfd *                    abfd,
                                         flags);
 
       if (sec == NULL
-         || ! bfd_set_section_alignment (abfd, sec, 2))
+         || !bfd_set_section_alignment (sec, 2))
        return FALSE;
     }