The autoconf 2.69 upgrade broke Solaris/SPARC bootstrap with as:
compiling stage1 libgcc fails with an assembler error:

/usr/ccs/bin/as: "/var/tmp//ccYQ2Dxc.s", line 32: error: detect global register 
use not covered .register pseudo-op
/usr/ccs/bin/as: "/var/tmp//ccYQ2Dxc.s", line 32: error: detect global register 
use not covered .register pseudo-op

The line in question is

        srlx %g1,32,%g3

and comparing with older compiler output, I find that two lines were
lost:

-       .register       %g2, #scratch
-       .register       %g3, #scratch

They would be emitted by sparc.c (sparc_output_scratch_registers)
controlled by HAVE_AS_REGISTER_PSEUDO_OP.  Before the upgrade, this
would be 1 everywhere, now it's 0.  Checking gcc/config.log shows

configure:25347: checking assembler for .register
configure:25356: /usr/ccs/bin/as    -o conftest.o conftest.s >&5
/usr/ccs/bin/as: "conftest.s", line 1: error: statement syntax
configure:25359: $? = 1
configure: failed program was
.register %g2, #scratch[]
configure:25370: result: no

and indeed gcc/configure now contains those superfluous trailing
brackets for

      [.register %g2, #scratch],,

    $as_echo '.register %g2, #scratch'[] > conftest.s

I've found two more instances of this issue:

* One for ia64 in gcc_cv_as_ia64_ltoffx_ldxmov_relocs) ...

    $as_echo '  .text
        addl r15 = @ltoffx(x#), gp
        ;;
        ld8.mov r16 = [r15], x#'[] > conftest.s

* ... and another in a yet unsubmitted patch of mine to support
  SHF_MERGE with Solaris as.

This is an incompatible change autoconf -Wall doesn't warn about.  It
can be avoided/fixed by using the quadrigraph corresponding to '#',
'@%:@'.

However, for the sparc case there's an even simpler solution: the test
was originally introduced as a workaround when some Solaris 7 assembler
(the first one to support 64-bit SPARC) lacked the .register pseudo-op.
These days, with Solaris 10 the oldest supported Solaris release, both
the Solaris 10 FCS as and the gas 2.15 bundled with Solaris 10 support
.register, so there's no need to check for that.

While I refuse to even try bootstrapping with either of those now
ancient assemblers, I manually checked that both pass the test code from
the current test.

So the current patch removes both the autoconf test and the uses of the
macro.  Solaris 11/SPARC Bootstraps with both as and gas currently
running.  Ok for mainline if they pass?

        Rainer

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


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

        * configure.ac (gcc_cv_as_sparc_register_op): Remove.
        * configure: Regenerate.
        * config.in: Regenerate.
        * config/sparc/sparc.c (sparc_output_scratch_registers): Remove
        HAVE_AS_REGISTER_PSEUDO_OP guard.
        * config/sparc/sparc.h (ASM_ARCH64_SPEC): Remove
        !HAVE_AS_REGISTER_PSEUDO_OP support.
        (ASM_DECLARE_REGISTER_GLOBAL): Remove HAVE_AS_REGISTER_PSEUDO_OP
        guard.

# HG changeset patch
# Parent  9f1fd4adf7454b08bcb179652a217c48e17cfa08
Remove SPARC HAVE_AS_REGISTER_PSEUDO_OP

diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -5583,7 +5583,6 @@ sparc_initial_elimination_offset (int to
 void
 sparc_output_scratch_registers (FILE *file ATTRIBUTE_UNUSED)
 {
-#ifdef HAVE_AS_REGISTER_PSEUDO_OP
   int i;
 
   if (TARGET_ARCH32)
@@ -5604,7 +5603,6 @@ sparc_output_scratch_registers (FILE *fi
 	}
       if (i == 3) i = 5;
     }
-#endif
 }
 
 #define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -365,11 +365,7 @@ extern enum cmodel sparc_cmodel;
    This is what GAS uses.  Add %(asm_arch) to ASM_SPEC to enable.  */
 
 #define ASM_ARCH32_SPEC "-32"
-#ifdef HAVE_AS_REGISTER_PSEUDO_OP
 #define ASM_ARCH64_SPEC "-64 -no-undeclared-regs"
-#else
-#define ASM_ARCH64_SPEC "-64"
-#endif
 #define ASM_ARCH_DEFAULT_SPEC \
 (DEFAULT_ARCH32_P ? ASM_ARCH32_SPEC : ASM_ARCH64_SPEC)
 
@@ -1197,7 +1193,6 @@ init_cumulative_args (& (CUM), (FNTYPE),
 
 extern GTY(()) char sparc_hard_reg_printed[8];
 
-#ifdef HAVE_AS_REGISTER_PSEUDO_OP
 #define ASM_DECLARE_REGISTER_GLOBAL(FILE, DECL, REGNO, NAME)		\
 do {									\
   if (TARGET_ARCH64)							\
@@ -1216,8 +1211,6 @@ do {									\
 	  }								\
     }									\
 } while (0)
-#endif
-
 
 /* Emit rtl for profiling.  */
 #define PROFILE_HOOK(LABEL)   sparc_profile_hook (LABEL)
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4077,11 +4077,6 @@ EOF
     ;;
 
   sparc*-*-*)
-    gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,,
-      [.register %g2, #scratch],,
-      [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
-		[Define if your assembler supports .register.])])
-
     gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
       [-relax], [.text],,
       [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,

Reply via email to