Fix -Wmisleading-indentation warning in top.c
[deliverable/binutils-gdb.git] / bfd / coff-x86_64.c
index f0108ea5c27677d01325a7fc9b532e7c4908f554..4edbd236091d67129434a45bf725139c009e5651 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for AMD 64 COFF files.
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -52,6 +52,9 @@
 
 #define COFF_PAGE_SIZE 0x1000
 
+/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1.  */
+#define OCTETS_PER_BYTE(ABFD, SEC) 1
+
 /* For some reason when using AMD COFF the value stored in the .text
    section for a reference to a common symbol is the value itself plus
    any desired offset.  Ian Taylor, Cygnus Support.  */
@@ -141,11 +144,11 @@ coff_amd64_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)
@@ -792,19 +795,19 @@ const bfd_target
     _bfd_dummy_target,
     amd64coff_object_p,
     bfd_generic_archive_p,
-    amd64coff_object_p 
+    amd64coff_object_p
   },
   {                            /* bfd_set_format.  */
     _bfd_bool_bfd_false_error,
     coff_mkobject,
     _bfd_generic_mkarchive,
-    _bfd_bool_bfd_false_error 
+    _bfd_bool_bfd_false_error
   },
   {                            /* bfd_write_contents.  */
     _bfd_bool_bfd_false_error,
     coff_write_object_contents,
     _bfd_write_archive_contents,
-    _bfd_bool_bfd_false_error 
+    _bfd_bool_bfd_false_error
   },
 
   BFD_JUMP_TABLE_GENERIC (coff),
This page took 0.024022 seconds and 4 git commands to generate.