This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

embedspu reloc section parsing


embedspu needs to translate certain relocations in an SPU executable
into ppc relocs against the executable image.  One of the difficulties
in doing this is that relocs in an executable are at VMAs, so a reloc
VMA needs to be translated to a file offset.  embedspu does this by
noticing the 'Relocation section .. at offset 0x' output from
readelf -R.  It then uses the offset to index a table containing the
sh_info for reloc sections, to find the section to which the reloc
applies.  Finally, this section number indexs another table containing
vma to file offsets.

I've just discovered that the sh_info table is bogus when SPU
executables contain more than 10 sections.  This fixes the errant
sed command.

	* embedspu.sh (relas): Correct sh_info parsing.

Index: binutils/embedspu.sh
===================================================================
RCS file: /cvs/src/src/binutils/embedspu.sh,v
retrieving revision 1.9
diff -u -p -r1.9 embedspu.sh
--- binutils/embedspu.sh	18 Jun 2007 02:09:20 -0000	1.9
+++ binutils/embedspu.sh	21 Jun 2007 00:26:49 -0000
@@ -124,7 +124,7 @@ main ()
   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'`
   relas=`echo ${relas}`
 
   # Build embedded SPU image.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]