summaryrefslogtreecommitdiff
path: root/binutils/embedspu.sh
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2007-05-29 13:10:10 +0000
committerAlan Modra <amodra@bigpond.net.au>2007-05-29 13:10:10 +0000
commitda282ef92b27ebe7804b47ab953e1fcc387c51a5 (patch)
tree911e55132813c21034e382222d2e9544385f50bf /binutils/embedspu.sh
parent703ff1313dcc0fda627de0ef83788e70845294ac (diff)
downloadbinutils-redhat-da282ef92b27ebe7804b47ab953e1fcc387c51a5.tar.gz
binutils/
* embedspu.sh: Emit SPU ELF image to .data.rel.ro.speelf if pic or pie and image needs relocs. ld/ * emultempl/spuelf.em (base_name): New function, split out from.. (embedded_spu_file) ..here. Pass -fPIC or -fpie to embedspu invocation if we deduce a shared lib or position independent executable build by looking at ctrbegin* linker input files.
Diffstat (limited to 'binutils/embedspu.sh')
-rw-r--r--binutils/embedspu.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/binutils/embedspu.sh b/binutils/embedspu.sh
index 7a321589d1..49776b00d7 100644
--- a/binutils/embedspu.sh
+++ b/binutils/embedspu.sh
@@ -146,11 +146,6 @@ main ()
# 5. Write a table of _SPUEAR_ symbols.
${CC} ${FLAGS} -x assembler-with-cpp -nostartfiles -nostdlib \
-Wa,-mbig -Wl,-r -Wl,-x -o ${OUTFILE} - <<EOF
- .section .rodata.speelf,"a",@progbits
- .p2align 7
-__speelf__:
- .incbin "${INFILE}"
-
.section .data.spetoe,"aw",@progbits
.p2align 7
__spetoe__:
@@ -181,6 +176,7 @@ $7 != "'${toe}'" && $7 in sec_off { \
print "#else"; \
print " .reloc __speelf__+" strtonum ("0x" $2) + sec_off[$7] + 4 ", R_PPC_ADDR32, " ($8 == "_EAR_" ? "__speelf__" : substr($8, 6)); \
print "#endif"; \
+ if (!donedef) { print "#define HAS_RELOCS 1"; donedef = 1; }; \
} \
$7 != "'${toe}'" && ! $7 in sec_off { \
print "#error Section not found for " $8; \
@@ -206,6 +202,7 @@ $3 ~ /R_SPU_PPU/ { \
print "#else"; \
print " .reloc __speelf__+" strtonum ("0x" $1) + sec_off[rela[sec]] + (substr($3, 10) == "64" ? 4 : 0)", R_PPC_ADDR32, " $5 "+0x" $7; \
print "#endif"; \
+ if (!donedef) { print "#define HAS_RELOCS 1"; donedef = 1; }; \
} \
$3 ~ /unrecognized:/ { \
print "#ifdef _LP64"; \
@@ -213,8 +210,17 @@ $3 ~ /unrecognized:/ { \
print "#else"; \
print " .reloc __speelf__+" strtonum ("0x" $1) + sec_off[rela[sec]] + ($4 == "f" ? 4 : 0)", R_PPC_ADDR32, " $6 "+0x" $8; \
print "#endif"; \
+ if (!donedef) { print "#define HAS_RELOCS 1"; donedef = 1; }; \
} \
'`
+#if defined (HAS_RELOCS) && (defined (__PIC__) || defined (__PIE__))
+ .section .data.rel.ro.speelf,"a",@progbits
+#else
+ .section .rodata.speelf,"a",@progbits
+#endif
+ .p2align 7
+__speelf__:
+ .incbin "${INFILE}"
.section .data,"aw",@progbits
.globl ${SYMBOL}