return bfd_reloc_undefined;
/* Is the address of the relocation really within the section? */
- octets = reloc_entry->address * bfd_octets_per_byte (abfd);
+ octets = reloc_entry->address * bfd_octets_per_byte (abfd, input_section);
if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
return bfd_reloc_outofrange;
else
output_base = reloc_target_output_section->vma;
- relocation += output_base + symbol->section->output_offset;
+ 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))
+ output_base *= bfd_octets_per_byte (abfd, input_section);
+
+ relocation += output_base;
/* Add in supplied addend. */
relocation += reloc_entry->addend;
it will have been checked in `bfd_perform_relocation already'. */
/* Is the address of the relocation really within the section? */
- octets = reloc_entry->address * bfd_octets_per_byte (abfd);
+ octets = reloc_entry->address * bfd_octets_per_byte (abfd, input_section);
if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
return bfd_reloc_outofrange;
else
output_base = reloc_target_output_section->vma;
- relocation += output_base + symbol->section->output_offset;
+ 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))
+ output_base *= bfd_octets_per_byte (abfd, input_section);
+
+ relocation += output_base;
/* Add in supplied addend. */
relocation += reloc_entry->addend;
bfd_vma addend)
{
bfd_vma relocation;
- bfd_size_type octets = address * bfd_octets_per_byte (input_bfd);
+ bfd_size_type octets = (address
+ * bfd_octets_per_byte (input_bfd, input_section));
/* Sanity check the address. */
if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section, octets))
}
return _bfd_relocate_contents (howto, input_bfd, relocation,
- contents
- + address * bfd_octets_per_byte (input_bfd));
+ contents + octets);
}
/* Relocate a given location using a given value and howto. */
Freescale S12Z reloc.
This is a 15 bit relative address. If the most significant bits are all zero
then it may be truncated to 8 bits.
-ENUM
- BFD_RELOC_16C_NUM08
-ENUMX
- BFD_RELOC_16C_NUM08_C
-ENUMX
- BFD_RELOC_16C_NUM16
-ENUMX
- BFD_RELOC_16C_NUM16_C
-ENUMX
- BFD_RELOC_16C_NUM32
-ENUMX
- BFD_RELOC_16C_NUM32_C
-ENUMX
- BFD_RELOC_16C_DISP04
-ENUMX
- BFD_RELOC_16C_DISP04_C
-ENUMX
- BFD_RELOC_16C_DISP08
-ENUMX
- BFD_RELOC_16C_DISP08_C
-ENUMX
- BFD_RELOC_16C_DISP16
-ENUMX
- BFD_RELOC_16C_DISP16_C
-ENUMX
- BFD_RELOC_16C_DISP24
-ENUMX
- BFD_RELOC_16C_DISP24_C
-ENUMX
- BFD_RELOC_16C_DISP24a
-ENUMX
- BFD_RELOC_16C_DISP24a_C
-ENUMX
- BFD_RELOC_16C_REG04
-ENUMX
- BFD_RELOC_16C_REG04_C
-ENUMX
- BFD_RELOC_16C_REG04a
-ENUMX
- BFD_RELOC_16C_REG04a_C
-ENUMX
- BFD_RELOC_16C_REG14
-ENUMX
- BFD_RELOC_16C_REG14_C
-ENUMX
- BFD_RELOC_16C_REG16
-ENUMX
- BFD_RELOC_16C_REG16_C
-ENUMX
- BFD_RELOC_16C_REG20
-ENUMX
- BFD_RELOC_16C_REG20_C
-ENUMX
- BFD_RELOC_16C_ABS20
-ENUMX
- BFD_RELOC_16C_ABS20_C
-ENUMX
- BFD_RELOC_16C_ABS24
-ENUMX
- BFD_RELOC_16C_ABS24_C
-ENUMX
- BFD_RELOC_16C_IMM04
-ENUMX
- BFD_RELOC_16C_IMM04_C
-ENUMX
- BFD_RELOC_16C_IMM16
-ENUMX
- BFD_RELOC_16C_IMM16_C
-ENUMX
- BFD_RELOC_16C_IMM20
-ENUMX
- BFD_RELOC_16C_IMM20_C
-ENUMX
- BFD_RELOC_16C_IMM24
-ENUMX
- BFD_RELOC_16C_IMM24_C
-ENUMX
- BFD_RELOC_16C_IMM32
-ENUMX
- BFD_RELOC_16C_IMM32_C
-ENUMDOC
- NS CR16C Relocations.
ENUM
BFD_RELOC_CR16_NUM8
reloc_howto_type *
bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
- switch (code)
- {
- case BFD_RELOC_CTOR:
- /* The type of reloc used in a ctor, which will be as wide as the
- address - so either a 64, 32, or 16 bitter. */
- switch (bfd_arch_bits_per_address (abfd))
- {
- case 64:
- BFD_FAIL ();
- break;
- case 32:
- return &bfd_howto_32;
- case 16:
- BFD_FAIL ();
- break;
- default:
- BFD_FAIL ();
- }
- break;
- default:
- BFD_FAIL ();
- }
+ /* Very limited support is provided for relocs in generic targets
+ such as elf32-little. FIXME: Should we always return NULL? */
+ if (code == BFD_RELOC_CTOR
+ && bfd_arch_bits_per_address (abfd) == 32)
+ return &bfd_howto_32;
return NULL;
}
= HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL,
"unused", FALSE, 0, 0, FALSE);
- off = (*parent)->address * bfd_octets_per_byte (input_bfd);
+ off = ((*parent)->address
+ * bfd_octets_per_byte (input_bfd, input_section));
_bfd_clear_contents ((*parent)->howto, input_bfd,
input_section, data, off);
(*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;