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]

powerpc64 automatic multiple toc vs. ld -r

I noticed recently that the code that partitions .got and .toc
sections into toc groups would mistakenly complain with "linker script
separates .got and .toc" if a new group was found to be needed for
anything but the first section of an input file containing multiple
.got/.toc sections.  In practise this only happens if you deliberately
create multiple .toc sections, eg. ld -r --unique=*, since .got is
linker created.

	* elf64-ppc.c (ppc64_elf_next_toc_section): Don't error if input
	file has multiple .got/.toc sections and all don't fit in
	current toc group.

Index: bfd/elf64-ppc.c
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.388
diff -u -p -r1.388 elf64-ppc.c
--- bfd/elf64-ppc.c	22 Jun 2012 05:53:04 -0000	1.388
+++ bfd/elf64-ppc.c	25 Jun 2012 14:58:26 -0000
@@ -10554,7 +10554,9 @@ ppc64_elf_next_toc_section (struct bfd_l
   if (!htab->second_toc_pass)
       /* Keep track of the first .toc or .got section for this input bfd.  */
-      if (htab->toc_bfd != isec->owner)
+      bfd_boolean new_bfd = htab->toc_bfd != isec->owner;
+      if (new_bfd)
 	  htab->toc_bfd = isec->owner;
 	  htab->toc_first_sec = isec;
@@ -10582,7 +10584,8 @@ ppc64_elf_next_toc_section (struct bfd_l
       /* Die if someone uses a linker script that doesn't keep input
 	 file .toc and .got together.  */
-      if (elf_gp (isec->owner) != 0
+      if (new_bfd
+	  && elf_gp (isec->owner) != 0
 	  && elf_gp (isec->owner) != off)
 	return FALSE;

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]