R_PPC_max
};
-static bfd_reloc_status_type ppc_elf_unsupported_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type ppc_elf_std_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
static reloc_howto_type *ppc_elf_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void ppc_elf_info_to_howto
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_NONE", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR32", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR24", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR16", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR16_LO", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR16_HI", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR14", /* name */
false, /* partial_inplace */
0, /* src_mask */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_REL24", /* name */
false, /* partial_inplace */
0, /* src_mask */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_REL14", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_GOT16_HA", /* name */
false, /* partial_inplace */
0, /* src_mask */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLTREL24", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_COPY", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_GLOB_DAT", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_JMP_SLOT", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_RELATIVE", /* name */
false, /* partial_inplace */
0, /* src_mask */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_LOCAL24PC", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_UADDR32", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_UADDR16", /* name */
false, /* partial_inplace */
0, /* src_mask */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_std_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_REL32", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLT32", /* name */
false, /* partial_inplace */
0, /* src_mask */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLTREL32", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLT16_LO", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLT16_HI", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_PLT16_HA", /* name */
false, /* partial_inplace */
0, /* src_mask */
false), /* pcrel_offset */
/* A sign-extended 16 bit value relative to _SDA_BASE, for use with
- small data items. */
+ small data items. FIXME: Not supported. */
HOWTO (R_PPC_SDAREL16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_SECTOFF", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_SECTOFF_LO", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_SECTOFF_HI", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_SECTOFF_HA", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_NADDR32", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_NADDR16", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont,/* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_ADDR16_LO", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_NADDR16_HI", /* name */
false, /* partial_inplace */
0, /* src_mask */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- ppc_elf_unsupported_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_PPC_EMB_NADDR16_HA", /* name */
false, /* partial_inplace */
0, /* src_mask */
return true;
}
-\f
-/* ELF relocs are against symbols. If we are producing relocateable
- output, and the reloc is against an external symbol, and nothing
- has given us any additional addend, the resulting reloc will also
- be against the same symbol. In such a case, we don't want to
- change anything about the way the reloc is handled, since it will
- all be done at final link time. Rather than put special case code
- into bfd_perform_relocation, all the reloc types use this howto
- function. It just short circuits the reloc if producing
- relocateable output against an external symbol. */
-
-/*ARGSUSED*/
-static bfd_reloc_status_type
-ppc_elf_std_reloc (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- return bfd_reloc_continue;
-}
-
-/* Don't pretend we can deal with unsupported relocs. */
-
-/*ARGSUSED*/
-static bfd_reloc_status_type
-ppc_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
- (*_bfd_error_handler)
- ("%s: relocation %s (%d) is not currently supported",
- bfd_get_filename (abfd),
- reloc_entry->howto->name,
- reloc_entry->howto->type);
-
- return bfd_reloc_notsupported;
-}
-
\f
/* Handle a PowerPC specific section when reading an object file. This
is called when elfcode.h finds a section with an unknown type. */
}
/* This is a final link. */
-
- /* Complain about known relocation that are not yet supported */
- if (howto->special_function == ppc_elf_unsupported_reloc)
- {
- (*_bfd_error_handler)
- ("%s: relocation %s (%d) is not currently supported",
- bfd_get_filename (input_bfd),
- howto->name,
- (int)r_type);
-
- bfd_set_error (bfd_error_bad_value);
- ret = false;
- continue;
- }
-
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
BFD_ASSERT (sec != (asection *)0);
BFD_ASSERT (bfd_is_und_section (sec)
|| strcmp (bfd_get_section_name (abfd, sec), ".got") == 0
- || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0
- || strcmp (bfd_get_section_name (abfd, sec), ".sdata") == 0
- || strcmp (bfd_get_section_name (abfd, sec), ".sbss") == 0)
+ || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0)
addend -= sec->output_section->vma + 0x8000;
break;
addend += ((relocation + addend) & 0x8000) << 1;
break;
+ case R_PPC_SDAREL16: /* relocate against _SDA_BASE_ */
+ BFD_ASSERT (sec != (asection *)0);
+ if (strcmp (bfd_get_section_name (abfd, sec), ".sdata") != 0
+ && strcmp (bfd_get_section_name (abfd, sec), ".sbss") != 0)
+ {
+ (*_bfd_error_handler) ("%s: The target of R_PPC_SDAREL16 relocations must be in section .sdata or .sbss not %s",
+ bfd_get_filename (input_bfd),
+ bfd_get_section_name (abfd, sec));
+
+ bfd_set_error (bfd_error_bad_value);
+ ret = false;
+ continue;
+ }
+ goto unsupported;
+
+ case R_PPC_EMB_SDA2REL:
+ BFD_ASSERT (sec != (asection *)0);
+ if (strcmp (bfd_get_section_name (abfd, sec), ".sdata2") != 0
+ && strcmp (bfd_get_section_name (abfd, sec), ".sbss2") != 0)
+ {
+ (*_bfd_error_handler) ("%s: The target of R_PPC_SDA2REL16 relocations must be in section .sdata2 or .sbss2 not %s",
+ bfd_get_filename (input_bfd),
+ bfd_get_section_name (abfd, sec));
+
+ bfd_set_error (bfd_error_bad_value);
+ ret = false;
+ continue;
+ }
+ goto unsupported;
+
+
case R_PPC_PLTREL24:
case R_PPC_COPY:
case R_PPC_GLOB_DAT:
case R_PPC_PLT16_LO:
case R_PPC_PLT16_HI:
case R_PPC_PLT16_HA:
- case R_PPC_SDAREL16:
case R_PPC_SECTOFF:
case R_PPC_SECTOFF_LO:
case R_PPC_SECTOFF_HI:
case R_PPC_EMB_NADDR16_HA:
case R_PPC_EMB_SDAI16:
case R_PPC_EMB_SDA2I16:
- case R_PPC_EMB_SDA2REL:
case R_PPC_EMB_SDA21:
case R_PPC_EMB_MRKREF:
case R_PPC_EMB_RELSEC16:
case R_PPC_EMB_RELST_HA:
case R_PPC_EMB_BIT_FLD:
case R_PPC_EMB_RELSDA:
+ unsupported:
(*_bfd_error_handler) ("%s: Relocation %s is not yet supported.",
bfd_get_filename (input_bfd),
ppc_elf_howto_table[ (int)r_type ]->name);