gas: Add md_generic_table_relax_frag
[deliverable/binutils-gdb.git] / bfd / coff-i386.c
index 6505664ab6349b1dfa5ecf64f4cd06919c7564b5..99f60798636cf7b172dcd7fed5fe1d18502d1ea7 100644 (file)
@@ -41,6 +41,9 @@
 
 #include "libcoff.h"
 
+/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1.  */
+#define OCTETS_PER_BYTE(ABFD, SEC) 1
+
 static reloc_howto_type *coff_i386_rtype_to_howto
   (bfd *, asection *, struct internal_reloc *,
    struct coff_link_hash_entry *, struct internal_syment *,
@@ -67,7 +70,7 @@ coff_i386_reloc (bfd *abfd,
                 arelent *reloc_entry,
                 asymbol *symbol,
                 void * data,
-                asection *input_section ATTRIBUTE_UNUSED,
+                asection *input_section,
                 bfd *output_bfd,
                 char **error_message ATTRIBUTE_UNUSED)
 {
@@ -142,11 +145,11 @@ coff_i386_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)
@@ -661,7 +664,7 @@ const bfd_target
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
 /* Note that we allow an object file to be treated as a core file as well.  */
-    
+
 #ifdef COFF_CHECK_FORMAT
   {                            /* bfd_check_format */
     _bfd_dummy_target,
This page took 0.028646 seconds and 4 git commands to generate.