powerpc64 fails new ld-elf/warn2 test

Alan Modra amodra@bigpond.net.au
Wed Nov 8 11:20:00 GMT 2006


The new warning section test fails on powerpc64 and spu.  One reason
is that the warning section is not stripped from the output, due to
these targets sizing output sections early.  (Actually, powerpc64
doesn't size sections early on the testcase, but does so in other
situations.)  Another reason for the failure was that powerpc64
creates another output section and the global sym defined in the
warning section ends up being relative to that section rather than
.text.  This patch fixes both of these problems.

ld/
	* emultempl/elf32.em (gld*_before_allocation): Adjust output section
	size for warning sections.
ld/testsuite/
	* ld-elf/group.ld: Handle .rodata.brlt for powerpc64.

Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.173
diff -u -p -r1.173 elf32.em
--- ld/emultempl/elf32.em	6 Nov 2006 10:39:17 -0000	1.173
+++ ld/emultempl/elf32.em	8 Nov 2006 10:56:04 -0000
@@ -1204,12 +1204,19 @@ ${ELF_INTERPRETER_SET_DEFAULT}
 	ASSERT (ret);
 	free (msg);
 
-	/* Clobber the section size, so that we don't waste copying the
-	   warning into the output file.  */
+	/* Clobber the section size, so that we don't waste space
+	   copying the warning into the output file.  If we've already
+	   sized the output section, adjust its size.  The adjustment
+	   is on rawsize because targets that size sections early will
+	   have called lang_reset_memory_regions after sizing.  */
+	if (s->output_section != NULL
+	    && s->output_section->rawsize >= s->size)
+	  s->output_section->rawsize -= s->size;
+
 	s->size = 0;
 
-	/* Also set SEC_EXCLUDE, so that symbols defined in the warning
-	   section don't get copied to the output.  */
+	/* Also set SEC_EXCLUDE, so that local symbols defined in the
+	   warning section don't get copied to the output.  */
 	s->flags |= SEC_EXCLUDE | SEC_KEEP;
       }
   }
Index: ld/testsuite/ld-elf/group.ld
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elf/group.ld,v
retrieving revision 1.1
diff -u -p -r1.1 group.ld
--- ld/testsuite/ld-elf/group.ld	1 Dec 2004 23:23:12 -0000	1.1
+++ ld/testsuite/ld-elf/group.ld	8 Nov 2006 05:13:51 -0000
@@ -1,5 +1,5 @@
 SECTIONS
 {
   . = 0x1000;
-  .text : { *(.text) }
+  .text : { *(.text) *(.rodata.brlt) }
 }

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list