]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
build: testsuite: Generate effective targets from auto-host.h
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 17 Jul 2026 07:53:34 +0000 (09:53 +0200)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 17 Jul 2026 07:53:34 +0000 (09:53 +0200)
Several of the testsuite's effective targets are supposed to match the
result of configure tests.  However, they often try to redo the tests,
which leads to code duplication and inconsistencies.

Instead, this patch provides a framework to automatically generate
check_effective_target_<effective-target> procs that match an
auto-host.h macro and loads the result into targets-support.exp.

The effective target definitions are read from et-static.def, similar to
the existing *.opt files, with a two-step process: preprocessing
et-static.def by stripping comments and empty lines, emitting the result
in a simple record format.  That is used to scan auto-host.h to provide
the actual effective-target definitions.

Both the resulting et-static.def and the auto-host.h file are installed
so they can seamlessly be used for installed testing.

contrib/test_installed has been modified to allow for three scenarios:

* By default, the testsuite will load the installed et-static.exp file
  directly.

* To use a modified or fallback et-static.exp, it can be specified with
  --with-et-static.

* With --with-auto-host-h, an et-static.exp file matching the source
  tree to be tested can be generated from a corresponding auto-host.h
  file.  This allows for testing an older installed compiler with a
  newer source tree.

To avoid interfering with the target-supports.exp code to locate
et-static.exp, test_installed only emits the *_UNDER_TEST variables to
site.exp if a particular front end is actually tested.

To demonstrate the facility, this patch uses the recently added
HAVE_LD_AT_FILE check as a trivial example.  Just as HAVE_LD_AT_FILE was
used to replace the current HAVE_GNU_LD, this patch creates a new
ld_at_file effective target, replacing one use of the gld effective
target.

Bootstrapped without regressions on i386-pc-solaris2.11 (as/ld and
gas/gld) and x86_64-pc-linux-gnu.  Also tested with test_installed on
i386-pc-solaris2.11.

2026-01-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
* et-gather.awk, gen-et-static.awk: New scripts.
* Makefile.in (testsuitedir): New.
(native): Depend on testsuite/et-static.exp.
(clean): Remove etlist.
(distclean): Remove et-static.exp.
(install-testsuite): New target.
(install): Depend on it.
(site.exp): Depend on testsuite/et-static.exp.
(testsuite/et-static.exp): New target.

* doc/sourcebuild.texi (Effective-Target Keywords): Document
et-static.def.
(Effective-Target Keywords, Other attributes): Document
ld_at_file.

gcc/testsuite:
* lib/et-static.def: New file.
* lib/target-supports.exp: Load et-static.exp.
* gcc.misc-tests/outputs.exp: Use ld_at_file effective target
instead of gld.
Update comment.

contrib:
* test_installed (--with-auto-host-h): New option.
(--with-et-static): Likewise.
(--with-objc): Likewise.
Generate et-static.def if --with-auto-host-h is specified.
(GCC_UNDER_TEST): Only emit to site.def if enabled.
(GXX_UNDER_TEST): Likewise.
(GFORTRAN_UNDER_TEST): Likewise.
(OBJC_UNDER_TEST): Likewise.
(et_static): Emit to site.exp if specified.

contrib/test_installed
gcc/Makefile.in
gcc/doc/sourcebuild.texi
gcc/et-gather.awk [new file with mode: 0644]
gcc/gen-et-static.awk [new file with mode: 0644]
gcc/testsuite/gcc.misc-tests/outputs.exp
gcc/testsuite/lib/et-static.def [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp

index 9c0bf99d716d62f580a8a46f74852db0cd620840..6fa317b289d7e4e024c43f5c89be4e331f11e0dd 100755 (executable)
 # --testsuite, --srcdir will be ignored; otherwise, `/gcc/testsuite'
 # will be appended to the srcdir.
 
+# target-supports.exp depends on et-static.exp generated from auto-host.h.
+# It is usually taken from the installed compiler, but can be specified
+# using --with-et-static.  To support testing with a source tree newer than
+# the installed compiler, it can also be generated from an auto-host.h
+# specified with --with-auto-host-h.  If the actual auto-host.h is missing,
+# /dev/null can be used to generate a fallback et-static.exp.
+
 # You may specify where the binaries to be tested should be picked up
 # from.  If you specify --prefix=/some/dir, gcc, g++ and gfortran will be
 # looked for at /some/dir/bin.  Each one may be overridden by
 # specifying --with-gcc=/pathname/to/gcc, --with-g++=/pathname/to/g++
 # and --with-gfortran=/pathname/to/gfortran.  If you specify --without-gcc,
-# --without-g++ or --without-gfortran, the test for the specified program
-# will be skipped.  By default, gcc, g++ and gfortran will be searched in
-# the PATH.
+# --without-g++ --without-gfortran, or --without-objc the test for the
+# specified program  will be skipped.  By default, gcc, g++ and gfortran
+# will be searched in the PATH.
 
 # An additional argument may specify --tmpdir=/some/dir; by default,
 # temporaries will be stored in the current directory, where the log
@@ -46,6 +53,8 @@ libiconv=-liconv
 while true; do
   case "$1" in
   --with-testsuite=*) testsuite=`echo "$1" | sed 's/[^=]*=//'`; shift;;
+  --with-auto-host-h=*) auto_host_h=`echo "$1" | sed 's/[^=]*=//'`; shift;;
+  --with-et-static=*) et_static=`echo "$1" | sed 's/[^=]*=//'`; shift;;
   --srcdir=*) srcdir=`echo "$1" | sed 's/[^=]*=//'`; shift;;
   --target=*) target=`echo "$1" | sed 's/[^=]*=//'`; shift;;
   --prefix=*) prefix=`echo "$1" | sed 's/[^=]*=//'`; shift;;
@@ -53,6 +62,7 @@ while true; do
   --with-gcc=*) GCC_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
   --with-g++=*) GXX_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
   --with-gfortran=*) GFORTRAN_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
+  --with-objc=*) OBJC_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
   --with-alt-cc=*) ALT_CC_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
   --with-alt-cxx=*) ALT_CXX_UNDER_TEST=`echo "$1" | sed 's/[^=]*=//'`; shift;;
   --with-compat-options=*) COMPAT_OPTIONS=`echo "$1" | sed 's/[^=]*=//'`; shift;;
@@ -77,6 +87,8 @@ Supported arguments:
 --help                        prints this page
 
 --with-testsuite=/some/dir/gcc/testsuite   specify the testsuite directory
+--with-auto-host-h=/some/dir/auto-host.h   specify auto-host.h
+--with-et-static=/some/dir/et-static.exp   specify et-static.exp
 --srcdir=/some/dir            same as --with-testsuite=/some/dir/gcc/testsuite
                               [deduced from shell-script pathname]
 
@@ -88,6 +100,7 @@ Supported arguments:
 --with-gcc=/some/dir/bin/gcc  use specified gcc program [gcc]
 --with-g++=/some/dir/bin/g++  use specified g++ program [g++]
 --with-gfortran=/some/dir/bin/gfortran  use specified gfortran program [gfortran]
+--with-objc=/some/dir/bin/gcc use specified gcc program [gcc]
 --with-alt-cc=/some/compiler  use specified alternative compiler in compat tests
 --with-alt-cxx=/some/compiler use specified alternative compiler in compat tests
 --with-compat-options=opts    use specified COMPAT_OPTIONS in compat tests
@@ -124,6 +137,20 @@ if test x"${testsuite+set}" != x"set" && test x"${srcdir+set}" != x"set"; then
   srcdir=$top_srcdir
 fi
 
+# Prefer et-static.exp explicitly specified.  Alternatively, generate one
+# from the specified auto-host.h.
+if test x"${et_static+set}" != x"set" && test x"${auto_host_h+set}" = x"set"; then
+   gcc_srcdir=${srcdir}/gcc
+   awk -f ${gcc_srcdir}/et-gather.awk \
+       ${gcc_srcdir}/testsuite/lib/et-static.def > etlist
+   awk -f ${gcc_srcdir}/gen-et-static.awk -v etlist=etlist \
+       ${auto_host_h} > et-static.exp
+  et_static=et-static.exp
+fi
+
+# If neither option has been given, the testsuite will use the et-static.exp
+# from the installed compiler.
+
 cat >site.exp <<EOF
 set rootme "."
 set tmpdir "${tmpdir-`${PWDCMD-pwd}`}"
@@ -131,19 +158,32 @@ set srcdir "${testsuite-${srcdir}/gcc/testsuite}"
 set libiconv "$libiconv"
 set CFLAGS ""
 set CXXFLAGS ""
+EOF
+test x"${GCC_UNDER_TEST}" = x"no" || cat >>site.exp <<EOF
 set GCC_UNDER_TEST "${GCC_UNDER_TEST-${prefix}${prefix+/bin/}\
 ${target+$target-}gcc}"
+EOF
+test x"${GXX_UNDER_TEST}" = x"no" || cat >>site.exp <<EOF
 set GXX_UNDER_TEST "${GXX_UNDER_TEST-${prefix}${prefix+/bin/}\
 ${target+$target-}g++}"
+EOF
+test x"${GFORTRAN_UNDER_TEST}" = x"no" || cat >>site.exp <<EOF
 set GFORTRAN_UNDER_TEST "${GFORTRAN_UNDER_TEST-${prefix}${prefix+/bin/}\
 ${target+$target-}gfortran}"
+EOF
+test x"${OBJCC_UNDER_TEST}" = x"no" || cat >>site.exp <<EOF
 set OBJC_UNDER_TEST "${OBJC_UNDER_TEST-${prefix}${prefix+/bin/}\
 ${target+$target-}gcc}"
+EOF
+cat >>site.exp <<EOF
 set HOSTCC "${HOSTCC-cc}"
 set HOSTCXX "${HOSTCXX-c++}"
 set HOSTCFLAGS ""
 set HOSTCXXFLAGS ""
 EOF
+if test x${et_static+set} = xset; then
+  echo "set et_static \"${et_static}\"" >> site.exp
+fi
 if test x${target} != x; then
   target_canonical=`$top_srcdir/config.sub $target`
   echo "set target_triplet $target_canonical" >> site.exp
index fa46ada4980ff8fcbdba696f46e81f59b83dc4b4..ee2f9022eab7f88a723118a57f11485da5eb9254 100644 (file)
@@ -689,6 +689,8 @@ plugin_resourcesdir = $(libsubdir)/plugin
 plugin_includedir = $(plugin_resourcesdir)/include
 # Directory in which plugin specific executables are installed
 plugin_bindir = $(libexecsubdir)/plugin
+# Directory where files for installed testing are installed
+testsuitedir = $(libsubdir)/testsuite
 # Used to produce a relative $(gcc_tooldir) in gcc.o
 ifeq ($(enable_as_accelerator),yes)
 unlibsubdir = ../../../../..
@@ -2288,7 +2290,8 @@ start.encap: native xgcc$(exeext) cpp$(exeext) specs \
 rest.encap: lang.rest.encap
 # This is what is made with the host's compiler
 # whether making a cross compiler or not.
-native: config.status auto-host.h build-@POSUB@ $(LANGUAGES) \
+native: config.status auto-host.h testsuite/et-static.exp build-@POSUB@ \
+       $(LANGUAGES) \
        $(EXTRA_PROGRAMS) $(COLLECT2) lto-wrapper$(exeext) \
        gcc-ar$(exeext) gcc-nm$(exeext) gcc-ranlib$(exeext)
 
@@ -4063,6 +4066,7 @@ clean: mostlyclean lang.clean
        -rm -f libgcc_s*
        -rm -f libunwind*
        -rm -f config.h tconfig.h bconfig.h tm_p.h tm.h
+       -rm -f etlist
        -rm -f options.cc options.h optionlist
        -rm -f cs-*
        -rm -f doc/*.dvi
@@ -4082,6 +4086,7 @@ distclean: clean lang.distclean
        -rm -f TAGS */TAGS
        -rm -f *.asm
        -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
+       -rm -f testsuite/et-static.exp
        -rm -f testsuite/*.log testsuite/*.sum
        -cd testsuite && rm -f x *.x *.x? *.exe *.rpo *.o *.s *.S *.cc
        -cd testsuite && rm -f *.out *.gcov *$(coverageexts)
@@ -4109,7 +4114,7 @@ maintainer-clean:
 # broken is small.
 install: install-common $(INSTALL_HEADERS) \
     install-cpp install-man install-info install-@POSUB@ \
-    install-driver install-lto-wrapper install-gcc-ar
+    install-driver install-lto-wrapper install-gcc-ar install-testsuite
 
 ifeq ($(enable_plugin),yes)
 install: install-plugin
@@ -4580,6 +4585,12 @@ install-gcc-ar: installdirs gcc-ar$(exeext) gcc-nm$(exeext) gcc-ranlib$(exeext)
          done; \
        fi
 
+# Install files needed for installed testing.
+install-testsuite: testsuite/et-static.exp auto-host.h installdirs
+       $(mkinstalldirs) $(DESTDIR)$(testsuitedir)
+       $(INSTALL_DATA) testsuite/et-static.exp $(DESTDIR)$(testsuitedir)/et-static.exp
+       $(INSTALL_DATA) auto-host.h $(DESTDIR)$(testsuitedir)/auto-host.h
+
 # Cancel installation by deleting the installed files.
 uninstall: lang.uninstall
        -rm -rf $(DESTDIR)$(libsubdir)
@@ -4606,7 +4617,7 @@ uninstall: lang.uninstall
 
 target_subdir = @target_subdir@
 
-site.exp: ./config.status Makefile
+site.exp: ./config.status Makefile testsuite/et-static.exp
        @echo "Making a new config file..."
        -@rm -f ./site.tmp
        @$(STAMP) site.exp
@@ -4689,6 +4700,12 @@ site.exp: ./config.status Makefile
                -e '1,/^## All variables above are.*##/ d' >> site.exp
        -@rm -f ./site.tmp
 
+testsuite/et-static.exp: $(srcdir)/et-gather.awk $(srcdir)/gen-et-static.awk \
+       $(srcdir)/testsuite/lib/et-static.def Makefile auto-host.h
+       $(AWK) -f $(srcdir)/et-gather.awk  $(srcdir)/testsuite/lib/et-static.def > etlist
+       -test -d $(TESTSUITEDIR) || mkdir $(TESTSUITEDIR)
+       $(AWK) -f $(srcdir)/gen-et-static.awk -v etlist=etlist auto-host.h > $@
+
 CHECK_TARGETS = @check_languages@
 
 check: $(CHECK_TARGETS)
index 0e08ef5e6454793971fa9f8424b84fb0fdcc6e13..a377739edb66745b523efdc31f3488811b05dd47 100644 (file)
@@ -1498,7 +1498,9 @@ are expected to fail some tests.
 
 Effective-target keywords are defined in @file{lib/target-supports.exp} in
 the GCC testsuite, with the exception of those that are documented as
-being local to a particular test directory.
+being local to a particular test directory.  Effective-target keywords
+matching @file{auto-host.h} macros can be generated from definitions
+in @file{lib/et-static.def}.
 
 The @samp{effective target} takes into account all of the compiler options
 with which the test will be compiled, including the multilib options.
@@ -3111,6 +3113,9 @@ Target uses GNU @command{ld}.
 Target keeps null pointer checks, either due to the use of
 @option{-fno-delete-null-pointer-checks} or hardwired into the target.
 
+@item ld_at_file
+Target supports GNU style response files.
+
 @item llvm_binutils
 Target is using an LLVM assembler and/or linker, instead of GNU Binutils.
 
diff --git a/gcc/et-gather.awk b/gcc/et-gather.awk
new file mode 100644 (file)
index 0000000..2292e90
--- /dev/null
@@ -0,0 +1,38 @@
+#  Copyright (C) 2026 Free Software Foundation, Inc.
+#  Based on opt-gather.awk.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# This Awk script takes et-static.def and creates a three-field list
+# suitable for input into gen-et-static.awk.
+#
+# Usage: awk -f et-gather.awk et-static.def > outputfile
+
+BEGIN {        numrec = 0 }
+
+# Ignore comments and blank lines
+/^[ \t]*(#|$)/  { flag = 0; next }
+/^[^ \t]/       { if (flag == 0) {
+                    record[++numrec] = $0
+                   flag = 1 }
+                 else {
+                   record[numrec] = record[numrec] SUBSEP $0
+                 }
+}
+
+END {
+    for (i = 1; i <= numrec; i++) {
+       print record[i] }
+}
diff --git a/gcc/gen-et-static.awk b/gcc/gen-et-static.awk
new file mode 100644 (file)
index 0000000..81707e7
--- /dev/null
@@ -0,0 +1,77 @@
+#  Copyright (C) 2026 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# This Awk script takes input file (usually auto-host.h) and effective target
+# definitions from preprocessed et-static.def, and writes et-static.exp
+# implementing checks for select effective-target keywords.
+#
+# Usage: awk -v etlist=<path to etlist> -f gen-et-static.awk <input file>
+
+BEGIN {
+    input = ARGV[1]
+
+    SAVEFS=FS
+    FS=SUBSEP
+
+    # Read preprocessed et-static.def.  Each line consists of
+    # <effective-target> <macro> <comment>.
+    while ((getline < etlist) > 0) {
+       et[$2] = $1
+       comment[$2] = $3
+    }
+    close(etlist)
+
+    FS=SAVEFS
+}
+
+function emit_effective_target(name, value, comment)
+{
+    print "";
+    print "# " comment;
+    print "proc check_effective_target_" name " { } {";
+    print "    return " value;
+    print "}";
+}
+
+# #define <MACRO> <value>
+/^#define/ { value[$2] = $3 }
+
+# /* #undef <MACRO> */
+/^\/\* #undef/ { value[$3] = 0 }
+
+END {
+    print "# This file is auto-generated by gen-et-static.awk from " input
+    print "# and et-static.def."
+
+    for (macro in et) {
+       if (macro in value) {
+           val = value[macro]
+           # Characters, strings and tri-state macros would need
+           # special handling.
+           if (val !~ /^[01]/) {
+               print "#error non-0/1/#undef value " val " for " macro
+               exit(1)
+           }
+       } else {
+           # Treat missing macros as unsupported.
+           print "#warning definition for " macro " missing"
+           val = 0
+       }
+
+       emit_effective_target(et[macro], val,
+                             "Return 1 if " comment[macro] ", 0 otherwise.");
+    }
+}
index 76ee8a08442d77b73248a0b35da381981709f693..0561dd58b60541ef10f0a3e9fe8dcaed3d56aef1 100644 (file)
@@ -50,9 +50,9 @@ 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 the linker supports GNU style response files.
-set gld [check_effective_target_gld]
+# Check if the linker supports GNU style response files.  Some files like
+# .ld1_args depend on this.
+set ld_at_file [check_effective_target_ld_at_file]
 # Darwin's linker is not silent about missing -L values.
 set ld64 [istarget *-*-darwin*]
 
@@ -180,7 +180,7 @@ proc outest { test sources opts dirs outputs } {
        foreach og $olist {
            if { [string index $og 0] == "!" } {
                global gspd ltop
-               global gld ld64
+               global ld_at_file ld64
                set cond [expr $og]
                continue
            }
@@ -363,14 +363,14 @@ outest "$b-21 exe savetmp named2" $mult "-o $b.exe -save-temps" {} {{--1.i --1.s
 
 # Additional files are created when an @file is used
 if !$skip_atsave {
-outest "$b-22 exe savetmp namedb-2" $sing "@$devnull -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$gld .ld1_args !0 .exe}}
-outest "$b-23 exe savetmp named2-2" $mult "@$devnull -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$gld .ld1_args !0 .exe}}
-outest "$b-24 exe savetmp named2-3" $mult "@$devnull -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$gld .ld1_args !0 .exe}}
+outest "$b-22 exe savetmp namedb-2" $sing "@$devnull -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$ld_at_file .ld1_args !0 .exe}}
+outest "$b-23 exe savetmp named2-2" $mult "@$devnull -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$ld_at_file .ld1_args !0 .exe}}
+outest "$b-24 exe savetmp named2-3" $mult "@$devnull -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$ld_at_file .ld1_args !0 .exe}}
   if $ld64 {
     # Darwin's linker warns about missing args to -L.
-    outest "$b-25 exe savetmp named2-4" $mult "@$devnull -I dummy -L dummy -o $b.exe -save-temps -Wl,-w" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!0 .args.3 !!$gld .ld1_args !0 .exe}}
+    outest "$b-25 exe savetmp named2-4" $mult "@$devnull -I dummy -L dummy -o $b.exe -save-temps -Wl,-w" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!0 .args.3 !!$ld_at_file .ld1_args !0 .exe}}
   } else {
-    outest "$b-25 exe savetmp named2-4" $mult "@$devnull -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}}
+    outest "$b-25 exe savetmp named2-4" $mult "@$devnull -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$ld_at_file .ld1_args !0 .exe}}
   }
 }
 
diff --git a/gcc/testsuite/lib/et-static.def b/gcc/testsuite/lib/et-static.def
new file mode 100644 (file)
index 0000000..ac8c17d
--- /dev/null
@@ -0,0 +1,29 @@
+# Definitions of static effective targets determined from auto-host.h.
+
+#  Copyright (C) 2026 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Each record consist of 3 lines:
+#
+# <effective target>
+# <MACRO>
+# <comment> to be emitted as "Return 0 if <comment>, 1 otherwise."
+
+# Keep this sorted alphabetically by effective-target name.  */
+
+ld_at_file
+HAVE_LD_AT_FILE
+your linker supports GNU style response files
index edd1290bd9e3dc0be3eb2535c61afb1b7b4948a6..6a1e1547335b1cdd36892c6fe468d02638015f4a 100644 (file)
 
 # This file defines procs for determining features supported by the target.
 
+# Try to load effective-target procs from the generated et-static.exp in
+# gcc/testsuite.
+
+global tool_root_dir
+global et_static
+
+if { ![info exists et_static] } {
+    global GCC_UNDER_TEST
+
+    if [info exists GCC_UNDER_TEST] {
+       set compiler $GCC_UNDER_TEST
+    } else {
+       set compiler [find_gcc]
+    }
+
+    set output [remote_exec host "$compiler -print-file-name=testsuite/et-static.exp"]
+    set et_static [string trim [lindex $output 1]]
+}
+
+if { ![file exists $et_static] } {
+    error "Couldn't find $et_static."
+}
+
+load_file $et_static
+
 # Try to compile the code given by CONTENTS into an output file of
 # type TYPE, where TYPE is as for target_compile.  Return a list
 # whose first element contains the compiler messages and whose