#
# This file is part of GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This file is part of GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
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'`
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'`
# 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}`
# For relocation sections, pick off file offset and info (points to
# section where relocs apply)
# 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}`
# For relocation sections, pick off file offset and info (points to
# section where relocs apply)
- relas=`${READELF} -S ${INFILE} | sed -n -e 's, *\[ *[0-9]*\] *[^ ]* *RELA *[0-9a-f]* *0*\([0-9a-f][0-9a-f]*\) .*\([0-9a-f][0-9a-f]*\) *[0-9a-f][0-9a-f]*$,\1 \2,p'`
+ relas=`${READELF} -S ${INFILE} | sed -n -e 's, *\[ *[0-9]*\] *[^ ]* *RELA *[0-9a-f]* *0*\([0-9a-f][0-9a-f]*\).* \([0-9a-f][0-9a-f]*\) *[0-9a-f][0-9a-f]*$,\1 \2,p'`
# sections.
# Find all _EAR_ symbols in .toe using readelf, sort by address, and
# write the address of the corresponding PowerPC symbol in a table
# sections.
# Find all _EAR_ symbols in .toe using readelf, sort by address, and
# write the address of the corresponding PowerPC symbol in a table
# .reloc commands to relocate their location directly.
# 3. Look for R_SPU_PPU32 and R_SPU_PPU64 relocations in the SPU ELF image
# and create .reloc commands for them.
# 4. Write a struct spe_program_handle to .data.
# 5. Write a table of _SPUEAR_ symbols.
${CC} ${FLAGS} -x assembler-with-cpp -nostartfiles -nostdlib \
# .reloc commands to relocate their location directly.
# 3. Look for R_SPU_PPU32 and R_SPU_PPU64 relocations in the SPU ELF image
# and create .reloc commands for them.
# 4. Write a struct spe_program_handle to .data.
# 5. Write a table of _SPUEAR_ symbols.
${CC} ${FLAGS} -x assembler-with-cpp -nostartfiles -nostdlib \
- -Wa,-mbig -Wl,-r -Wl,-x -o ${OUTFILE} - <<EOF
+ -Wa,-mbig -Wa,-noexecstack -Wl,-r -Wl,-x -o ${OUTFILE} - <<EOF
.section .data.spetoe,"aw",@progbits
.p2align 7
__spetoe__:
`${READELF} -s -W ${INFILE} | grep ' _EAR_' | sort -k 2 | awk \
'BEGIN { \
.section .data.spetoe,"aw",@progbits
.p2align 7
__spetoe__:
`${READELF} -s -W ${INFILE} | grep ' _EAR_' | sort -k 2 | awk \
'BEGIN { \
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]); \
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]); \
.section .data.rel.ro.speelf,"a",@progbits
#else
.section .rodata.speelf,"a",@progbits
.section .data.rel.ro.speelf,"a",@progbits
#else
.section .rodata.speelf,"a",@progbits