https://gcc.gnu.org/g:e08a7f620c037275e2c1c5940b56b536077cd98b
commit r17-2038-ge08a7f620c037275e2c1c5940b56b536077cd98b Author: Rainer Orth <[email protected]> Date: Wed Jul 1 10:26:12 2026 +0200 Remove HAVE_GNU_AS This patch removes or replaces the remaining uses of HAVE_GNU_AS: * gcc.cc (asm_options) has a sub-spec to map the gcc -v/-w/-I options to their assembler equivalents. It is replaced by ASM_V_SPEC, defaulting to the gas version. Non-gas configurations define their own versions. * Darwin has ASM_OPTIONS which is identical to the default ASM_V_SPEC and can just be removed. * sol2.h currently handles -v in ASM_SPEC_BASE. This patch moves this to an Solaris-as only version of ASM_V_SPEC. This also handles the gcc -w -> as -n mapping. The spec doesn't pass on -I, though: preprocessing .S files is handled by gcc itself, the -I option is only used for gas' .include directive which as doesn't support. Solaris as instead could handle preprocessing by passing the source through cpp when the -P option is given. It also uses -D/-U/-I for that. * ia64/hpux.h guards AS_NEEDS_DASH_FOR_PIPED_INPUT with !HAVE_GNU_AS, but according to install.texi ia64-*-hpux* requires gas so this can just go. * nvptx/nvptx.h handles the mapping in ASM_SPEC. This is done in ASM_V_SPEC now. The nvptx as has no equivalents of -w and -I. * AIX as only supports -v and -W, so rs6000/aix.h gets a matching ASM_V_SPEC when as is in use. 2026-04-10 Rainer Orth <[email protected]> gcc: * gcc.cc (asm_options) [HAVE_GNU_AS]: Move to ... (ASM_V_SPEC) ... this. * config/nvptx/nvptx.h (ASM_SPEC): Rename to ASM_V_SPEC. Adjust comment. * config/rs6000/aix.h [HAVE_AIX_AS] (ASM_V_SPEC): Define. * config/sol2.h (ASM_SPEC_BASE): Move -v handling to ... [HAVE_SOLARIS_AS] (ASM_V_SPEC): ... this. Also handle -w. * doc/tm.texi.in (Driver, ASM_V_SPEC): Document. * doc/tm.texi: Regenerate. * config/darwin.h (ASM_OPTIONS): Remove. * config/i386/darwin.h (ASM_SPEC): Remove ASM_OPTIONS. * config/ia64/hpux.h (AS_NEEDS_DASH_FOR_PIPED_INPUT): Remove. * configure.ac (HAVE_GNU_AS): Remove. * configure: Regenerate. * config.in: Regenerate. Diff: --- gcc/config.in | 6 ------ gcc/config/darwin.h | 11 +---------- gcc/config/i386/darwin.h | 2 +- gcc/config/ia64/hpux.h | 4 ---- gcc/config/nvptx/nvptx.h | 5 ++--- gcc/config/rs6000/aix.h | 4 ++++ gcc/config/sol2.h | 9 +++++++-- gcc/configure | 11 ++--------- gcc/configure.ac | 3 --- gcc/doc/tm.texi | 9 +++++++++ gcc/doc/tm.texi.in | 9 +++++++++ gcc/gcc.cc | 14 ++++++++------ 12 files changed, 43 insertions(+), 44 deletions(-) diff --git a/gcc/config.in b/gcc/config.in index 7a58d51d1b61..f16948e8cd9d 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1603,12 +1603,6 @@ #endif -/* Define to 1 if using GNU as. */ -#ifndef USED_FOR_TARGET -#undef HAVE_GNU_AS -#endif - - /* Define if your system supports gnu indirect functions. */ #ifndef USED_FOR_TARGET #undef HAVE_GNU_INDIRECT_FUNCTION diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 53a7b5980e62..eced7244a1ca 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -663,21 +663,12 @@ extern GTY(()) int darwin_ms_struct; #define ASM_MMACOSX_VERSION_MIN_SPEC " %<asm_macosx_version_min=* " #endif -#if HAVE_GNU_AS -/* The options are added in gcc.cc for this case. */ -#define ASM_OPTIONS "" -#else -/* When we detect that we're cctools or llvm as, we need to insert the right - additional options. Actually, currently these are the same as GAS. */ -#define ASM_OPTIONS "%{v} %{w:-W} %{I*}" -#endif - #define AS_NEEDS_DASH_FOR_PIPED_INPUT /* Default Darwin ASM_SPEC, very simple. */ #define ASM_SPEC \ "%{static} -arch %(darwin_arch) " \ -ASM_OPTIONS ASM_MMACOSX_VERSION_MIN_SPEC +ASM_MMACOSX_VERSION_MIN_SPEC #define ASM_DEBUG_SPEC "" #undef ASM_DEBUG_OPTION_SPEC diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index 6bb6c69ecd13..5a67c18f285c 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -105,7 +105,7 @@ along with GCC; see the file COPYING3. If not see #undef ASM_SPEC #define ASM_SPEC \ "%{static} -arch %(darwin_arch) " \ - ASM_OPTIONS ASM_MMACOSX_VERSION_MIN_SPEC EXTRA_ASM_OPTS \ + ASM_MMACOSX_VERSION_MIN_SPEC EXTRA_ASM_OPTS \ "%{!force_cpusubtype_ALL:-force_cpusubtype_ALL} " #undef ENDFILE_SPEC diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h index f271d2bad4ec..6539d526b0dc 100644 --- a/gcc/config/ia64/hpux.h +++ b/gcc/config/ia64/hpux.h @@ -62,10 +62,6 @@ do { \ #undef ASM_EXTRA_SPEC #define ASM_EXTRA_SPEC "%{milp32:-milp32} %{mlp64:-mlp64}" -#ifndef HAVE_GNU_AS -#define AS_NEEDS_DASH_FOR_PIPED_INPUT -#endif - #ifndef CROSS_DIRECTORY_STRUCTURE #undef MD_EXEC_PREFIX #define MD_EXEC_PREFIX "/usr/ccs/bin/" diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h index 35af5ad45659..6ca981bf3779 100644 --- a/gcc/config/nvptx/nvptx.h +++ b/gcc/config/nvptx/nvptx.h @@ -31,9 +31,8 @@ #define OPTION_DEFAULT_SPECS \ { "arch", "%{!misa=*:-misa=%(VALUE)}" }, \ -/* Assembler supports '-v' option; handle similar to - '../../gcc.cc:asm_options', 'HAVE_GNU_AS'. */ -#define ASM_SPEC "%{v}" +/* Assembler only supports '-v' option. */ +#define ASM_V_SPEC "%{v}" #define STARTFILE_SPEC "%{mmainkernel:crt0.o%s}" diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h index 59d791912eb4..1752a4c7eece 100644 --- a/gcc/config/rs6000/aix.h +++ b/gcc/config/rs6000/aix.h @@ -177,6 +177,10 @@ #undef ASM_DEFAULT_SPEC #define ASM_DEFAULT_SPEC "" +#ifdef HAVE_AIX_AS +#define ASM_V_SPEC "%{v} %{w:-W}" +#endif + /* Tell the assembler to assume that all undefined names are external. Don't do this until the fixed IBM assembler is more generally available. diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h index b83cb84582d4..0353fd91d37a 100644 --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -142,7 +142,7 @@ along with GCC; see the file COPYING3. If not see /* It's safe to pass -s always, even if -g is not used. Those options are handled by both Sun as and GNU as. */ #define ASM_SPEC_BASE \ -"%{v:-V} %{Qy:} %{!Qn:-Qy} %{Ym,*} -s %(asm_cpu)" +"%{Qy:} %{!Qn:-Qy} %{Ym,*} -s %(asm_cpu)" #define ASM_PIC_SPEC " %{" FPIE_OR_FPIC_SPEC ":-K PIC}" @@ -446,9 +446,14 @@ along with GCC; see the file COPYING3. If not see #undef TARGET_ASM_ASSEMBLE_VISIBILITY #define TARGET_ASM_ASSEMBLE_VISIBILITY solaris_assemble_visibility -#define AS_NEEDS_DASH_FOR_PIPED_INPUT +/* Handle gcc -v/-w options. There's no point including -I: while as accepts + it, it's only useful in combination with -P which invokes cpp. Instead, gas + uses -I for the .include directive, but as doesn't understand that. */ +#define ASM_V_SPEC "%{v:-V} %{w:-n}" +#define AS_NEEDS_DASH_FOR_PIPED_INPUT #endif + /* Solaris has an implementation of __enable_execute_stack. */ #define HAVE_ENABLE_EXECUTE_STACK diff --git a/gcc/configure b/gcc/configure index 59b8193a892e..b619ecf16042 100755 --- a/gcc/configure +++ b/gcc/configure @@ -13123,13 +13123,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF -gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi` - -cat >>confdefs.h <<_ACEOF -#define HAVE_GNU_AS $gnu_as_bool -_ACEOF - - count=a for f in $host_xm_file; do count=${count}x @@ -21972,7 +21965,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21975 "configure" +#line 21968 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -22078,7 +22071,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 22081 "configure" +#line 22074 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 8766ee0c8a00..c34e00fc3b4a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2035,9 +2035,6 @@ fi gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi` AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.]) -gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi` -AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.]) - count=a for f in $host_xm_file; do count=${count}x diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 94a5f265c140..d62f29324737 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -232,6 +232,15 @@ See the file @file{sun3.h} for an example of this. Do not define this macro if it does not need to do anything. @end defmac +@defmac ASM_V_SPEC +A C string constant that tells the GCC driver how to translate the +@option{-v}, @option{-w}, and @option{-I} options into their assembler +equivalents. + +Only define this macro if the default, which matches GNU as, isn't +appropriate. +@end defmac + @defmac ASM_FINAL_SPEC A C string constant that tells the GCC driver program how to run any programs which cleanup after the normal assembler. diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 3868a68e9f32..2aa58133d660 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -232,6 +232,15 @@ See the file @file{sun3.h} for an example of this. Do not define this macro if it does not need to do anything. @end defmac +@defmac ASM_V_SPEC +A C string constant that tells the GCC driver how to translate the +@option{-v}, @option{-w}, and @option{-I} options into their assembler +equivalents. + +Only define this macro if the default, which matches GNU as, isn't +appropriate. +@end defmac + @defmac ASM_FINAL_SPEC A C string constant that tells the GCC driver program how to run any programs which cleanup after the normal assembler. diff --git a/gcc/gcc.cc b/gcc/gcc.cc index c7a5ac2484e7..b8b0db4ed5e4 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -709,6 +709,12 @@ proper position among the other output files. */ #define ASM_SPEC "" #endif +/* config.h can define ASM_V_SPEC to pass equivalents of -v, -w (no warnings), + and -I to the assembler. */ +#ifndef ASM_V_SPEC +#define ASM_V_SPEC "%{v} %{w:-W} %{I*}" +#endif + /* config.h can define ASM_FINAL_SPEC to run a post processor after the assembler has run. */ #ifndef ASM_FINAL_SPEC @@ -1327,12 +1333,8 @@ static const char *cc1_options = static const char *asm_options = "%{-target-help:%:print-asm-header()} " -#if HAVE_GNU_AS -/* If GNU AS is used, then convert -w (no warnings), -I, and -v - to the assembler equivalents. */ -"%{v} %{w:-W} %{I*} " -#endif -"%(asm_debug_option)" +ASM_V_SPEC +" %(asm_debug_option)" ASM_COMPRESS_DEBUG_SPEC "%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
