aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-x86_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/coff-x86_64.c')
-rw-r--r--bfd/coff-x86_64.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index 94fd7ac..4edbd23 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -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, NULL)))
+ if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
return bfd_reloc_outofrange;
switch (howto->size)