aboutsummaryrefslogtreecommitdiff
path: root/sim/m4
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-06-23 23:23:27 -0400
committerMike Frysinger <vapier@gentoo.org>2021-11-28 21:55:15 -0500
commit8996c2106737302ebdf25bf993e1147065114893 (patch)
tree4a0bb2d86db4bf048e71471eb151284c3c96d4d6 /sim/m4
parentdba322be6e2cde20766c1b086ef492c0af2b3ae1 (diff)
downloadbinutils-8996c2106737302ebdf25bf993e1147065114893.zip
binutils-8996c2106737302ebdf25bf993e1147065114893.tar.gz
binutils-8996c2106737302ebdf25bf993e1147065114893.tar.bz2
sim: testsuite: setup per-port toolchain settings for multitarget build
Gas does not support multitarget builds -- it still only supports a single input & output format. ld is a bit better, but requires manual flags to select the right output. This makes it impossible to run the complete testsuite in a multitarget build. To address this limitation, create a suite of FOR_TARGET variables so these can be set to precompiled as & ld programs. It requires a bit of setup ahead of time, but it's a one-time cost, and makes running the full testsuite at once much easier.
Diffstat (limited to 'sim/m4')
-rw-r--r--sim/m4/sim_ac_toolchain.m425
1 files changed, 25 insertions, 0 deletions
diff --git a/sim/m4/sim_ac_toolchain.m4 b/sim/m4/sim_ac_toolchain.m4
index fdd5406..a85421f 100644
--- a/sim/m4/sim_ac_toolchain.m4
+++ b/sim/m4/sim_ac_toolchain.m4
@@ -77,3 +77,28 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
], [AC_MSG_ERROR([C11 is required])])])
AC_SUBST(C_DIALECT)
])
+dnl
+SIM_TOOLCHAIN_VARS=
+AC_SUBST(SIM_TOOLCHAIN_VARS)
+AC_DEFUN([_SIM_AC_TOOLCHAIN_FOR_TARGET],
+[dnl
+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}"
+ : "${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_VAR_APPEND([SIM_TOOLCHAIN_VARS], [" AS_FOR_TARGET_$2 LD_FOR_TARGET_$2 CC_FOR_TARGET_$2"])
+])
+AC_DEFUN([SIM_AC_TOOLCHAIN_FOR_TARGET],
+[_SIM_AC_TOOLCHAIN_FOR_TARGET($1, m4_toupper(m4_translit($1, [-], [_])))])