diff options
author | Alan Modra <amodra@gmail.com> | 2008-05-07 14:46:44 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2008-05-07 14:46:44 +0000 |
commit | 8374f9d4b51c7bb4464875756b1a4b4e9ce742f0 (patch) | |
tree | 9be50c50e3c11f9a155a9f243921b8d79bf67ae7 /bfd | |
parent | 8c0848b5090141528fc24baa8f869252e63b8598 (diff) | |
download | fsf-binutils-gdb-8374f9d4b51c7bb4464875756b1a4b4e9ce742f0.zip fsf-binutils-gdb-8374f9d4b51c7bb4464875756b1a4b4e9ce742f0.tar.gz fsf-binutils-gdb-8374f9d4b51c7bb4464875756b1a4b4e9ce742f0.tar.bz2 |
bfd/
* elf32-spu.c (spu_elf_special_sections): Add "._ea".
(spu_elf_relocate_section): Handle relocations against symbols
defined in ._ea specially.
binutils/
* embedspu.sh: Take note of R_SPU_PPU32/64 relocs without a symbol,
and if present, put image in ".data.speelf". Put program handle
in ".data.spehandle".
ld/emulparams/
* elf32_spu.sh (OTHER_SECTIONS): Add "._ea".
* elf32ppc.sh: If building with spu support, put ".data.spehandle"
sections at the start of ".data" and provide a symbol to locate
the directory of embedded spe programs.
ld/testsuite/
* ld-spu/ear.s: Align various sections.
* ld-spu/embed.rd: Update.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-spu.c | 37 |
2 files changed, 35 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bc5e139..0a8e250 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2008-05-08 Alan Modra <amodra@bigpond.net.au> + + * elf32-spu.c (spu_elf_special_sections): Add "._ea". + (spu_elf_relocate_section): Handle relocations against symbols + defined in ._ea specially. + 2008-05-03 Daniel Jacobowitz <dan@codesourcery.com> * elf32-arm.c (elf32_arm_symbian_link_hash_table_create): Use diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index 82da03f..420193b 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -91,6 +91,7 @@ static reloc_howto_type elf_howto_table[] = { }; static struct bfd_elf_special_section const spu_elf_special_sections[] = { + { "._ea", 4, 0, SHT_PROGBITS, SHF_WRITE }, { ".toe", 4, 0, SHT_NOBITS, SHF_ALLOC }, { NULL, 0, 0, 0, 0 } }; @@ -3887,8 +3888,10 @@ spu_elf_relocate_section (bfd *output_bfd, struct elf_link_hash_entry **sym_hashes; Elf_Internal_Rela *rel, *relend; struct spu_link_hash_table *htab; + asection *ea = bfd_get_section_by_name (output_bfd, "._ea"); int ret = TRUE; bfd_boolean emit_these_relocs = FALSE; + bfd_boolean is_ea; bfd_boolean stubs; htab = spu_hash_table (info); @@ -3903,7 +3906,7 @@ spu_elf_relocate_section (bfd *output_bfd, { int r_type; reloc_howto_type *howto; - unsigned long r_symndx; + unsigned int r_symndx; Elf_Internal_Sym *sym; asection *sec; struct elf_link_hash_entry *h; @@ -3916,12 +3919,6 @@ spu_elf_relocate_section (bfd *output_bfd, r_symndx = ELF32_R_SYM (rel->r_info); r_type = ELF32_R_TYPE (rel->r_info); - if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64) - { - emit_these_relocs = TRUE; - continue; - } - howto = elf_howto_table + r_type; unresolved_reloc = FALSE; warned = FALSE; @@ -3958,6 +3955,31 @@ spu_elf_relocate_section (bfd *output_bfd, if (info->relocatable) continue; + is_ea = (ea != NULL + && sec != NULL + && sec->output_section == ea); + if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64) + { + if (is_ea) + { + /* ._ea is a special section that isn't allocated in SPU + memory, but rather occupies space in PPU memory as + part of an embedded ELF image. If this reloc is + against a symbol defined in ._ea, then transform the + reloc into an equivalent one without a symbol + relative to the start of the ELF image. */ + rel->r_addend += (relocation + - ea->vma + + elf_section_data (ea)->this_hdr.sh_offset); + rel->r_info = ELF32_R_INFO (0, r_type); + } + emit_these_relocs = TRUE; + continue; + } + + if (is_ea) + unresolved_reloc = TRUE; + if (unresolved_reloc) { (*_bfd_error_handler) @@ -4059,7 +4081,6 @@ spu_elf_relocate_section (bfd *output_bfd, if (ret && emit_these_relocs - && !info->relocatable && !info->emitrelocations) { Elf_Internal_Rela *wrel; |