This is the mail archive of the 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: powerpc64 toc pointer value

How many different ways can I get this wrong?  The last patch blew up
on ld -r when .TOC. stayed bfd_link_hash_new.  Really, we don't want
to change anything for a relocatable link, and it's cleaner to make
all the type/value changes in ppc64_elf_set_toc.  (Making the symbol
bfd_link_hash_new was a misguided attempt to have it stripped when

	* elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't hide .TOC.
	when relocatable.  Don't change root.type or type here.
	(ppc64_elf_set_toc): Set type of .TOC. to STT_OBJECT.

Index: bfd/elf64-ppc.c
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.415
diff -u -p -r1.415 elf64-ppc.c
--- bfd/elf64-ppc.c	3 Jul 2013 02:22:35 -0000	1.415
+++ bfd/elf64-ppc.c	3 Jul 2013 09:20:34 -0000
@@ -6547,12 +6547,9 @@ ppc64_elf_func_desc_adjust (bfd *obfd AT
   if (htab == NULL)
     return FALSE;
-  if (htab->elf.hgot != NULL)
-    {
-      htab->elf.hgot->root.type = bfd_link_hash_new;
-      htab->elf.hgot->type = STT_OBJECT;
-      _bfd_elf_link_hash_hide_symbol (info, htab->elf.hgot, TRUE);
-    }
+  if (!info->relocatable
+      && htab->elf.hgot != NULL)
+    _bfd_elf_link_hash_hide_symbol (info, htab->elf.hgot, TRUE);
   if (htab->sfpr == NULL)
     /* We don't have any relocs.  */
@@ -11917,6 +11900,7 @@ ppc64_elf_set_toc (struct bfd_link_info 
       if (htab != NULL
 	  && htab->elf.hgot != NULL)
+	  htab->elf.hgot->type = STT_OBJECT;
 	  htab->elf.hgot->root.type = bfd_link_hash_defined;
 	  htab->elf.hgot->root.u.def.value = TOC_BASE_OFF;
 	  htab->elf.hgot->root.u.def.section = s;

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]