X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Fembedspu.sh;h=d438ed99298e9c031b37eb69ab44d8f1b68fa875;hb=313628ccbab4a2f66be351ba65a0734e75e3448f;hp=693b5a4b155d2f308d0629e881309c67130bdd6e;hpb=88948ad083c40a333392ceadd735e67c6055a9e0;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/embedspu.sh b/binutils/embedspu.sh index 693b5a4b15..d438ed9929 100644 --- a/binutils/embedspu.sh +++ b/binutils/embedspu.sh @@ -7,7 +7,7 @@ # # 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 -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -38,12 +38,12 @@ mydir=`dirname "$0"` find_prog () { prog=`echo $1 | sed "$program_transform_name"` - which $prog > /dev/null 2> /dev/null && return 0 prog="$mydir/$prog" test -x "$prog" && return 0 prog="$mydir/$1" test -x "$prog" && return 0 prog=`echo $1 | sed "$program_transform_name"` + which $prog > /dev/null 2> /dev/null && return 0 return 1 } @@ -95,7 +95,7 @@ main () CC="$prog" fi - # Find readelf. Any old readelf should do. We only want to read syms. + # Find readelf. Any old readelf should do. find_prog readelf if test $? -ne 0; then if which readelf > /dev/null 2> /dev/null; then @@ -119,8 +119,13 @@ 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'` + # 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=`echo ${relas}` # Build embedded SPU image. # 1. The whole SPU ELF file is written to .rodata.speelf @@ -135,21 +140,18 @@ main () # 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. + # 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} - <