On 09/13/2016 01:15 PM, Bernd Schmidt wrote:
On 09/12/2016 08:57 PM, David Malcolm wrote:
I'm not sure I follow - this sounds like a dedicated target for
selftesting.
Would it be a separate configuration i.e. something like:
../src/configure --target=rtl-selftest
or somesuch?
The way I imagine it working, the top-level Makefile would create a
selftest-gcc/ subdirectory, and run a configure line much like the above
inside it. It would live independently of the real compiler we're
building in gcc/.
The Makefile goop would look something like this, adapted from the old
accel-gcc stuff we had on gomp-4_0-branch. Autogenerated files are
omitted, run autogen/autoconf.
It's gated on an --enable switch. While it would be nice to include it
in every build, it would probably not be worth the extra build time
until such a time when we've built up a fairly large library of tests.
I picked ia64-elf as a stand-in for now. I guess if we decide to go down
this path we can start trying to decide what we want the actual backend
to look like.
Bernd
Index: Makefile.def
===================================================================
--- Makefile.def (revision 240029)
+++ Makefile.def (working copy)
@@ -47,6 +47,9 @@ host_modules= { module= flex; no_check_c
host_modules= { module= gas; bootstrap=true; };
host_modules= { module= gcc; bootstrap=true;
extra_make_flags="$(EXTRA_GCC_FLAGS)"; };
+host_modules= { module= test-gcc;
+ module_srcdir=gcc;
+ no_install= true; };
host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
// Work around in-tree gmp configure bug with missing flex.
extra_configure_flags='--disable-shared LEX="touch lex.yy.c"';
Index: Makefile.tpl
===================================================================
--- Makefile.tpl (revision 240029)
+++ Makefile.tpl (working copy)
@@ -1047,6 +1047,11 @@ configure-[+prefix+][+module+]: [+ IF bo
$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
[+exports+] [+extra_exports+] \
echo Configuring in [+subdir+]/[+module+]; \
+ [+ IF (= (get "module") "test-gcc") +] \
+ this_target="ia64-elf"; \
+ [+ ELSE +] \
+ this_target="[+target_alias+]"; \
+ [+ ENDIF +] \
cd "[+subdir+]/[+module+]" || exit 1; \
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -1059,7 +1064,7 @@ configure-[+prefix+][+module+]: [+ IF bo
$$s/$$module_srcdir/configure \
--srcdir=$${topdir}/$$module_srcdir \
[+args+] --build=${build_alias} --host=[+host_alias+] \
- --target=[+target_alias+] [+extra_configure_flags+] \
+ --target=$${this_target} [+extra_configure_flags+] \
|| exit 1
@endif [+prefix+][+module+]
Index: configure.ac
===================================================================
--- configure.ac (revision 240029)
+++ configure.ac (working copy)
@@ -140,7 +140,7 @@ host_libs="intl libiberty opcodes bfd re
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
# If --enable-gold is used, "gold" may replace "ld".
-host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
+host_tools="texinfo flex bison binutils gas ld fixincludes test-gcc gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
# libgcj represents the runtime libraries only used by gcj.
libgcj="target-libffi \
@@ -305,6 +305,15 @@ AC_ARG_ENABLE(offload-targets,
fi
], [enable_offload_targets=])
+AC_ARG_ENABLE(gcc-rtl-test,
+[AS_HELP_STRING([[--enable-gcc-rtl-test[=ARG]]],
+ [build the rtl selftest compiler])],
+ENABLE_RTL_SELFTEST=$enableval,
+ENABLE_RTL_SELFTEST=no)
+case "${ENABLE_RTL_SELFTEST}" in
+ no) skipdirs="${skipdirs} test-gcc" ;;
+esac
+
# Handle --enable-gold, --enable-ld.
# --disable-gold [--enable-ld]
# Build only ld. Default option.
@@ -2246,7 +2255,15 @@ done
configdirs_all="$configdirs"
configdirs=
for i in ${configdirs_all} ; do
- if test -f ${srcdir}/$i/configure ; then
+ case $i in
+ test-gcc)
+ confsrcdir=gcc
+ ;;
+ *)
+ confsrcdir=$i
+ ;;
+ esac
+ if test -f ${srcdir}/${confsrcdir}/configure ; then
configdirs="${configdirs} $i"
fi
done