Patchwork Fix array sizes created by Java FE (PR libgcj/57074)

login
register
mail settings
Submitter Alan Modra
Date May 6, 2013, 5:08 a.m.
Message ID <20130506050827.GD5221@bubble.grove.modra.org>
Download mbox | patch
Permalink /patch/241555/
State New
Headers show

Comments

Alan Modra - May 6, 2013, 5:08 a.m.
I'd really like to see this in, so that powerpc doesn't silently
generate wrong code.  Bootstrapped and regression tested
powerpc64-linux, with Jakub's java fixes applied.

	* varasm.c (output_object_block): Use .org for each item in
	section anchor block rather than padding.

Patch

Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 198274)
+++ gcc/varasm.c	(working copy)
@@ -7095,6 +7105,10 @@ 
   HOST_WIDE_INT offset;
   tree decl;
   rtx symbol;
+#if HAVE_GNU_AS
+  static int labelno;
+  char buf[30];
+#endif
 
   if (!block->objects)
     return;
@@ -7104,6 +7118,12 @@ 
   switch_to_section (block->sect);
   assemble_align (block->alignment);
 
+#if HAVE_GNU_AS
+  ASM_GENERATE_INTERNAL_LABEL (buf, "LANCB", labelno);
+  ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, buf);
+  ++labelno;
+#endif
+
   /* Define the values of all anchors relative to the current section
      position.  */
   FOR_EACH_VEC_SAFE_ELT (block->anchors, i, symbol)
@@ -7114,7 +7134,14 @@ 
   FOR_EACH_VEC_ELT (*block->objects, i, symbol)
     {
       /* Move to the object's offset, padding with zeros if necessary.  */
+#if HAVE_GNU_AS
+      fprintf (asm_out_file, "\t.org ");
+      assemble_name_raw (asm_out_file, buf);
+      fprintf (asm_out_file, "+" HOST_WIDE_INT_PRINT_DEC "\n",
+	       SYMBOL_REF_BLOCK_OFFSET (symbol));
+#else
       assemble_zeros (SYMBOL_REF_BLOCK_OFFSET (symbol) - offset);
+#endif
       offset = SYMBOL_REF_BLOCK_OFFSET (symbol);
       if (CONSTANT_POOL_ADDRESS_P (symbol))
 	{