Fix ppc g_o_t calc

Alan Modra amodra@bigpond.net.au
Tue Aug 2 23:13:00 GMT 2005


On Sat, Jul 30, 2005 at 10:36:49AM +0930, Alan Modra wrote:
> Writing out this table made me realize there is a bug in the current
> code for old layout >= 32780.  I'll fix it later today.

I did, then forgot to commit.  Done so now.

	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Correct value of
	_GLOBAL_OFFSET_TABLE_ for > 32k GOT.

Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.176
diff -u -p -r1.176 elf32-ppc.c
--- bfd/elf32-ppc.c	29 Jul 2005 02:46:03 -0000	1.176
+++ bfd/elf32-ppc.c	2 Aug 2005 07:51:09 -0000
@@ -4676,14 +4656,17 @@ ppc_elf_size_dynamic_sections (bfd *outp
     {
       unsigned int g_o_t = 32768;
 
-      /* If we haven't allocated the header, do so now.  */
+      /* If we haven't allocated the header, do so now.  When we get here,
+	 for old plt/got the got size will be 0 to 32764 (not allocated),
+	 or 32780 to 65536 (header allocated).  For new plt/got, the
+	 corresponding ranges are 0 to 32768 and 32780 to 65536.  */
       if (htab->got->size <= 32768)
 	{
 	  g_o_t = htab->got->size;
+	  if (htab->old_plt)
+	    g_o_t += 4;
 	  htab->got->size += htab->got_header_size;
 	}
-      if (htab->old_plt && !htab->is_vxworks)
-	g_o_t += 4;
 
       htab->elf.hgot->root.u.def.value = g_o_t;
     }

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list