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]

Re: Two new spu features


Nothing but tweaks really.  I don't think the ._ea section can be
accessed unless there are R_SPU_PPU relocs pointing to it, so testing
for ._ea via relocs ought to work well.  However, the indirect scheme
is less obvious and doesn't gain us anything.  The section name must
be present otherwise we won't get the special relocs out of ld.

bfd/
	* elf32-spu.c (spu_elf_relocate_section): Rename is_ea to is_ea_sym.
binutils/
	* embedspu.sh: Test for presence of ._ea by looking at section
	table rather than looking at relocs.  Correct toe_addr substitution.


Index: bfd/elf32-spu.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-spu.c,v
retrieving revision 1.40
diff -u -p -r1.40 elf32-spu.c
--- bfd/elf32-spu.c	7 May 2008 14:46:44 -0000	1.40
+++ bfd/elf32-spu.c	12 May 2008 09:17:47 -0000
@@ -3891,7 +3891,7 @@ spu_elf_relocate_section (bfd *output_bf
   asection *ea = bfd_get_section_by_name (output_bfd, "._ea");
   int ret = TRUE;
   bfd_boolean emit_these_relocs = FALSE;
-  bfd_boolean is_ea;
+  bfd_boolean is_ea_sym;
   bfd_boolean stubs;
 
   htab = spu_hash_table (info);
@@ -3955,12 +3955,13 @@ spu_elf_relocate_section (bfd *output_bf
       if (info->relocatable)
 	continue;
 
-      is_ea = (ea != NULL
-	       && sec != NULL
-	       && sec->output_section == ea);
+      is_ea_sym = (ea != NULL
+		   && sec != NULL
+		   && sec->output_section == ea);
+
       if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64)
 	{
-	  if (is_ea)
+	  if (is_ea_sym)
 	    {
 	      /* ._ea is a special section that isn't allocated in SPU
 		 memory, but rather occupies space in PPU memory as
@@ -3977,7 +3978,7 @@ spu_elf_relocate_section (bfd *output_bf
 	  continue;
 	}
 
-      if (is_ea)
+      if (is_ea_sym)
 	unresolved_reloc = TRUE;
 
       if (unresolved_reloc)
Index: binutils/embedspu.sh
===================================================================
RCS file: /cvs/src/src/binutils/embedspu.sh,v
retrieving revision 1.12
diff -u -p -r1.12 embedspu.sh
--- binutils/embedspu.sh	7 May 2008 14:46:44 -0000	1.12
+++ binutils/embedspu.sh	12 May 2008 09:17:56 -0000
@@ -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

-- 
Alan Modra
Australia Development Lab, IBM


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