[v2,2/6] build: Remove $gas

Message ID ydd4iklq7sr.fsf_-_@CeBiTec.Uni-Bielefeld.DE
State New
Headers
Series [v2,1/6] Remove HAVE_GNU_AS |

Checks

Context Check Description
rivoscibot/toolchain-ci-rivos-lint success Lint passed
rivoscibot/toolchain-ci-rivos-apply-patch fail Patch failed to apply

Commit Message

Rainer Orth May 6, 2026, 8:08 a.m. UTC
  Hi Alex,

> On Apr 29, 2026, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:
>
>> * The check in configure.ac to require gas on mips*-*-*, loongarch*-*,
>>   and *-*-hpux* can be done unconditionally.
>
> This makes me a little worried that we will error out in cases we didn't
> because the targets set gas=yes as a given.  No biggie, one can always
> use a configure flag to work around that, but it makes me wonder if
> dropping that prior knowledge is really desirable.
>
> No objections, though.
>
>> 	gcc:
>> 	* config.gcc <ia64*-*-elf*> (target_cpu_defaults): Always add
>> 	MASK_GNU_AS.
>> 	<ia64-hp-*vms*>: Likewise.
>> 	<hppa*-*-*> (target_cpu_default2): Always add MASK_GAS.
>> 	(gas): Remove.
>> 	* acinclude.m4 (gcc_GAS_FLAGS): Check solaris_as instead of gas.
>> 	* configure.ac: Don't set gas.
>> 	* configure: Regenerate.

compared to the v1 patch, this revision checks the new as_flavor instead
of solaris_as.

Ok for trunk?

	Rainer
  

Patch

# HG changeset patch
# Parent  58258bddc64283fb44a68570871274315e4543bd
build: Remove $gas

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -461,7 +461,7 @@  dnl # Used by gcc_GAS_CHECK_FEATURE
 dnl #
 AC_DEFUN([gcc_GAS_FLAGS],
 [AC_CACHE_CHECK([assembler flags], gcc_cv_as_flags,
-[ case "$target:$gas" in
+[ case "$target:$as_flavor" in
   *-*-darwin*:*)
     dnl Darwin with the native assembler uses -arch i386/x86_64/ppc/ppc64.
     dnl
@@ -489,7 +489,7 @@  AC_DEFUN([gcc_GAS_FLAGS],
 	;;
     esac
     ;;
-  *-*-solaris2*:no)
+  *-*-solaris2*:solaris)
     dnl Solaris with the native assembler uses -m32/-m64 consistently.
     case "$target" in
       i?86-*-* | sparc-*-*)
diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -179,9 +179,6 @@ 
 #
 #  thread_file		Set to control which thread package to use.
 #
-#  gas			Set to yes or no depending on whether the target
-#			system normally uses GNU as.
-#
 #  configure_default_options
 #			Set to an initializer for configure_default_options
 #			in configargs.h, based on --with-cpu et cetera.
@@ -252,9 +249,6 @@  target_cpu_default=
 gdb_needs_out_file_path=
 # Set this to control which thread package will be used.
 thread_file=
-# Reinitialize these from the flag values every loop pass, since some
-# configure entries modify them.
-gas="$gas_flag"
 gnu_ld="$gnu_ld_flag"
 default_use_cxa_atexit=no
 default_gnu_indirect_function=no
@@ -855,7 +849,6 @@  case ${target} in
   esac
   ;;
 *-*-dragonfly*)
-  gas=yes
   gnu_ld=yes
   tmake_file="t-slibgcc"
   case ${enable_threads} in
@@ -895,7 +888,6 @@  case ${target} in
   # The machine-specific section should not tamper with this
   # ordering but may order all other entries of tm_file as it
   # pleases around the provided core setting.
-  gas=yes
   gnu_ld=yes
   fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'`
   if test "$fbsd_major" = ""; then
@@ -940,7 +932,6 @@  case ${target} in
   ;;
 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi)
   extra_options="$extra_options gnu-user.opt"
-  gas=yes
   gnu_ld=yes
   case ${enable_threads} in
     "" | yes | posix) thread_file='posix' ;;
@@ -1029,7 +1020,6 @@  case ${target} in
   tmake_file="t-netbsd t-slibgcc"
   extra_objs="${extra_objs} netbsd.o"
   d_target_objs="${d_target_objs} netbsd-d.o"
-  gas=yes
   gnu_ld=yes
   use_gcc_stdint=wrap
   case ${enable_threads} in
@@ -1064,7 +1054,6 @@  case ${target} in
   target_has_targetrustm=yes
   ;;
 *-*-phoenix*)
-  gas=yes
   gnu_ld=yes
   default_use_cxa_atexit=yes
   ;;
@@ -1750,7 +1739,6 @@  bpf-*-*)
 cris-*-elf | cris-*-none)
 	tm_file="elfos.h newlib-stdint.h ${tm_file}"
 	tmake_file="cris/t-cris cris/t-elfmulti"
-	gas=yes
 	extra_options="${extra_options} cris/elf.opt"
 	use_gcc_stdint=wrap
 	;;
@@ -1851,7 +1839,6 @@  frv-*-*linux*)
 	tmake_file="${tmake_file} frv/t-frv frv/t-linux"
 	;;
 ft32-*-elf)
-	gas=yes
 	gnu_ld=yes
 	tm_file="elfos.h newlib-stdint.h ${tm_file}"
 	tmake_file="${tmake_file} ft32/t-ft32"
@@ -1879,13 +1866,11 @@  amdgcn-*-amdhsa)
 	thread_file=gcn
 	;;
 moxie-*-elf)
-	gas=yes
 	gnu_ld=yes
 	tm_file="elfos.h newlib-stdint.h ${tm_file}"
 	tmake_file="${tmake_file} moxie/t-moxie"
 	;;
 moxie-*-uclinux*)
-	gas=yes
 	gnu_ld=yes
 	tm_file="elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h moxie/uclinux.h"
 	tmake_file="${tmake_file} moxie/t-moxie"
@@ -1895,7 +1880,6 @@  moxie-*-rtems*)
 	tm_file="moxie/moxie.h elfos.h moxie/rtems.h rtems.h newlib-stdint.h"
 	;;
 moxie-*-moxiebox*)
-	gas=yes
 	gnu_ld=yes
 	tm_file="${tm_file} elfos.h moxie/moxiebox.h newlib-stdint.h"
 	tmake_file="${tmake_file} moxie/t-moxiebox"
@@ -1915,7 +1899,7 @@  hppa*64*-*-linux*)
 		 pa/pa64-linux.h"
 	tmake_file="${tmake_file} pa/t-pa pa/t-linux"
 	d_target_objs="${d_target_objs} pa-d.o"
-	gas=yes gnu_ld=yes
+	gnu_ld=yes
 	;;
 hppa*-*-linux*)
 	target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS|MASK_CALLER_COPIES"
@@ -1931,7 +1915,6 @@  hppa*-*-openbsd*)
 	extra_options="${extra_options} openbsd.opt"
 	tmake_file="pa/t-pa"
 	d_target_objs="${d_target_objs} pa-d.o"
-	gas=yes
 	gnu_ld=yes
 	;;
 hppa*-*-netbsd*)
@@ -1973,7 +1956,6 @@  hppa*64*-*-hpux11*)
 		thread_file=posix
 		;;
 	esac
-	gas=yes
 	case ${target} in
 	  *-*-hpux11.[01]*)
 		use_gcc_stdint=provide
@@ -2052,14 +2034,12 @@  i[34567]86-*-openbsd*)
 	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h"
 	tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h"
 	extra_options="${extra_options} openbsd.opt"
-	gas=yes
 	gnu_ld=yes
 	;;
 x86_64-*-openbsd*)
 	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h"
 	tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/x86-64.h i386/openbsdelf.h"
 	extra_options="${extra_options} openbsd.opt"
-	gas=yes
 	gnu_ld=yes
 	;;
 i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
@@ -2167,7 +2147,6 @@  i[34567]86-pc-msdosdjgpp*)
 	native_system_header_dir=/dev/env/DJDIR/include
 	extra_options="${extra_options} i386/djgpp.opt"
 	gnu_ld=yes
-	gas=yes
 	use_gcc_stdint=wrap
 	;;
 i[34567]86-*-lynxos*)
@@ -2177,13 +2156,11 @@  i[34567]86-*-lynxos*)
 	extra_options="${extra_options} lynx.opt"
 	thread_file=lynx
 	gnu_ld=yes
-	gas=yes
 	;;
 i[34567]86-*-nto-qnx*)
 	tm_file="${tm_file} i386/att.h tm-dwarf2.h elfos.h i386/unix.h i386/nto.h"
 	extra_options="${extra_options} i386/nto.opt"
 	gnu_ld=yes
-	gas=yes
 	;;
 i[34567]86-*-rtems*)
 	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h i386/i386elf.h i386/rtemself.h rtems.h newlib-stdint.h"
@@ -2354,7 +2331,6 @@  i[34567]86-*-mingw* | x86_64-*-mingw*)
 	extra_objs="${extra_objs} winnt.o winnt-stubs.o winnt-dll.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
-	gas=yes
 	gnu_ld=yes
 	default_use_cxa_atexit=yes
 	use_gcc_stdint=wrap
@@ -2382,10 +2358,7 @@  ia64*-*-elf*)
 	tm_file="${tm_file} elfos.h newlib-stdint.h ia64/sysv4.h ia64/elf.h"
 	tmake_file="ia64/t-ia64"
 	target_cpu_default="0"
-	if test x$gas = xyes
-	then
-		target_cpu_default="${target_cpu_default}|MASK_GNU_AS"
-	fi
+	target_cpu_default="${target_cpu_default}|MASK_GNU_AS"
 	if test x$gnu_ld = xyes
 	then
 		target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
@@ -2429,10 +2402,7 @@  ia64-hp-*vms*)
 	tm_file="${tm_file} elfos.h ia64/sysv4.h vms/vms.h ia64/vms.h"
 	tmake_file="${tmake_file} ia64/t-ia64"
 	target_cpu_default="0"
-	if test x$gas = xyes
-	then
-		target_cpu_default="${target_cpu_default}|MASK_GNU_AS"
-	fi
+	target_cpu_default="${target_cpu_default}|MASK_GNU_AS"
 	extra_options="${extra_options} ia64/vms.opt"
 	;;
 iq2000*-*-elf*)
@@ -2586,7 +2556,6 @@  riscv*-*-linux*)
 	tmake_file="${tmake_file} riscv/t-riscv riscv/t-linux"
 	tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
 	gnu_ld=yes
-	gas=yes
 	case $target in
 	riscv32be-*|riscv64be-*)
 		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
@@ -2601,7 +2570,6 @@  riscv*-*-gnu*)
 	tm_file="elfos.h gnu-user.h gnu.h glibc-stdint.h ${tm_file} riscv/gnu.h"
 	tmake_file="${tmake_file} riscv/t-riscv"
 	gnu_ld=yes
-	gas=yes
 	case $target in
 	riscv32be-*|riscv64be-*)
 		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
@@ -2629,7 +2597,6 @@  riscv*-*-elf* | riscv*-*-rtems*)
 	esac
 	tmake_file="${tmake_file} riscv/t-riscv"
 	gnu_ld=yes
-	gas=yes
 	case $target in
 	riscv32be-*|riscv64be-*)
 		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
@@ -2643,7 +2610,6 @@  riscv*-*-freebsd*)
 	tm_file="${tm_file} elfos.h ${fbsd_tm_file} riscv/freebsd.h"
 	tmake_file="${tmake_file} riscv/t-riscv"
 	gnu_ld=yes
-	gas=yes
 	case $target in
 	riscv32be-*|riscv64be-*)
 		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
@@ -2664,7 +2630,6 @@  loongarch*-*-linux*)
 	extra_options="${extra_options} linux-android.opt"
 	tmake_file="${tmake_file} loongarch/t-multilib loongarch/t-linux"
 	gnu_ld=yes
-	gas=yes
 
 	# Force .init_array support.  The configure script cannot always
 	# automatically detect that GAS supports it, yet we require it.
@@ -2676,7 +2641,6 @@  loongarch*-*-elf*)
 	tm_file="${tm_file} loongarch/elf.h loongarch/loongarch-driver.h"
 	tmake_file="${tmake_file} loongarch/t-multilib"
 	gnu_ld=yes
-	gas=yes
 
 	# For .init_array support.  The configure script cannot always
 	# automatically detect that GAS supports it, yet we require it.
@@ -2696,7 +2660,6 @@  mips*-img-linux*)
 	with_arch_32="mips32r6"
 	with_arch_64="mips64r6"
 	gnu_ld=yes
-	gas=yes
 	;;
 mips*-mti-linux*)
 	tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h mips/mti-linux.h"
@@ -2706,7 +2669,6 @@  mips*-mti-linux*)
 	with_arch_32="mips32r2"
 	with_arch_64="mips64r2"
 	gnu_ld=yes
-	gas=yes
 	;;
 mips*-*-linux*)				# Linux MIPS, either endian.
 	tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h"
@@ -3246,7 +3208,6 @@  powerpc-*-lynxos*)
 	extra_options="${extra_options} rs6000/sysv4.opt lynx.opt"
 	thread_file=lynx
 	gnu_ld=yes
-	gas=yes
 	;;
 powerpcle-*-elf*)
 	tm_file="${tm_file} elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h"
@@ -3610,7 +3571,7 @@  sparc64-*-openbsd*)
 	tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h sparc/openbsd64.h"
 	extra_options="${extra_options} openbsd.opt"
 	extra_options="${extra_options}"
-	gas=yes gnu_ld=yes
+	gnu_ld=yes
 	with_cpu=ultrasparc
 	tmake_file="${tmake_file} sparc/t-sparc"
 	;;
@@ -3702,7 +3663,7 @@  xtensa*-*-uclinux*)
 	;;
 am33_2.0-*-linux*)
 	tm_file="mn10300/mn10300.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h"
-	gas=yes gnu_ld=yes
+	gnu_ld=yes
 	use_collect2=no
 	;;
 m32c-*-elf*)
@@ -6097,10 +6058,7 @@  case ${target} in
 		;;
 
 	hppa*-*-*)
-		if test x$gas = xyes
-		then
-			target_cpu_default2="MASK_GAS"
-		fi
+		target_cpu_default2="MASK_GAS"
 		;;
 
 	fido*-*-* | m68k*-*-*)
diff --git a/gcc/configure b/gcc/configure
--- a/gcc/configure
+++ b/gcc/configure
@@ -25498,34 +25498,23 @@  case $target in
   *-*-aix*)
     if $gcc_cv_as -v 2>&1 | grep '^as V' > /dev/null; then
       as_flavor=aix
-      gas=no
-    else
-      gas=yes
     fi
     ;;
   *-*-darwin*)
     as_flavor=darwin
-    gas=no
     ;;
   *-*-solaris2*)
     if $gcc_cv_as -V 2>&1 | grep 'Compiler Common.*SunOS' > /dev/null; then
       as_flavor=solaris
-      gas=no
-    else
-      gas=yes
     fi
     ;;
   hppa*64*-*-hpux11*)
     if $gcc_cv_as -V 2>&1 | grep 'UX.11.*PA-RISC.*Assembler' > /dev/null; then
       as_flavor=hpux
-      gas=no
-    else
-      gas=yes
     fi
     ;;
   nvptx-*-*)
     as_flavor=nvptx
-    gas=no
     ;;
 esac
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $as_flavor" >&5
@@ -25551,15 +25540,6 @@  case "$ORIGINAL_AS_FOR_TARGET" in
  ;;
 esac
 
-# Check if we are using GNU as if not already set.
-if test -z "$gas"; then
-  if $gcc_cv_as --version 2>/dev/null | grep GNU > /dev/null; then
-    gas=yes
-  else
-    gas=no
-  fi
-fi
-
 if $gcc_cv_as --help 2>&1 | grep -- --fatal-warnings > /dev/null; then
   fw_as_opt=--fatal-warnings
 fi
@@ -26256,7 +26236,7 @@  $as_echo_n "checking assembler flags... 
 if ${gcc_cv_as_flags+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-   case "$target:$gas" in
+   case "$target:$as_flavor" in
   *-*-darwin*:*)
                         case "$target" in
       i?86-*-*)
@@ -26279,7 +26259,7 @@  else
 	;;
     esac
     ;;
-  *-*-solaris2*:no)
+  *-*-solaris2*:solaris)
         case "$target" in
       i?86-*-* | sparc-*-*)
 	gcc_cv_as_flags=-m32
@@ -31801,8 +31781,7 @@  esac
 
 case "$target" in
   mips*-*-* | loongarch*-*-* | *-*-hpux* )
-    if test x$gas = xyes \
-       || test x"$host" != x"$build" \
+    if test x"$host" != x"$build" \
        || test ! -x "$gcc_cv_as" \
        || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then
       :
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2741,34 +2741,23 @@  case $target in
   *-*-aix*)
     if $gcc_cv_as -v 2>&1 | grep '^as V' > /dev/null; then
       as_flavor=aix
-      gas=no
-    else
-      gas=yes
     fi
     ;;
   *-*-darwin*)
     as_flavor=darwin
-    gas=no
     ;;
   *-*-solaris2*)
     if $gcc_cv_as -V 2>&1 | grep 'Compiler Common.*SunOS' > /dev/null; then
       as_flavor=solaris
-      gas=no
-    else
-      gas=yes
     fi
     ;;
   hppa*64*-*-hpux11*)
     if $gcc_cv_as -V 2>&1 | grep 'UX.11.*PA-RISC.*Assembler' > /dev/null; then
       as_flavor=hpux
-      gas=no
-    else
-      gas=yes
     fi
     ;;
   nvptx-*-*)
     as_flavor=nvptx
-    gas=no
     ;;
 esac
 AC_MSG_RESULT($as_flavor)
@@ -2787,15 +2776,6 @@  case "$ORIGINAL_AS_FOR_TARGET" in
   *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;;
 esac 
 
-# Check if we are using GNU as if not already set.
-if test -z "$gas"; then
-  if $gcc_cv_as --version 2>/dev/null | grep GNU > /dev/null; then
-    gas=yes
-  else
-    gas=no
-  fi
-fi
-
 if $gcc_cv_as --help 2>&1 | grep -- --fatal-warnings > /dev/null; then
   fw_as_opt=--fatal-warnings
 fi
@@ -5611,8 +5591,7 @@  esac
 
 case "$target" in
   mips*-*-* | loongarch*-*-* | *-*-hpux* )
-    if test x$gas = xyes \
-       || test x"$host" != x"$build" \
+    if test x"$host" != x"$build" \
        || test ! -x "$gcc_cv_as" \
        || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then
       :