diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2022-02-14 23:51:07 +0100 |
---|---|---|
committer | Hans-Peter Nilsson <hp@bitrange.com> | 2022-02-14 23:51:07 +0100 |
commit | dc4e1fde36d7eb1a5ae2064b3ec545b1b0fcee8a (patch) | |
tree | b4496b7208674f7e39c00a8c2b69bda7b44b29c3 /sim/m4 | |
parent | e7e980c6fa1205495ec66741da916f0b25941963 (diff) | |
download | binutils-dc4e1fde36d7eb1a5ae2064b3ec545b1b0fcee8a.zip binutils-dc4e1fde36d7eb1a5ae2064b3ec545b1b0fcee8a.tar.gz binutils-dc4e1fde36d7eb1a5ae2064b3ec545b1b0fcee8a.tar.bz2 |
sim: Fix use of out-of-tree assembler and linker when testing
With commit 7a259895bb2d "sim: testsuite: expand arch specific
toolchain settings", trying to use out-of-tree ld and as at test-time
broke for the "primary target", like when testing a release-tarball.
Subsequent to that commit, all assembler tests without in-tree-built
tools FAIL, getting errors when trying to call
$(abs_builddir)/../gas/as-new. But, that isn't the actual culprint;
it's actually it's its immediate predecessor, commit 8996c21067373
"sim: testsuite: setup per-port toolchain settings for multitarget
build", which hardcodes in-tree-paths to those tools instead of
considering e.g. $(<X>_FOR_TARGET), the preferred overridable variable
for single-target builds, as set up by the toplevel Makefile.
This commit calls GCC_TARGET_TOOL (a deceptive name; gcc-specific
features aren't used) from toplev/config/acx.m4, somewhat like calls
in toplev/configure.ac but without the NCN_STRICT_CHECK_TARGET_TOOLS
step, for each X to find a value for $(<X>_FOR_TARGET). N.B.: in-tree
tools still override any ${target}-${tool} found in $PATH, i.e. only
previously broken builds are affected.
The variables $(<X>_FOR_TARGET) are usually overridden by the toplevel
Makefile to the same value or better, but has to be set here too, as
automake "wants" Makefiles to be self-contained (you get an error
pointing out that the variable may be empty). If it hadn't been for
that, SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET would not be needed.
This detail should only (positively) affect users invoking "make
check" in sim/ instead of "make check-sim" (or "make check") at the
toplevel. Now the output from "configure" matches the target tools
actually used by sim at test-time, for the "primary target".
Using $(CC) for "example-" targets CC_FOR_TARGET is not changed, as
that appears to be a deliberate special-case.
Note that all tools still have to be installed and present in
$PATH at configure-time to be properly used at test-time.
sim:
* m4/sim_ac_toolchain.m4 (SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET):
New defun.
(SIM_TOOLCHAIN_VARS): Call it using AC_REQUIRE, and use variables
AS_FOR_TARGET, LD_FOR_TARGET and CC_FOR_TARGET instead of hard-coded
values.
* Makefile.in, configure: Regenerate.
Diffstat (limited to 'sim/m4')
-rw-r--r-- | sim/m4/sim_ac_toolchain.m4 | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sim/m4/sim_ac_toolchain.m4 b/sim/m4/sim_ac_toolchain.m4 index 09b8705..7453214 100644 --- a/sim/m4/sim_ac_toolchain.m4 +++ b/sim/m4/sim_ac_toolchain.m4 @@ -78,24 +78,31 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_SUBST(C_DIALECT) ]) dnl + +AC_DEFUN([SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET], +[dnl +GCC_TARGET_TOOL([cc], [CC_FOR_TARGET], [CC], [${target_alias}-gcc]) +GCC_TARGET_TOOL([as], [AS_FOR_TARGET], [AS], [\$(abs_builddir)/../gas/as-new]) +GCC_TARGET_TOOL([ld], [LD_FOR_TARGET], [LD], [\$(abs_builddir)/../ld/ld-new]) +]) + SIM_TOOLCHAIN_VARS= AC_SUBST(SIM_TOOLCHAIN_VARS) AC_DEFUN([_SIM_AC_TOOLCHAIN_FOR_TARGET], [dnl +AC_REQUIRE([SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET]) AC_ARG_VAR(AS_FOR_TARGET_$2, [Assembler for $1 tests]) AC_ARG_VAR(LD_FOR_TARGET_$2, [Linker for $1 tests]) AC_ARG_VAR(CC_FOR_TARGET_$2, [C compiler for $1 tests]) m4_bmatch($1, [example-], [dnl - : "${AS_FOR_TARGET_$2:=\$(abs_builddir)/../gas/as-new}" - : "${LD_FOR_TARGET_$2:=\$(abs_builddir)/../ld/ld-new}" + : "${AS_FOR_TARGET_$2:=\$(AS_FOR_TARGET)}" + : "${LD_FOR_TARGET_$2:=\$(LD_FOR_TARGET)}" : "${CC_FOR_TARGET_$2:=\$(CC)}" ], [dnl AS_IF([test "$SIM_PRIMARY_TARGET" = "$1"], [dnl - : "${AS_FOR_TARGET_$2:=\$(abs_builddir)/../gas/as-new}" - : "${LD_FOR_TARGET_$2:=\$(abs_builddir)/../ld/ld-new}" - dnl The default will be checked at test time. If it's not available, then - dnl it is automatically skipped. So hardcoding this is safe. - : "${CC_FOR_TARGET_$2:=${target_alias}-gcc}" + : "${AS_FOR_TARGET_$2:=\$(AS_FOR_TARGET)}" + : "${LD_FOR_TARGET_$2:=\$(LD_FOR_TARGET)}" + : "${CC_FOR_TARGET_$2:=\$(CC_FOR_TARGET)}" ]) ]) AS_VAR_APPEND([SIM_TOOLCHAIN_VARS], [" AS_FOR_TARGET_$2 LD_FOR_TARGET_$2 CC_FOR_TARGET_$2"]) |