Add more eabi relocations
This commit is contained in:
parent
b209d2a3d9
commit
eb82bc605f
|
@ -1,3 +1,22 @@
|
||||||
|
Thu Jan 25 12:08:51 1996 Michael Meissner <meissner@tiktok.cygnus.com>
|
||||||
|
|
||||||
|
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Add .rela.sdata{,2}
|
||||||
|
to sections we allocate. Use bfd_zalloc to allocate initialial
|
||||||
|
sections, not bfd_alloc.
|
||||||
|
(ppc_elf_check_relocs): Remove BFD_ASSERTs for !shared from
|
||||||
|
SDA{,2}I16 relocations.
|
||||||
|
(ppc_elf_add_symbol_hook): Use the value of -G nn to determine
|
||||||
|
whether to put something in .sbss or not.
|
||||||
|
(ppc_elf_relocate_section): Add support for more relocations. Add
|
||||||
|
in sec->output_offset where appropriate.
|
||||||
|
|
||||||
|
* elflink.c (_bfd_elf_create_linker_section): Lookup symbol before
|
||||||
|
trying to add it to the symbol table, so _GLOBAL_OFFSET_TABLE_
|
||||||
|
doesn't get redefined messages if -shared.
|
||||||
|
|
||||||
|
* elflink.h (elf_create_pointer_linker_section) Only bump RELA
|
||||||
|
section if the rel_section field has been set up.
|
||||||
|
|
||||||
Wed Jan 24 20:40:26 1996 Michael Meissner <meissner@tiktok.cygnus.com>
|
Wed Jan 24 20:40:26 1996 Michael Meissner <meissner@tiktok.cygnus.com>
|
||||||
|
|
||||||
* elf32-ppc.c (ppc_elf_relocate_section): Fix typo in eabi
|
* elf32-ppc.c (ppc_elf_relocate_section): Fix typo in eabi
|
||||||
|
|
|
@ -1437,7 +1437,9 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
|
||||||
if (strcmp (name, ".plt") != 0
|
if (strcmp (name, ".plt") != 0
|
||||||
&& strcmp (name, ".got") != 0
|
&& strcmp (name, ".got") != 0
|
||||||
&& strcmp (name, ".sdata") != 0
|
&& strcmp (name, ".sdata") != 0
|
||||||
&& strcmp (name, ".sdata2") != 0)
|
&& strcmp (name, ".sdata2") != 0
|
||||||
|
&& strcmp (name, ".rela.sdata") != 0
|
||||||
|
&& strcmp (name, ".rela.sdata2") != 0)
|
||||||
{
|
{
|
||||||
/* It's not one of our sections, so don't allocate space. */
|
/* It's not one of our sections, so don't allocate space. */
|
||||||
continue;
|
continue;
|
||||||
|
@ -1458,7 +1460,7 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for the section contents. */
|
/* Allocate memory for the section contents. */
|
||||||
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
|
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
|
||||||
if (s->contents == NULL && s->_raw_size != 0)
|
if (s->contents == NULL && s->_raw_size != 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1625,7 +1627,6 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
|
||||||
&& !_bfd_elf_make_linker_section_rela (dynobj, got, 2))
|
&& !_bfd_elf_make_linker_section_rela (dynobj, got, 2))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BFD_ASSERT (!info->shared);
|
|
||||||
if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata, h, rel))
|
if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata, h, rel))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1638,7 +1639,6 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
|
||||||
&& !_bfd_elf_make_linker_section_rela (dynobj, got, 2))
|
&& !_bfd_elf_make_linker_section_rela (dynobj, got, 2))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BFD_ASSERT (!info->shared);
|
|
||||||
if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata2, h, rel))
|
if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata2, h, rel))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1762,9 +1762,9 @@ ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
|
||||||
asection **secp;
|
asection **secp;
|
||||||
bfd_vma *valp;
|
bfd_vma *valp;
|
||||||
{
|
{
|
||||||
if (sym->st_shndx == SHN_COMMON && sym->st_size <= 8)
|
if (sym->st_shndx == SHN_COMMON && sym->st_size <= bfd_get_gp_size (abfd))
|
||||||
{
|
{
|
||||||
/* Common symbols less than or equal to 8 bytes are automatically
|
/* Common symbols less than or equal to -G nn bytes are automatically
|
||||||
put into .sdata. */
|
put into .sdata. */
|
||||||
bfd *dynobj = elf_hash_table (info)->dynobj;
|
bfd *dynobj = elf_hash_table (info)->dynobj;
|
||||||
elf_linker_section_t *sdata = elf_linker_section (dynobj, LINKER_SECTION_SDATA);
|
elf_linker_section_t *sdata = elf_linker_section (dynobj, LINKER_SECTION_SDATA);
|
||||||
|
@ -2242,7 +2242,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
|| strcmp (bfd_get_section_name (abfd, sec), ".got") == 0
|
|| 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), ".cgot") == 0)
|
||||||
|
|
||||||
addend -= sec->output_section->vma + 0x8000;
|
addend -= sec->output_section->vma + sec->output_offset + 0x8000;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* arithmetic adjust relocations */
|
/* arithmetic adjust relocations */
|
||||||
|
@ -2267,7 +2267,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addend -= (sdata->sym_hash->root.u.def.value
|
addend -= (sdata->sym_hash->root.u.def.value
|
||||||
+ sdata->sym_hash->root.u.def.section->output_section->vma);
|
+ sdata->sym_hash->root.u.def.section->output_section->vma
|
||||||
|
+ sdata->sym_hash->root.u.def.section->output_offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2287,7 +2288,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addend -= (sdata2->sym_hash->root.u.def.value
|
addend -= (sdata2->sym_hash->root.u.def.value
|
||||||
+ sdata2->sym_hash->root.u.def.section->output_section->vma);
|
+ sdata2->sym_hash->root.u.def.section->output_section->vma
|
||||||
|
+ sdata2->sym_hash->root.u.def.section->output_offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2303,14 +2305,16 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
{
|
{
|
||||||
reg = 13;
|
reg = 13;
|
||||||
addend -= (sdata->sym_hash->root.u.def.value
|
addend -= (sdata->sym_hash->root.u.def.value
|
||||||
+ sdata->sym_hash->root.u.def.section->output_section->vma);
|
+ sdata->sym_hash->root.u.def.section->output_section->vma
|
||||||
|
+ sdata->sym_hash->root.u.def.section->output_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp (name, ".sdata2") == 0 || strcmp (name, ".sbss2") == 0)
|
else if (strcmp (name, ".sdata2") == 0 || strcmp (name, ".sbss2") == 0)
|
||||||
{
|
{
|
||||||
reg = 2;
|
reg = 2;
|
||||||
addend -= (sdata2->sym_hash->root.u.def.value
|
addend -= (sdata2->sym_hash->root.u.def.value
|
||||||
+ sdata2->sym_hash->root.u.def.section->output_section->vma);
|
+ sdata2->sym_hash->root.u.def.section->output_section->vma
|
||||||
|
+ sdata2->sym_hash->root.u.def.section->output_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp (name, ".PPC.EMB.sdata0") == 0 || strcmp (name, ".PPC.EMB.sbss0") == 0)
|
else if (strcmp (name, ".PPC.EMB.sdata0") == 0 || strcmp (name, ".PPC.EMB.sbss0") == 0)
|
||||||
|
@ -2339,6 +2343,38 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* Relocate against the beginning of the section */
|
||||||
|
case (int)R_PPC_SECTOFF:
|
||||||
|
case (int)R_PPC_SECTOFF_LO:
|
||||||
|
case (int)R_PPC_SECTOFF_HI:
|
||||||
|
BFD_ASSERT (sec != (asection *)0);
|
||||||
|
addend -= sec->output_section->vma;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (int)R_PPC_SECTOFF_HA:
|
||||||
|
BFD_ASSERT (sec != (asection *)0);
|
||||||
|
addend -= sec->output_section->vma;
|
||||||
|
addend += ((relocation + addend) & 0x8000) << 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Negative relocations */
|
||||||
|
case (int)R_PPC_EMB_NADDR32:
|
||||||
|
case (int)R_PPC_EMB_NADDR16:
|
||||||
|
case (int)R_PPC_EMB_NADDR16_LO:
|
||||||
|
case (int)R_PPC_EMB_NADDR16_HI:
|
||||||
|
addend -= 2*relocation;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (int)R_PPC_EMB_NADDR16_HA:
|
||||||
|
addend -= 2*relocation;
|
||||||
|
addend += ((relocation + addend) & 0x8000) << 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* NOP relocation that prevents garbage collecting linkers from omitting a
|
||||||
|
reference. */
|
||||||
|
case (int)R_PPC_EMB_MRKREF:
|
||||||
|
continue;
|
||||||
|
|
||||||
case (int)R_PPC_PLTREL24:
|
case (int)R_PPC_PLTREL24:
|
||||||
case (int)R_PPC_COPY:
|
case (int)R_PPC_COPY:
|
||||||
case (int)R_PPC_GLOB_DAT:
|
case (int)R_PPC_GLOB_DAT:
|
||||||
|
@ -2350,22 +2386,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
case (int)R_PPC_PLT16_LO:
|
case (int)R_PPC_PLT16_LO:
|
||||||
case (int)R_PPC_PLT16_HI:
|
case (int)R_PPC_PLT16_HI:
|
||||||
case (int)R_PPC_PLT16_HA:
|
case (int)R_PPC_PLT16_HA:
|
||||||
case (int)R_PPC_SECTOFF:
|
|
||||||
case (int)R_PPC_SECTOFF_LO:
|
|
||||||
case (int)R_PPC_SECTOFF_HI:
|
|
||||||
case (int)R_PPC_SECTOFF_HA:
|
|
||||||
case (int)R_PPC_EMB_NADDR32:
|
|
||||||
case (int)R_PPC_EMB_NADDR16:
|
|
||||||
case (int)R_PPC_EMB_NADDR16_LO:
|
|
||||||
case (int)R_PPC_EMB_NADDR16_HI:
|
|
||||||
case (int)R_PPC_EMB_NADDR16_HA:
|
|
||||||
case (int)R_PPC_EMB_MRKREF:
|
|
||||||
case (int)R_PPC_EMB_RELSEC16:
|
case (int)R_PPC_EMB_RELSEC16:
|
||||||
case (int)R_PPC_EMB_RELST_LO:
|
case (int)R_PPC_EMB_RELST_LO:
|
||||||
case (int)R_PPC_EMB_RELST_HI:
|
case (int)R_PPC_EMB_RELST_HI:
|
||||||
case (int)R_PPC_EMB_RELST_HA:
|
case (int)R_PPC_EMB_RELST_HA:
|
||||||
case (int)R_PPC_EMB_BIT_FLD:
|
case (int)R_PPC_EMB_BIT_FLD:
|
||||||
unsupported:
|
|
||||||
(*_bfd_error_handler) ("%s: Relocation %s is not yet supported.",
|
(*_bfd_error_handler) ("%s: Relocation %s is not yet supported.",
|
||||||
bfd_get_filename (input_bfd),
|
bfd_get_filename (input_bfd),
|
||||||
ppc_elf_howto_table[ (int)r_type ]->name);
|
ppc_elf_howto_table[ (int)r_type ]->name);
|
||||||
|
|
|
@ -3172,7 +3172,7 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BFD_ASSERT (lsect->rel_section != NULL);
|
if (lsect->rel_section)
|
||||||
lsect->rel_section->_raw_size += sizeof (Elf_External_Rela);
|
lsect->rel_section->_raw_size += sizeof (Elf_External_Rela);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue