From 2e59f59ab905767423f2b0ef38f6748b68d90af2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 26 Mar 2007 23:56:40 +0000 Subject: [PATCH] * embedspu.sh: Combine "_EAR_" and "_EAR_*" patterns. Tighten .toe section and .toe address checks. Use .reloc for _EAR* symbols defined in non-BSS sections. Build table for _SPUEAR_ symbols. --- binutils/ChangeLog | 7 ++++++ binutils/embedspu.sh | 62 +++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 076965bc3..bb5790b49 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2007-03-27 Alan Modra + + * embedspu.sh: Combine "_EAR_" and "_EAR_*" patterns. Tighten + .toe section and .toe address checks. Use .reloc for _EAR* + symbols defined in non-BSS sections. Build table for _SPUEAR_ + symbols. + 2007-03-23 Kaz Kojima PR gas/3811 diff --git a/binutils/embedspu.sh b/binutils/embedspu.sh index 0d41865ba..693b5a4b1 100644 --- a/binutils/embedspu.sh +++ b/binutils/embedspu.sh @@ -116,18 +116,27 @@ main () exit 1 fi + 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'` + sections=`${READELF} -S ${INFILE} | sed -n -e 's, *\[ *\([0-9]*\)\] *[^ ]* *PROGBITS *\([0-9a-f]*\) *\([0-9a-f]*\).*,\1 \2 \3,p'` + sections=`echo ${sections}` + # Build embedded SPU image. # 1. The whole SPU ELF file is written to .rodata.speelf # 2. Symbols starting with the string "_EAR_" in the SPU ELF image are # special. They allow an SPU program to access corresponding symbols # (ie. minus the _EAR_ prefix), in the PowerPC program. _EAR_ without # a suffix is used to refer to the addrress of the SPU image in - # PowerPC address space. _EAR_* symbols must all be defined in one - # section at 16 byte intervals. - # Find all _EAR_ symbols using readelf, sort by address, and write - # the address of the corresponding PowerPC symbol in a table built - # in .data.spetoe. + # PowerPC address space. _EAR_* symbols must all be defined in .toe + # at 16 byte intervals, or they must be defined in other non-bss + # sections. + # Find all _EAR_ symbols in .toe using readelf, sort by address, and + # write the address of the corresponding PowerPC symbol in a table + # built in .data.spetoe. For _EAE_ symbols not in .toe, create + # .reloc commands to relocate their location directly. # 3. Write a struct spe_program_handle to .data. + # 4. Write a table of _SPUEAR_ symbols. ${CC} ${FLAGS} -x assembler-with-cpp -nostartfiles -nostdlib \ -Wa,-mbig -Wl,-r -Wl,-x -o ${OUTFILE} - <