]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Switch to HAVE_SOLARIS_AS
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Sun, 1 Mar 2026 17:04:03 +0000 (18:04 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Sun, 1 Mar 2026 17:04:03 +0000 (18:04 +0100)
The vast majority of the remaining uses of HAVE_GNU_AS are in
Solaris-specific code to distinguish uses of GNU as from Solaris as.
It's simpler to turn the check around, checking for Solaris as directly
instead.

The following patch does just that.

Bootstrapped without regressions on sparcv9-sun-solaris2.11,
amd64-pc-solaris2.11, sparc64-unknown-linux-gnu, and x86_64-pc-linux-gnu.

2026-02-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
* configure.ac (solaris_as): New check.
* configure: Regenerate.
* config.in: Regenerate.
* config/i386/i386.cc: Switch to HAVE_SOLARIS_AS.
* config/i386/sol2.h: Likewise.
* config/sol2.h: Likewise.
* config/sparc/sol2.h: Likewise.
* config/sparc/sparc.cc: Likewise.
* config/sparc/sparc.md: Likewise.

gcc/config.in
gcc/config/i386/i386.cc
gcc/config/i386/sol2.h
gcc/config/sol2.h
gcc/config/sparc/sol2.h
gcc/config/sparc/sparc.cc
gcc/config/sparc/sparc.md
gcc/configure
gcc/configure.ac

index faf382875dcd05e45a6bf04fa4ed8294473af2d3..6decd21a86fefd4ce72ac6f2b2915f2a2ee90c26 100644 (file)
 #endif
 
 
+/* Define to 1 if using the Solaris assembler. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_SOLARIS_AS
+#endif
+
+
 /* Define to 1 if you have the <stddef.h> header file. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_STDDEF_H
index acedc73b8252173625b887e8044d3c1511941e1a..dec8ae97bf3eb80dbdf2af85018993d84a57ed48 100644 (file)
@@ -25161,7 +25161,7 @@ i386_solaris_elf_named_section (const char *name, unsigned int flags,
       return;
     }
 
-#if !HAVE_GNU_AS
+#if HAVE_SOLARIS_AS
   if (HAVE_COMDAT_GROUP && flags & SECTION_LINKONCE)
     {
       solaris_elf_asm_comdat_section (name, flags, decl);
index 1fb07750b0a68c284f7cf62de4699d0f2aa7a104..3d271a7f5388c3853d8d4408f4deb0899723bfa2 100644 (file)
@@ -55,17 +55,15 @@ along with GCC; see the file COPYING3.  If not see
 #define CC1_SPEC "%(cc1_cpu) " ASAN_CC1_SPEC SCTF_CC1_SPEC \
   " %{mx32:%e-mx32 is not supported on Solaris}"
 
-/* GNU as understands --32 and --64, but the native Solaris
-   assembler requires -m32 or -m64 instead.  */
-#if HAVE_GNU_AS
-#define ASM_CPU32_DEFAULT_SPEC "--32"
-#define ASM_CPU64_DEFAULT_SPEC "--64"
-#else
+#if HAVE_SOLARIS_AS
 #define ASM_CPU32_DEFAULT_SPEC "-m32"
 #define ASM_CPU64_DEFAULT_SPEC "-m64"
+#else
+#define ASM_CPU32_DEFAULT_SPEC "--32"
+#define ASM_CPU64_DEFAULT_SPEC "--64"
 #endif
 
-#if !HAVE_GNU_AS
+#if HAVE_SOLARIS_AS
 /* Since Studio 12.6, as needs -xbrace_comment=no so its AVX512 syntax is
    fully compatible with gas.  */
 #define ASM_XBRACE_COMMENT_SPEC "-xbrace_comment=no"
@@ -145,7 +143,7 @@ along with GCC; see the file COPYING3.  If not see
       }                                                        \
   } while (0)
 
-#if !HAVE_GNU_AS
+#if HAVE_SOLARIS_AS
 /* The Sun assembler uses .tcomm for TLS common sections.  */
 #define TLS_COMMON_ASM_OP ".tcomm"
 
@@ -175,7 +173,7 @@ along with GCC; see the file COPYING3.  If not see
       ASM_OUTPUT_LABEL (FILE, NAME);                           \
     }                                                          \
   while (0)
-#endif /* !HAVE_GNU_AS */
+#endif /* HAVE_SOLARIS_AS */
 
 /* As in sparc/sol2.h, override the default from i386/x86-64.h to work
    around Sun as TLS bug.  */
@@ -206,13 +204,13 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Sun as requires "h" flag for large sections, GNU as can do without, but
    accepts "l".  */
-#if HAVE_GNU_AS
-#define MACH_DEP_SECTION_ASM_FLAG 'l'
-#else
+#if HAVE_SOLARIS_AS
 #define MACH_DEP_SECTION_ASM_FLAG 'h'
+#else
+#define MACH_DEP_SECTION_ASM_FLAG 'l'
 #endif
 
-#if !HAVE_GNU_AS
+#if HAVE_SOLARIS_AS
 /* Emit COMDAT group signature symbols for Sun as.  */
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END solaris_file_end
@@ -225,7 +223,7 @@ along with GCC; see the file COPYING3.  If not see
 #define DTORS_SECTION_ASM_OP   "\t.section\t.dtors, \"aw\""
 #endif
 
-#if !HAVE_GNU_AS
+#if HAVE_SOLARIS_AS
 #define LARGECOMM_SECTION_ASM_OP "\t.lbcomm\t"
 #endif
 
index 398aa383505abc9684514106c0a55ccc856e6e75..01d0a669618b8edb2467ce266377dae375d3cb31 100644 (file)
@@ -443,7 +443,7 @@ along with GCC; see the file COPYING3.  If not see
     }                                                          \
   while (0)
 
-#if !HAVE_GNU_AS
+#if HAVE_SOLARIS_AS
 #undef TARGET_ASM_ASSEMBLE_VISIBILITY
 #define TARGET_ASM_ASSEMBLE_VISIBILITY solaris_assemble_visibility
 
index d964c3ea727bb7a4d476c98babcbd16edfab2a2f..48f0308ee086a7f2fb85e67d1759785c50a36ba0 100644 (file)
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3.  If not see
 /* We switch to the explicit word size selection mechanism available both in
    GNU as and Sun as, for the Niagara4 and above configurations.  */
 
-#if !HAVE_GNU_AS
+#if HAVE_SOLARIS_AS
 #undef ASM_ARCH32_SPEC
 #define ASM_ARCH32_SPEC "-m32"
 #undef ASM_ARCH64_SPEC
@@ -337,7 +337,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
     }                                                                  \
   while (0)
 
-#if !HAVE_GNU_AS
+#if HAVE_SOLARIS_AS
 /* This is how to output an assembler line that says to advance
    the location counter to a multiple of 2**LOG bytes using the
    NOP instruction as padding.  The filler pattern doesn't work
@@ -353,7 +353,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
 /* Sun as requires doublequoted section names on SPARC.  While GNU as
    supports that, too, we prefer the standard variant.  */
 #define SECTION_NAME_FORMAT    "\"%s\""
-#endif /* !HAVE_GNU_AS */
+#endif /* HAVE_SOLARIS_AS */
 
 /* Undefine this so that attribute((init_priority)) works with GNU ld.  */
 #if HAVE_GNU_LD
index 47559dbe2cd135607b51ecf13e874d5e0ffabfff..47783fdeed96957edf01031b016aea89d100fd29 100644 (file)
@@ -877,7 +877,7 @@ char sparc_hard_reg_printed[8];
 #define TARGET_STACK_PROTECT_GUARD hook_tree_void_null
 #endif
 
-#if HAVE_GNU_AS
+#if !HAVE_SOLARIS_AS
 #undef TARGET_ASM_OUTPUT_DWARF_DTPREL
 #define TARGET_ASM_OUTPUT_DWARF_DTPREL sparc_output_dwarf_dtprel
 #endif
@@ -4689,7 +4689,7 @@ sparc_tls_got (void)
 
   /* In non-PIC mode, Sun as (unlike GNU as) emits PC-relative relocations for
      the GOT symbol with the 32-bit ABI, so we reload the GOT register.  */
-  if (!HAVE_GNU_AS && TARGET_ARCH32)
+  if (HAVE_SOLARIS_AS && TARGET_ARCH32)
     {
       load_got_register ();
       return got_register_rtx;
@@ -4793,7 +4793,7 @@ sparc_legitimize_tls_address (rtx addr)
          emit_insn (gen_tie_ld32 (temp3, got, temp2, addr));
        else
          emit_insn (gen_tie_ld64 (temp3, got, temp2, addr));
-       if (!HAVE_GNU_AS)
+       if (HAVE_SOLARIS_AS)
          {
            ret = gen_reg_rtx (Pmode);
            emit_insn (gen_tie_add (Pmode, ret, gen_rtx_REG (Pmode, 7),
index 608f96100a055e05a45901c6800c0e0e176e0bcf..4740e255c2956855d7e9121f9bf905cbabcef532 100644 (file)
 
 ;; Attributes for branch scheduling
 (define_attr "tls_delay_slot" "false,true"
-  (symbol_ref "((HAVE_GNU_AS && HAVE_GNU_LD) != 0
+  (symbol_ref "((!HAVE_SOLARIS_AS && HAVE_GNU_LD) != 0
                ? TLS_DELAY_SLOT_TRUE : TLS_DELAY_SLOT_FALSE)"))
 
 (define_attr "in_sibcall_delay" "false,true"
                (unspec:P [(match_operand:P 2 "register_operand" "r")
                           (match_operand 3 "tie_symbolic_operand" "")]
                          UNSPEC_TLSIE)))]
-  "!HAVE_GNU_AS"
+  "HAVE_SOLARIS_AS"
   "add\\t%1, %2, %0, %%tie_add(%a3)")
 
 (define_insn "@tle_hix22<P:mode>"
index 7dc17f4cc205802473c1b9c4e4aebf59b2e2ab37..3d9521f8d7549d3d8340d7accd55ee502ad1c523 100755 (executable)
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Solaris assembler" >&5
+$as_echo_n "checking Solaris assembler... " >&6; }
+case $target in
+  *-*-solaris2*)
+    if $gcc_cv_as -V 2>&1 | grep 'Compiler Common.*SunOS' > /dev/null; then
+      solaris_as=yes
+      gas_flag=no
+    elif $gcc_cv_as --version 2>/dev/null | grep GNU > /dev/null; then
+      gas_flag=yes
+    fi
+    ;;
+  *)
+    solaris_as=no
+    ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $solaris_as" >&5
+$as_echo "$solaris_as" >&6; }
+solaris_as_bool=`if test $solaris_as = yes; then echo 1; else echo 0; fi`
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SOLARIS_AS $solaris_as_bool
+_ACEOF
+
+
 ORIGINAL_AS_FOR_TARGET=$gcc_cv_as
 
 case "$ORIGINAL_AS_FOR_TARGET" in
index a10d714a3c9cfbf4c18db708261c9a48f35c01c4..466fc388f254d8f153b0d789d5679dae0b4a9cf5 100644 (file)
@@ -2736,6 +2736,25 @@ gas_flag="$with_gnu_as",
    gas_flag=no
 fi])
 
+AC_MSG_CHECKING(Solaris assembler)
+case $target in
+  *-*-solaris2*)
+    if $gcc_cv_as -V 2>&1 | grep 'Compiler Common.*SunOS' > /dev/null; then
+      solaris_as=yes
+      gas_flag=no
+    elif $gcc_cv_as --version 2>/dev/null | grep GNU > /dev/null; then
+      gas_flag=yes
+    fi
+    ;;
+  *)
+    solaris_as=no
+    ;;
+esac
+AC_MSG_RESULT($solaris_as)
+solaris_as_bool=`if test $solaris_as = yes; then echo 1; else echo 0; fi`
+AC_DEFINE_UNQUOTED(HAVE_SOLARIS_AS, $solaris_as_bool,
+       [Define to 1 if using the Solaris assembler.])
+
 ORIGINAL_AS_FOR_TARGET=$gcc_cv_as
 AC_SUBST(ORIGINAL_AS_FOR_TARGET)
 case "$ORIGINAL_AS_FOR_TARGET" in