summaryrefslogtreecommitdiff
path: root/bfd/elf32-spu.c
diff options
context:
space:
mode:
authorTrevor Smigiel <Trevor_Smigiel@playstation.sony.com>2009-07-24 19:51:27 +0000
committerTrevor Smigiel <Trevor_Smigiel@playstation.sony.com>2009-07-24 19:51:27 +0000
commiteb83a00c59ebf6c2bfe1938d750b5fa153cc664e (patch)
tree9f923e29c9cb58e160239c506509bf1fb5a0974c /bfd/elf32-spu.c
parent2a3a75593f5b7e30b7870819ab979a69aa148b6b (diff)
downloadbinutils-redhat-eb83a00c59ebf6c2bfe1938d750b5fa153cc664e.tar.gz
include/elf/
* spu.h (R_SPU_ADD_PIC): New. bfd/ * reloc.c (BFD_RELOC_SPU_ADD_PIC): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elf32-spu.c (elf_howto_table): Add entries SPU_ADD_PIC. (spu_elf_bfd_to_reloc_type): Handle SPU_ADD_PIC. (spu_elf_relocate_section): Patch instructions marked by SPU_ADD_PIC. gas/ * config/tc-spu.c (md_apply_fix): Handle SPU_ADD_PIC. * config/tc-spu.h (tc_fix_adjustable): Don't adjust for SPU_ADD_PIC. (TC_FORCE_RELOCATION): Emit relocs for SPU_ADD_PIC. ld/testsuite/ * ld-spu/pic.d: New. * ld-spu/pic.s: New. * ld-spu/picdef.s: New.
Diffstat (limited to 'bfd/elf32-spu.c')
-rw-r--r--bfd/elf32-spu.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index d03617aede..b5c90a1fa4 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -88,6 +88,9 @@ static reloc_howto_type elf_howto_table[] = {
HOWTO (R_SPU_PPU64, 0, 4, 64, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_PPU64",
FALSE, 0, -1, FALSE),
+ HOWTO (R_SPU_ADD_PIC, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_ADD_PIC",
+ FALSE, 0, 0x00000000, FALSE),
};
static struct bfd_elf_special_section const spu_elf_special_sections[] = {
@@ -135,6 +138,8 @@ spu_elf_bfd_to_reloc_type (bfd_reloc_code_real_type code)
return R_SPU_PPU32;
case BFD_RELOC_SPU_PPU64:
return R_SPU_PPU64;
+ case BFD_RELOC_SPU_ADD_PIC:
+ return R_SPU_ADD_PIC;
}
}
@@ -4841,6 +4846,16 @@ spu_elf_relocate_section (bfd *output_bfd,
if (info->relocatable)
continue;
+ /* Change "a rt,ra,rb" to "ai rt,ra,0". */
+ if (r_type == R_SPU_ADD_PIC && h != NULL
+ && (h->def_regular || ELF_COMMON_DEF_P (h)))
+ {
+ bfd_byte *loc = contents + rel->r_offset;
+ loc[0] = 0x1c;
+ loc[1] = 0x00;
+ loc[2] &= 0x3f;
+ }
+
is_ea_sym = (ea != NULL
&& sec != NULL
&& sec->output_section == ea);