Bootstrapping on Solaris/SPARC with /bin/as fails in make compare.  The
difference is always like this:

* With -gtoggle (stage2), there's no .text section in the assembler
  output.

* Without -gtoggle (stage3), the assembler output gets

--- table.s.gtoggle     2017-08-28 14:07:23.811292680 +0000
+++ table.s.no-gtoggle  2017-08-28 14:08:00.674764535 +0000
@@ -1,4 +1,6 @@
        .file   "table.adb"
+       .section        ".text"
+.LLtext0:
        .global table_E
        .section        ".data"
        .align 2
@@ -6,4 +8,43 @@
        .size   table_E, 2
 table_E:
        .skip 2
+       .section        ".text"
+.LLetext0:

While gas always adds a .text section, even for an empty imput file,
/bin/as on sparc does not, thus the difference, although it causes no
functional change.

The following patch (suggested by Richard in the PR) fixes this by
always emitting a text section in the callers of the assembly_start
debug hook so this works with and without -gtoggle.

Bootstrapped without regressions on sparc-sun-solaris2.11.

Ok for mainline (and eventually the gcc-7 branch)?

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2018-01-02  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        PR bootstrap/81926
        * cgraphunit.c (symbol_table::compile): Switch to text_section
        before calling assembly_start debug hook.
        * run-rtl-passes.c (run_rtl_passes): Likewise.
        Include output.h.

# HG changeset patch
# Parent  bc0a08bf40ebbf1975cb9dde9fd37b3183a8f6da
Avoid Solaris/SPARC comparison failures with Solaris as (PR bootstrap/81926)

diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2579,6 +2579,7 @@ symbol_table::compile (void)
   timevar_pop (TV_CGRAPHOPT);
 
   /* Output everything.  */
+  switch_to_section (text_section);
   (*debug_hooks->assembly_start) ();
   if (!quiet_flag)
     fprintf (stderr, "Assembling functions:\n");
diff --git a/gcc/run-rtl-passes.c b/gcc/run-rtl-passes.c
--- a/gcc/run-rtl-passes.c
+++ b/gcc/run-rtl-passes.c
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.  
 #include "bitmap.h"
 #include "df.h"
 #include "regs.h"
+#include "output.h"
 #include "debug.h" /* for debug_hooks.  */
 #include "insn-attr-common.h" /* for INSN_SCHEDULING.  */
 #include "insn-attr.h" /* for init_sched_attrs.  */
@@ -45,6 +46,7 @@ run_rtl_passes (char *initial_pass_name)
   max_regno = max_reg_num ();
 
   /* cgraphunit.c normally handles this.  */
+  switch_to_section (text_section);
   (*debug_hooks->assembly_start) ();
 
   /* Pass "expand" normally sets this up.  */

Reply via email to