aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorTrevor Smigiel <Trevor_Smigiel@playstation.sony.com>2009-08-05 20:40:34 +0000
committerTrevor Smigiel <Trevor_Smigiel@playstation.sony.com>2009-08-05 20:40:34 +0000
commit9cc305ec2050ff3cda567d40cf87a2814d8d2ff3 (patch)
treed6ac66ada9f1a228988e8beb6030f1b673d5e413 /ld
parent99e008fef7268b84c5122b8a49ca7aa25edd7282 (diff)
downloadgdb-9cc305ec2050ff3cda567d40cf87a2814d8d2ff3.zip
gdb-9cc305ec2050ff3cda567d40cf87a2814d8d2ff3.tar.gz
gdb-9cc305ec2050ff3cda567d40cf87a2814d8d2ff3.tar.bz2
bfd/
* elf32-spu.h (spu_elf_params): Add member emit_fixups. (spu_elf_size_sections): Declare prototype. * elf32-spu.c (spu_link_hash_table): Add member sfixup. (FIXUP_RECORD_SIZE, FIXUP_GET, FIXUP_PUT): New macros. (spu_elf_emit_fixup): New function. (spu_elf_relocate_section): Emit fixup for each SPU_ADDR32. (spu_elf_size_sections): New function. ld/ * emulparams/elf32_spu.sh (OTHER_READONLY_SECTIONS): Add .fixup section and __fixup_start symbol. * emultempl/spuelf.em (params): Initialize emit_fixups member. (spu_before_allocation): Call spu_elf_size_sections. (OPTION_SPU_EMIT_FIXUPS): Define. (PARSE_AND_LIST_LONGOPTS): Add --emit-fixups. (PARSE_AND_LIST_ARGS_CASES): Handle --emit-fixups. * ld.texinfo (--emit-fixups): Document. ld/testsuite/ * ld-spu/fixup.d: New. * ld-spu/fixup.s: New.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog11
-rw-r--r--ld/emulparams/elf32_spu.sh5
-rw-r--r--ld/emultempl/spuelf.em12
-rw-r--r--ld/testsuite/ChangeLog5
-rw-r--r--ld/testsuite/ld-spu/fixup.d20
-rw-r--r--ld/testsuite/ld-spu/fixup.s24
6 files changed, 76 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a3774ec..742b567 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,14 @@
+2009-08-05 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
+
+ * emulparams/elf32_spu.sh (OTHER_READONLY_SECTIONS): Add .fixup
+ section and __fixup_start symbol.
+ * emultempl/spuelf.em (params): Initialize emit_fixups member.
+ (spu_before_allocation): Call spu_elf_size_sections.
+ (OPTION_SPU_EMIT_FIXUPS): Define.
+ (PARSE_AND_LIST_LONGOPTS): Add --emit-fixups.
+ (PARSE_AND_LIST_ARGS_CASES): Handle --emit-fixups.
+ * ld.texinfo (--emit-fixups): Document.
+
2009-08-04 Alan Modra <amodra@bigpond.net.au>
PR 10474
diff --git a/ld/emulparams/elf32_spu.sh b/ld/emulparams/elf32_spu.sh
index 1ed58c3..6993ca7 100644
--- a/ld/emulparams/elf32_spu.sh
+++ b/ld/emulparams/elf32_spu.sh
@@ -20,3 +20,8 @@ DATA_ADDR="ALIGN(${MAXPAGESIZE})"
OTHER_BSS_SECTIONS=".toe ALIGN(128) : { *(.toe) } = 0"
OTHER_SECTIONS=".note.spu_name 0 : { KEEP(*(.note.spu_name)) }
._ea 0 : { KEEP(*(._ea)) KEEP(*(._ea.*)) }"
+OTHER_READONLY_SECTIONS="
+ .fixup ${RELOCATING-0} : {
+ PROVIDE (__fixup_start = .);
+ KEEP(*(.fixup))
+ }"
diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
index 1b549ad..1f4fbec 100644
--- a/ld/emultempl/spuelf.em
+++ b/ld/emultempl/spuelf.em
@@ -37,7 +37,7 @@ static struct spu_elf_params params =
&spu_elf_load_ovl_mgr,
&spu_elf_open_overlay_script,
&spu_elf_relink,
- 0, ovly_normal, 0, 0, 0, 0, 0, 0, 0,
+ 0, ovly_normal, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0x3ffff,
1, 0, 16, 0, 0, 2000
};
@@ -316,6 +316,10 @@ spu_before_allocation (void)
lang_reset_memory_regions ();
}
+ if (is_spu_target ()
+ && !link_info.relocatable)
+ spu_elf_size_sections (link_info.output_bfd, &link_info);
+
gld${EMULATION_NAME}_before_allocation ();
}
@@ -600,6 +604,7 @@ PARSE_AND_LIST_PROLOGUE='
#define OPTION_SPU_RESERVED_SPACE (OPTION_SPU_FIXED_SPACE + 1)
#define OPTION_SPU_EXTRA_STACK (OPTION_SPU_RESERVED_SPACE + 1)
#define OPTION_SPU_NO_AUTO_OVERLAY (OPTION_SPU_EXTRA_STACK + 1)
+#define OPTION_SPU_EMIT_FIXUPS (OPTION_SPU_NO_AUTO_OVERLAY + 1)
'
PARSE_AND_LIST_LONGOPTS='
@@ -625,6 +630,7 @@ PARSE_AND_LIST_LONGOPTS='
{ "reserved-space", required_argument, NULL, OPTION_SPU_RESERVED_SPACE },
{ "extra-stack-space", required_argument, NULL, OPTION_SPU_EXTRA_STACK },
{ "no-auto-overlay", optional_argument, NULL, OPTION_SPU_NO_AUTO_OVERLAY },
+ { "emit-fixups", optional_argument, NULL, OPTION_SPU_EMIT_FIXUPS },
'
PARSE_AND_LIST_OPTIONS='
@@ -812,6 +818,10 @@ PARSE_AND_LIST_ARGS_CASES='
break;
}
break;
+
+ case OPTION_SPU_EMIT_FIXUPS:
+ params.emit_fixups = 1;
+ break;
'
LDEMUL_AFTER_OPEN=spu_after_open
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index d63c14b..1386162 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-05 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
+
+ * ld-spu/fixup.d: New.
+ * ld-spu/fixup.s: New.
+
2009-08-05 Nathan Sidwell <nathan@codesourcery.com>
* ld-arm/cortex-a8-far-1.s: New.
diff --git a/ld/testsuite/ld-spu/fixup.d b/ld/testsuite/ld-spu/fixup.d
new file mode 100644
index 0000000..39f731b
--- /dev/null
+++ b/ld/testsuite/ld-spu/fixup.d
@@ -0,0 +1,20 @@
+#source: fixup.s
+#ld: --emit-fixups
+#objdump: -s
+
+.*elf32-spu
+
+Contents of section .text:
+ 0000 00000000 ....
+Contents of section .fixup:
+ 0004 0000008b 00000091 000000c1 00000000 ................
+Contents of section .data:
+ 0080 000000d0 00000000 00000000 000000c0 ................
+ 0090 00000000 00000000 00000000 000000b0 ................
+ 00a0 00000001 00000000 00000000 00000000 ................
+ 00b0 00000002 00000000 00000000 00000000 ................
+ 00c0 00000000 00000000 00000000 00000080 ................
+Contents of section .note.spu_name:
+.*
+.*
+#pass
diff --git a/ld/testsuite/ld-spu/fixup.s b/ld/testsuite/ld-spu/fixup.s
new file mode 100644
index 0000000..c0fd6db
--- /dev/null
+++ b/ld/testsuite/ld-spu/fixup.s
@@ -0,0 +1,24 @@
+ .global _end
+ .global _start
+ .global glob
+ .global after
+ .global before
+ .weak undef
+
+ .section .text,"ax"
+_start:
+ stop
+
+
+ .data
+ .p2align 4
+before:
+ .long _end, 0, _start, after
+ .long 0, 0, 0, glob
+loc:
+ .long 1,0,0,0
+glob:
+ .long 2,0,0,0
+after:
+ .long 0, 0, 0, before
+