summaryrefslogtreecommitdiff
path: root/binutils/embedspu.sh
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2008-05-12 12:23:13 +0000
committerAlan Modra <amodra@bigpond.net.au>2008-05-12 12:23:13 +0000
commit8ea7d41c34f177f9a472fcb31b427a114ecdfaa9 (patch)
treed85208f8ae0b37b5f4fcc87864c4e9d957e18db9 /binutils/embedspu.sh
parentd8bc30c5f968f02079a2758f3304bbdb111eadf1 (diff)
downloadbinutils-redhat-8ea7d41c34f177f9a472fcb31b427a114ecdfaa9.tar.gz
* embedspu.sh: Test for presence of ._ea by looking at section
table rather than looking at relocs. Correct toe_addr substitution.
Diffstat (limited to 'binutils/embedspu.sh')
-rw-r--r--binutils/embedspu.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/binutils/embedspu.sh b/binutils/embedspu.sh
index f44d665d3c..5f9d20cb5b 100644
--- a/binutils/embedspu.sh
+++ b/binutils/embedspu.sh
@@ -119,6 +119,7 @@ main ()
toe=`${READELF} -S ${INFILE} | sed -n -e 's, *\[ *\([0-9]*\)\] *\.toe *[PROGN]*BITS *\([0-9a-f]*\).*,\1 \2,p'`
toe_addr=`echo $toe | sed -n -e 's,.* ,,p'`
toe=`echo $toe | sed -n -e 's, .*,,p'`
+ has_ea=`${READELF} -S ${INFILE} | sed -n -e 's, *\[ *\([0-9]*\)\] *\._ea *PROGBITS.*,\1,p'`
# For loaded sections, pick off section number, address, and file offset
sections=`${READELF} -S ${INFILE} | sed -n -e 's, *\[ *\([0-9]*\)\] *[^ ]* *PROGBITS *\([0-9a-f]*\) *\([0-9a-f]*\).*,\1 \2 \3,p'`
sections=`echo ${sections}`
@@ -151,7 +152,7 @@ main ()
__spetoe__:
`${READELF} -s -W ${INFILE} | grep ' _EAR_' | sort -k 2 | awk \
'BEGIN { \
- addr = strtonum ("0x" "'${toe_addr-0}'"); \
+ addr = strtonum ("0x" "'${toe_addr:-0}'"); \
split ("'"${sections}"'", s, " "); \
for (i = 1; i in s; i += 3) { \
sec_off[s[i]] = strtonum ("0x" s[i+2]) - strtonum ("0x" s[i+1]); \
@@ -202,7 +203,6 @@ $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 != "" ? $5 "+0x" $7 : "__speelf__ + 0x" $4); \
print "#endif"; \
- if (!has_ea && $5 == "") { print "#define HAS_EA 1"; has_ea = 1; }; \
if (!donedef) { print "#define HAS_RELOCS 1"; donedef = 1; }; \
} \
$3 ~ /unrecognized:/ { \
@@ -211,11 +211,10 @@ $3 ~ /unrecognized:/ { \
print "#else"; \
print " .reloc __speelf__+" strtonum ("0x" $1) + sec_off[rela[sec]] + ($4 == "f" ? 4 : 0)", R_PPC_ADDR32, " ($6 != "" ? $6 "+0x" $8 : "__speelf__ + 0x" $5); \
print "#endif"; \
- if (!has_ea && $5 == "") { print "#define HAS_EA 1"; has_ea = 1; }; \
if (!donedef) { print "#define HAS_RELOCS 1"; donedef = 1; }; \
} \
'`
-#ifdef HAS_EA
+#if ${has_ea:-0}
.section .data.speelf,"aw",@progbits
#elif defined (HAS_RELOCS) && (defined (__PIC__) || defined (__PIE__))
.section .data.rel.ro.speelf,"a",@progbits