/* BFD support for handling relocation entries.
- Copyright (C) 1990-2019 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.
else
output_base = reloc_target_output_section->vma;
- /* For sections where relocations are in octets, output_base and
- output_offset must also be converted to octets. */
+ output_base += symbol->section->output_offset;
+
+ /* If symbol addresses are in octets, convert to bytes. */
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& (symbol->section->flags & SEC_ELF_OCTETS))
- relocation += ((output_base + symbol->section->output_offset)
- * bfd_octets_per_byte (abfd, NULL));
- else
- relocation += output_base + symbol->section->output_offset;
+ output_base *= bfd_octets_per_byte (abfd, input_section);
+
+ relocation += output_base;
/* Add in supplied addend. */
relocation += reloc_entry->addend;
else
output_base = reloc_target_output_section->vma;
- /* For sections where relocations are in octets, output_base and
- output_offset must also be converted to octets. */
+ output_base += symbol->section->output_offset;
+
+ /* If symbol addresses are in octets, convert to bytes. */
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& (symbol->section->flags & SEC_ELF_OCTETS))
- relocation += ((output_base + symbol->section->output_offset)
- * bfd_octets_per_byte (abfd, NULL));
- else
- relocation += output_base + symbol->section->output_offset;
+ output_base *= bfd_octets_per_byte (abfd, input_section);
+
+ relocation += output_base;
/* Add in supplied addend. */
relocation += reloc_entry->addend;
}
return _bfd_relocate_contents (howto, input_bfd, relocation,
- contents
- + address
- * bfd_octets_per_byte (input_bfd,
- input_section));
+ contents + octets);
}
/* Relocate a given location using a given value and howto. */
BFD_RELOC_Z80_DISP8
ENUMDOC
8 bit signed offset in (ix+d) or (iy+d).
+ENUM
+ BFD_RELOC_Z80_BYTE0
+ENUMDOC
+ First 8 bits of multibyte (32, 24 or 16 bit) value.
+ENUM
+ BFD_RELOC_Z80_BYTE1
+ENUMDOC
+ Second 8 bits of multibyte (32, 24 or 16 bit) value.
+ENUM
+ BFD_RELOC_Z80_BYTE2
+ENUMDOC
+ Third 8 bits of multibyte (32 or 24 bit) value.
+ENUM
+ BFD_RELOC_Z80_BYTE3
+ENUMDOC
+ Fourth 8 bits of multibyte (32 bit) value.
+ENUM
+ BFD_RELOC_Z80_WORD0
+ENUMDOC
+ Lowest 16 bits of multibyte (32 or 24 bit) value.
+ENUM
+ BFD_RELOC_Z80_WORD1
+ENUMDOC
+ Highest 16 bits of multibyte (32 or 24 bit) value.
ENUM
BFD_RELOC_Z8K_DISP7