https://gcc.gnu.org/g:32896739d2507b21636f5c1ed7854fa2245ad00f
commit r17-2042-g32896739d2507b21636f5c1ed7854fa2245ad00f Author: Rainer Orth <[email protected]> Date: Wed Jul 1 10:38:26 2026 +0200 Remove HAVE_GNU_LD Similar to HAVE_GNU_AS, there's only a single use of HAVE_GNU_LD left, i.e. linker support for GNU style response files. Therefore this patch replaces it with the result of a new configure test, HAVE_LD_AT_FILE. Apart from that, there's a reference in alpha/vms.h. However, there's no documentation on the support status of the alpha*-dec-*vms* configuration. The last non-mechanical change to VMS files in gcc/config dates back to 2014, so I've left that alone. 2026-04-13 Rainer Orth <[email protected]> gcc: * configure.ac (HAVE_GNU_LD): Remove. (gcc_cv_ld_at_file): New test. * configure: Regenerate. * config.in: Regenerate. * collect2.cc: Check HAVE_LD_AT_FILE instead of HAVE_GNU_LD. gcc/ada: * link.c: Check HAVE_LD_AT_FILE instead of HAVE_GNU_LD. Update comment. [VMS]: Remove. [__svr4__ && __i386__]: Remove. gcc/testsuite: * gcc.misc-tests/outputs.exp (gld): Update comment. Diff: --- gcc/ada/link.c | 28 +++------------------------ gcc/collect2.cc | 9 +++++---- gcc/config.in | 12 ++++++------ gcc/configure | 33 +++++++++++++++++++++++--------- gcc/configure.ac | 21 +++++++++++++++++--- gcc/testsuite/gcc.misc-tests/outputs.exp | 11 ++--------- 6 files changed, 58 insertions(+), 56 deletions(-) diff --git a/gcc/ada/link.c b/gcc/ada/link.c index 55c3f5da3fc4..bc7c48299d42 100644 --- a/gcc/ada/link.c +++ b/gcc/ada/link.c @@ -160,9 +160,9 @@ const char *__gnat_object_library_extension = ".a"; unsigned char __gnat_separate_run_path_options = 0; const char *__gnat_default_libgcc_subdir = "lib"; -#elif (HAVE_GNU_LD) -/* These are the settings for all systems that use gnu ld. GNU style response - file is supported, the shared library default is STATIC. */ +#elif (HAVE_LD_AT_FILE) +/* These are the settings for all other systems that support GNU style + response files. The shared library default is STATIC. */ const char *__gnat_object_file_option = "-Wl,@"; const char *__gnat_run_path_option = ""; @@ -174,17 +174,6 @@ const char *__gnat_object_library_extension = ".a"; unsigned char __gnat_separate_run_path_options = 0; const char *__gnat_default_libgcc_subdir = "lib"; -#elif defined (VMS) -const char *__gnat_object_file_option = ""; -const char *__gnat_run_path_option = ""; -char __gnat_shared_libgnat_default = STATIC; -char __gnat_shared_libgcc_default = STATIC; -int __gnat_link_max = 2147483647; -unsigned char __gnat_objlist_file_supported = 0; -const char *__gnat_object_library_extension = ".olb"; -unsigned char __gnat_separate_run_path_options = 0; -const char *__gnat_default_libgcc_subdir = "lib"; - #elif defined (__sun__) const char *__gnat_object_file_option = ""; const char *__gnat_run_path_option = "-Wl,-R"; @@ -202,17 +191,6 @@ const char *__gnat_default_libgcc_subdir = "lib/amd64"; const char *__gnat_default_libgcc_subdir = "lib"; #endif -#elif defined (__svr4__) && defined (__i386__) -const char *__gnat_object_file_option = ""; -const char *__gnat_run_path_option = ""; -char __gnat_shared_libgnat_default = STATIC; -char __gnat_shared_libgcc_default = STATIC; -int __gnat_link_max = 2147483647; -unsigned char __gnat_objlist_file_supported = 0; -const char *__gnat_object_library_extension = ".a"; -unsigned char __gnat_separate_run_path_options = 0; -const char *__gnat_default_libgcc_subdir = "lib"; - #else /* These are the default settings for all other systems. No response file diff --git a/gcc/collect2.cc b/gcc/collect2.cc index c7b0ad4321ac..84d5e1f209a5 100644 --- a/gcc/collect2.cc +++ b/gcc/collect2.cc @@ -718,7 +718,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst, /* Run the linker again, this time replacing the object files optimized by the LTO with the temporary file generated by the LTO. */ - fork_execute ("ld", out_lto_ld_argv, HAVE_GNU_LD && at_file_supplied, + fork_execute ("ld", out_lto_ld_argv, HAVE_LD_AT_FILE && at_file_supplied, "ld_args"); /* We assume that temp files were created, and therefore we need to take that into account (maybe run dsymutil). */ @@ -731,7 +731,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst, { /* Our caller is relying on us to do the link even though there is no LTO back end work to be done. */ - fork_execute ("ld", lto_ld_argv, HAVE_GNU_LD && at_file_supplied, + fork_execute ("ld", lto_ld_argv, HAVE_LD_AT_FILE && at_file_supplied, "ld_args"); /* No LTO objects were found, so no new temp file. */ post_ld_pass (/*temp_file*/false); @@ -749,7 +749,7 @@ do_link (char **ld_argv, const char *atsuffix) const char *prog = "ld"; pex = collect_execute (prog, ld_argv, NULL, NULL, PEX_LAST | PEX_SEARCH, - HAVE_GNU_LD && at_file_supplied, atsuffix); + HAVE_LD_AT_FILE && at_file_supplied, atsuffix); int ret = collect_wait (prog, pex); if (ret) { @@ -1809,7 +1809,8 @@ main (int argc, char **argv) maybe_run_lto_and_relink (ld2_argv, object_lst, object, true); else { - fork_execute ("ld", ld2_argv, HAVE_GNU_LD && at_file_supplied, "ld_args"); + fork_execute ("ld", ld2_argv, HAVE_LD_AT_FILE && at_file_supplied, + "ld_args"); post_ld_pass (/*temp_file*/false); } diff --git a/gcc/config.in b/gcc/config.in index f16948e8cd9d..b30eb6157e49 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1609,12 +1609,6 @@ #endif -/* Define to 1 if using GNU ld. */ -#ifndef USED_FOR_TARGET -#undef HAVE_GNU_LD -#endif - - /* Define if the gold linker supports split stack and is available as a non-default */ #ifndef USED_FOR_TARGET @@ -1696,6 +1690,12 @@ #endif +/* Define if your linker supports GNU style response files. */ +#ifndef USED_FOR_TARGET +#undef HAVE_LD_AT_FILE +#endif + + /* Define if your linker supports emulation avrxmega2_flmap. */ #ifndef USED_FOR_TARGET #undef HAVE_LD_AVR_AVRXMEGA2_FLMAP diff --git a/gcc/configure b/gcc/configure index 5f598d43978c..44b522c65f10 100755 --- a/gcc/configure +++ b/gcc/configure @@ -13097,13 +13097,6 @@ $as_echo "#define USE_LONG_LONG_FOR_WIDEST_FAST_INT 1" >>confdefs.h fi -gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi` - -cat >>confdefs.h <<_ACEOF -#define HAVE_GNU_LD $gnu_ld_bool -_ACEOF - - count=a for f in $host_xm_file; do count=${count}x @@ -21946,7 +21939,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21949 "configure" +#line 21942 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -22052,7 +22045,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 22055 "configure" +#line 22048 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -26824,6 +26817,28 @@ $as_echo "#define HAVE_GAS_HIDDEN 1" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker supports GNU style respones files" >&5 +$as_echo_n "checking linker supports GNU style respones files... " >&6; } +gcc_cv_ld_at_file=no +if test $in_tree_ld = yes ; then + gcc_cv_ld_at_file=yes +elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x; then + echo '.byte 0' > conftest.s + echo conftest.o > conftest.at + if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \ + && $gcc_cv_ld -r -o conftest2.o @conftest.at > /dev/null 2>&1; then + gcc_cv_ld_at_file=yes + fi + rm -f conftest.* conftest2.* +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_LD_AT_FILE `if test $gcc_cv_ld_at_file = yes; then echo 1; else echo 0; fi` +_ACEOF + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_at_file" >&5 +$as_echo "$gcc_cv_ld_at_file" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker read-only and read-write section mixing" >&5 $as_echo_n "checking linker read-only and read-write section mixing... " >&6; } gcc_cv_ld_ro_rw_mix=unknown diff --git a/gcc/configure.ac b/gcc/configure.ac index 5f8866662221..32ea548afa94 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2020,9 +2020,6 @@ if test x$use_long_long_for_widest_fast_int = xyes; then efficiently supported by the host hardware.]) 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.]) - count=a for f in $host_xm_file; do count=${count}x @@ -3420,6 +3417,24 @@ if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then [Define if your assembler and linker support .hidden.]) fi +AC_MSG_CHECKING(linker supports GNU style respones files) +gcc_cv_ld_at_file=no +if test $in_tree_ld = yes ; then + gcc_cv_ld_at_file=yes +elif test x"$gcc_cv_as" != x -a x"$gcc_cv_ld" != x; then + echo '.byte 0' > conftest.s + echo conftest.o > conftest.at + if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \ + && $gcc_cv_ld -r -o conftest2.o @conftest.at > /dev/null 2>&1; then + gcc_cv_ld_at_file=yes + fi + rm -f conftest.* conftest2.* +fi +AC_DEFINE_UNQUOTED(HAVE_LD_AT_FILE, + [`if test $gcc_cv_ld_at_file = yes; then echo 1; else echo 0; fi`], + [Define if your linker supports GNU style response files.]) +AC_MSG_RESULT($gcc_cv_ld_at_file) + AC_MSG_CHECKING(linker read-only and read-write section mixing) gcc_cv_ld_ro_rw_mix=unknown if test $in_tree_ld = yes ; then diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp index 2aa0b666f2ff..76ee8a08442d 100644 --- a/gcc/testsuite/gcc.misc-tests/outputs.exp +++ b/gcc/testsuite/gcc.misc-tests/outputs.exp @@ -50,15 +50,8 @@ if !$skip_lto { set ltop [check_linker_plugin_available] } -# Check for GNU LD. Some files like .ld1_args depend on this. This -# should really be testing whether HAVE_GNU_LD was set by configure. -# If we find GNU ld here, but the compiler wasn't configured -# --with-gnu-ld or with DEFAULT_LINKER pointing at GNU ld, on a target -# that doesn't set gnu_ld=yes unconditionally, configure and thus -# collect2 will conservatively assume there's no support for @file in -# the linker, but our atfile tests will expect ld1_args files to be -# created, and thus fail. Configuring the compiler --with-gnu-ld -# fixes this. +# Check for GNU ld. Some files like .ld1_args depend on this. This +# should really be testing whether the linker supports GNU style response files. set gld [check_effective_target_gld] # Darwin's linker is not silent about missing -L values. set ld64 [istarget *-*-darwin*]
