Skip to content

Commit 3b13360

Browse files
committed
Add --with-extra-multilib-test option
NOTE: This is toolchain developer facing feature. This allow user to add extra testing multi-lib arch, it's useful when develop and/or testing new extensions. Usage: --with-extra-multilib-test="arch-abi[;arch-abi]" e.g. linux enable enabled multilib, so default will build with follwoing configuration: lib32/ilp32;@march=rv32imac@mabi=ilp32 lib32/ilp32d;@march=rv32imafdc@mabi=ilp32d lib64/lp64;@march=rv64imac@mabi=lp64 lib64/lp64d;@march=rv64imafdc@mabi=lp64d But you want to testing more on vector stuffs like rv32gcv and rv64gcv, then you can configure with `--with-extra-multilib-test="rv32gcv-ilp32d;rv64gcv;lp64d"` Then the testing will run rv32imac-ilp32 rv32imafdc-ilp32d rv64imac-lp64 rv64imafdc-lp64d and rv32gcv-ilp32d;rv64gcv;lp64d! NOTE: Extra multilib test settings still require existing multilib has support those extra settings, e.g. you can't add rv32imafc_zbb-ilp32f on above example since no compatible multilib has provided.
1 parent d0d0730 commit 3b13360

File tree

4 files changed

+56
-3
lines changed

4 files changed

+56
-3
lines changed

Makefile.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ endif
6969
GLIBC_MULTILIB_NAMES := @glibc_multilib_names@
7070
GCC_CHECKING_FLAGS := @gcc_checking@
7171

72+
EXTRA_MULTILIB_TEST := @extra_multilib_test@
73+
7274
XLEN := $(shell echo $(WITH_ARCH) | tr A-Z a-z | sed 's/.*rv\([0-9]*\).*/\1/')
7375
ifneq ($(XLEN),32)
7476
XLEN := 64
@@ -91,12 +93,12 @@ GDB_NATIVE_FLAGS := $(GDB_NATIVE_FLAGS_EXTRA)
9193
GLIBC_TARGET_FLAGS := $(GLIBC_TARGET_FLAGS_EXTRA)
9294
GLIBC_CC_FOR_TARGET ?= $(LINUX_TUPLE)-gcc
9395
GLIBC_CXX_FOR_TARGET ?= $(LINUX_TUPLE)-g++
94-
GLIBC_TARGET_BOARDS ?= $(shell echo "$(GLIBC_MULTILIB_NAMES)" | sed 's!\([_a-z0-9]*\)-\([_a-z0-9]*\)!riscv-sim/-march=\1/-mabi=\2/@cmodel@!g')
96+
GLIBC_TARGET_BOARDS ?= $(shell echo "$(GLIBC_MULTILIB_NAMES) $(EXTRA_MULTILIB_TEST)" | sed 's!\([_a-z0-9]*\)-\([_a-z0-9]*\)!riscv-sim/-march=\1/-mabi=\2/@cmodel@!g')
9597

9698
NEWLIB_CC_FOR_TARGET ?= $(NEWLIB_TUPLE)-gcc
9799
NEWLIB_CXX_FOR_TARGET ?= $(NEWLIB_TUPLE)-g++
98-
NEWLIB_TARGET_BOARDS ?= $(shell echo "$(NEWLIB_MULTILIB_NAMES)" | sed 's!\([_a-z0-9]*\)-\([_a-z0-9]*\)!riscv-sim/-march=\1/-mabi=\2/@cmodel@!g')
99-
NEWLIB_NANO_TARGET_BOARDS ?= $(shell echo "$(NEWLIB_MULTILIB_NAMES)" | sed 's!\([_a-z0-9]*\)-\([_a-z0-9]*\)!riscv-sim-nano/-march=\1/-mabi=\2/@cmodel@!g')
100+
NEWLIB_TARGET_BOARDS ?= $(shell echo "$(NEWLIB_MULTILIB_NAMES) $(EXTRA_MULTILIB_TEST)" | sed 's!\([_a-z0-9]*\)-\([_a-z0-9]*\)!riscv-sim/-march=\1/-mabi=\2/@cmodel@!g')
101+
NEWLIB_NANO_TARGET_BOARDS ?= $(shell echo "$(NEWLIB_MULTILIB_NAMES) $(EXTRA_MULTILIB_TEST)" | sed 's!\([_a-z0-9]*\)-\([_a-z0-9]*\)!riscv-sim-nano/-march=\1/-mabi=\2/@cmodel@!g')
100102
NEWLIB_CC_FOR_MULTILIB_INFO := $(NEWLIB_CC_FOR_TARGET)
101103

102104
MUSL_TARGET_FLAGS := $(MUSL_TARGET_FLAGS_EXTRA)

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,21 @@ The command below can be used to run the glibc tests:
246246

247247
make check-glibc-linux
248248

249+
##### Adding more arch/abi combination for testing without introducing multilib
250+
251+
`--with-extra-multilib-test` can be used when you want to test more combination
252+
of arch/ABI, for example: built a linux toolchain with multilib with
253+
`rv64gc/lp64d` and `rv64imac/lp64`, but you want to test more configuration like
254+
`rv64gcv/lp64d` or `rv64gcv_zba/lp64d`, then you can use --with-extra-multilib-test
255+
to specify that via `--with-extra-multilib-test="rv64gcv-lp64d;rv64gcv_zba-lp64d"`,
256+
then the testing will run for `rv64gc/lp64d`, `rv64imac/lp64`, `rv64gcv/lp64d`
257+
and `rv64gcv_zba/lp64d`.
258+
259+
`--with-extra-multilib-test` support bare-metal and linux toolchain and support
260+
even multilib is disable, but the user must ensure extra multilib test
261+
configuration can be work with existing lib/multilib, e.g. rv32gcv/ilp32 test
262+
can't work if multilib didn't have any rv32 multilib.
263+
249264
### LLVM / clang
250265

251266
LLVM can be used in combination with the RISC-V GNU Compiler Toolchain

configure

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ musl_multilib_names
614614
newlib_multilib_names
615615
glibc_multilib_names
616616
multilib_flags
617+
extra_multilib_test
617618
multilib_gen
618619
WITH_SIM
619620
WITH_ISA_SPEC
@@ -689,6 +690,7 @@ with_isa_spec
689690
with_sim
690691
enable_multilib
691692
with_multilib_generator
693+
with_extra_multilib_test
692694
enable_gcc_checking
693695
with_cmodel
694696
with_target_cflags
@@ -1359,6 +1361,13 @@ Optional Packages:
13591361
Multi-libs configuration string, only supported for
13601362
bare-metal/elf toolchain, this option implied
13611363
--enable-multilib
1364+
--with-extra-multilib-test
1365+
Adding extra multi-libs configuration for testing,
1366+
this can be use even --disable-multilib, but be
1367+
aware user need to make sure those extra multilib
1368+
set can work/compatible with existing multi-libs,
1369+
format: <arch>-<abi>;<arch>-<abi> e.g:
1370+
--with-extra-multilib-test="rv64gcv-lp64;rv64gcv_zba-lp64"
13621371
--with-cmodel Select the code model to use when building libc and
13631372
libgcc [--with-cmodel=medlow]
13641373
--with-target-cflags Add extra target flags for C for library code
@@ -3417,6 +3426,16 @@ else
34173426
fi
34183427
34193428
3429+
3430+
# Check whether --with-extra-multilib-test was given.
3431+
if test "${with_extra_multilib_test+set}" = set; then :
3432+
withval=$with_extra_multilib_test;
3433+
else
3434+
with_extra_multilib_test=no
3435+
3436+
fi
3437+
3438+
34203439
if test "x$with_multilib_generator" != xno; then :
34213440
multilib_gen="$with_multilib_generator"
34223441
@@ -3425,6 +3444,13 @@ else
34253444
34263445
fi
34273446
3447+
if test "x$with_extra_multilib_test" != xno; then :
3448+
extra_multilib_test="$with_extra_multilib_test"
3449+
3450+
else
3451+
extra_multilib_test=""
3452+
3453+
fi
34283454
34293455
if test "x$enable_multilib" != xno || test "x$with_multilib_generator" != xno; then :
34303456
multilib_flags=--enable-multilib

configure.ac

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,20 @@ AC_ARG_WITH(multilib-generator,
135135
[with_multilib_generator=no]
136136
)
137137

138+
AC_ARG_WITH(extra-multilib-test,
139+
[AS_HELP_STRING([--with-extra-multilib-test],
140+
[Adding extra multi-libs configuration for testing, this can be use even --disable-multilib, but be aware user need to make sure those extra multilib set can work/compatible with existing multi-libs, format: <arch>-<abi>;<arch>-<abi> e.g: --with-extra-multilib-test="rv64gcv-lp64;rv64gcv_zba-lp64"])],
141+
[],
142+
[with_extra_multilib_test=no]
143+
)
144+
138145
AS_IF([test "x$with_multilib_generator" != xno],
139146
[AC_SUBST(multilib_gen,"$with_multilib_generator")],
140147
[AC_SUBST(multilib_gen,"")])
141148

149+
AS_IF([test "x$with_extra_multilib_test" != xno],
150+
[AC_SUBST(extra_multilib_test,"$with_extra_multilib_test")],
151+
[AC_SUBST(extra_multilib_test,"")])
142152

143153
AS_IF([test "x$enable_multilib" != xno || test "x$with_multilib_generator" != xno],
144154
[AC_SUBST(multilib_flags,--enable-multilib)],

0 commit comments

Comments
 (0)