summaryrefslogtreecommitdiff
path: root/bfd
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
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')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/bfd-in2.h1
-rw-r--r--bfd/elf32-spu.c15
-rw-r--r--bfd/libbfd.h1
-rw-r--r--bfd/reloc.c2
5 files changed, 29 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f15da419fe..a4e8714c15 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+2009-07-24 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * 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.
+
2009-07-23 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10434
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 562f8338b6..6dff90b606 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2545,6 +2545,7 @@ relocation types already defined. */
BFD_RELOC_SPU_HI16,
BFD_RELOC_SPU_PPU32,
BFD_RELOC_SPU_PPU64,
+ BFD_RELOC_SPU_ADD_PIC,
/* Alpha ECOFF and ELF relocations. Some of these treat the symbol or
"addend" in some special way.
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);
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index d0499e8d4e..28aa0458eb 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -951,6 +951,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_SPU_HI16",
"BFD_RELOC_SPU_PPU32",
"BFD_RELOC_SPU_PPU64",
+ "BFD_RELOC_SPU_ADD_PIC",
"BFD_RELOC_ALPHA_GPDISP_HI16",
"BFD_RELOC_ALPHA_GPDISP_LO16",
"BFD_RELOC_ALPHA_GPDISP",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 1f105dea10..2da43f3cbf 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -2017,6 +2017,8 @@ ENUMX
BFD_RELOC_SPU_PPU32
ENUMX
BFD_RELOC_SPU_PPU64
+ENUMX
+ BFD_RELOC_SPU_ADD_PIC
ENUMDOC
SPU Relocations.