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]

SPU soft-icache address encoding


Off by one error.

	* elf32-spu.c (build_stub): Correct icache set_id.
	(spu_elf_relocate_section): Likewise.

Index: bfd/elf32-spu.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-spu.c,v
retrieving revision 1.65
diff -u -p -r1.65 elf32-spu.c
--- bfd/elf32-spu.c	11 Mar 2009 00:18:02 -0000	1.65
+++ bfd/elf32-spu.c	14 Mar 2009 23:02:44 -0000
@@ -1330,7 +1330,7 @@ build_stub (struct bfd_link_info *info,
 
       bfd_put_32 (sec->owner, dest_ovl - 1,
 		  sec->contents + sec->size + 0);
-      set_id = (dest_ovl - 1) >> htab->num_lines_log2;
+      set_id = ((dest_ovl - 1) >> htab->num_lines_log2) + 1;
       bfd_put_32 (sec->owner, (set_id << 18) | (dest & 0x3ffff),
 		  sec->contents + sec->size + 4);
       bfd_put_32 (sec->owner, (lrlive << 29) | (g->br_addr & 0x3ffff),
@@ -4768,9 +4768,9 @@ spu_elf_relocate_section (bfd *output_bf
 	      unsigned int ovl = overlay_index (sec);
 	      if (ovl != 0)
 		{
-		  unsigned int set_id = (ovl - 1) >> htab->num_lines_log2;
+		  unsigned int set_id = ((ovl - 1) >> htab->num_lines_log2) + 1;
 		  relocation += set_id << 18;
-		  overlay_encoded = set_id != 0;
+		  overlay_encoded = TRUE;
 		}
 	    }
 	}

-- 
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]