* [PATCH 0/2] selftests/nolibc: fix loongarch build with recent versions of clang
@ 2025-11-22 11:01 Thomas Weißschuh
2025-11-22 11:01 ` [PATCH 1/2] selftests/nolibc: use lld to link loongarch binaries Thomas Weißschuh
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2025-11-22 11:01 UTC (permalink / raw)
To: Willy Tarreau, Shuah Khan
Cc: linux-kselftest, linux-kernel, Thomas Weißschuh
LLVM 21 switched to -mcmodel=medium for LoongArch64 compilations.
This code model uses R_LARCH_ECALL36 relocations which might not be
supported by GNU ld which the nolibc testsuite uses by default.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (2):
selftests/nolibc: use lld to link loongarch binaries
selftests/nolibc: error out on linker warnings
tools/testing/selftests/nolibc/Makefile.nolibc | 1 +
tools/testing/selftests/nolibc/run-tests.sh | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
---
base-commit: 6059e06967aaac9bf736c6cec75b9bccaf5bbe18
change-id: 20251121-nolibc-lld-f32af4983cc0
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] selftests/nolibc: use lld to link loongarch binaries
2025-11-22 11:01 [PATCH 0/2] selftests/nolibc: fix loongarch build with recent versions of clang Thomas Weißschuh
@ 2025-11-22 11:01 ` Thomas Weißschuh
2025-11-22 11:01 ` [PATCH 2/2] selftests/nolibc: error out on linker warnings Thomas Weißschuh
2025-11-22 11:14 ` [PATCH 0/2] selftests/nolibc: fix loongarch build with recent versions of clang Willy Tarreau
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2025-11-22 11:01 UTC (permalink / raw)
To: Willy Tarreau, Shuah Khan
Cc: linux-kselftest, linux-kernel, Thomas Weißschuh
LLVM 21 switched to -mcmodel=medium for LoongArch64 compilations.
This code model uses R_LARCH_ECALL36 relocations which might not be
supported by GNU ld which to nolibc testsuite uses by default.
ld will not resolve the relocation and all function calls will end up
as busy loops.
Use lld instead.
We can not switch to lld for all LLVM builds, as it does not support all
necessary architectures.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
tools/testing/selftests/nolibc/Makefile.nolibc | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
index 330e000baeb1..9423f4a959b2 100644
--- a/tools/testing/selftests/nolibc/Makefile.nolibc
+++ b/tools/testing/selftests/nolibc/Makefile.nolibc
@@ -230,6 +230,7 @@ CFLAGS_mipsn32le = -EL -mabi=n32 -fPIC -march=mips64r2
CFLAGS_mipsn32be = -EB -mabi=n32 -march=mips64r6
CFLAGS_mips64le = -EL -mabi=64 -march=mips64r6
CFLAGS_mips64be = -EB -mabi=64 -march=mips64r2
+CFLAGS_loongarch = $(if $(LLVM),-fuse-ld=lld)
CFLAGS_sparc32 = $(call cc-option,-m32)
CFLAGS_sh4 = -ml -m4
ifeq ($(origin XARCH),command line)
--
2.52.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] selftests/nolibc: error out on linker warnings
2025-11-22 11:01 [PATCH 0/2] selftests/nolibc: fix loongarch build with recent versions of clang Thomas Weißschuh
2025-11-22 11:01 ` [PATCH 1/2] selftests/nolibc: use lld to link loongarch binaries Thomas Weißschuh
@ 2025-11-22 11:01 ` Thomas Weißschuh
2025-11-22 11:14 ` [PATCH 0/2] selftests/nolibc: fix loongarch build with recent versions of clang Willy Tarreau
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2025-11-22 11:01 UTC (permalink / raw)
To: Willy Tarreau, Shuah Khan
Cc: linux-kselftest, linux-kernel, Thomas Weißschuh
If the linker emits warnings these should abort the build.
Otherwise they will be swallowed by run-tests.sh and not shown.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
tools/testing/selftests/nolibc/run-tests.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
index e8af1fb505cf..bbe8afbabd3a 100755
--- a/tools/testing/selftests/nolibc/run-tests.sh
+++ b/tools/testing/selftests/nolibc/run-tests.sh
@@ -169,7 +169,7 @@ test_arch() {
cross_compile=$(realpath "${download_location}gcc-${crosstool_version}-nolibc/${ct_arch}-${ct_abi}/bin/${ct_arch}-${ct_abi}-")
build_dir="${build_location}/${arch}"
if [ "$werror" -ne 0 ]; then
- CFLAGS_EXTRA="$CFLAGS_EXTRA -Werror"
+ CFLAGS_EXTRA="$CFLAGS_EXTRA -Werror -Wl,--fatal-warnings"
fi
MAKE=(make -f Makefile.nolibc -j"${nproc}" XARCH="${arch}" CROSS_COMPILE="${cross_compile}" LLVM="${llvm}" O="${build_dir}")
--
2.52.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] selftests/nolibc: fix loongarch build with recent versions of clang
2025-11-22 11:01 [PATCH 0/2] selftests/nolibc: fix loongarch build with recent versions of clang Thomas Weißschuh
2025-11-22 11:01 ` [PATCH 1/2] selftests/nolibc: use lld to link loongarch binaries Thomas Weißschuh
2025-11-22 11:01 ` [PATCH 2/2] selftests/nolibc: error out on linker warnings Thomas Weißschuh
@ 2025-11-22 11:14 ` Willy Tarreau
2 siblings, 0 replies; 4+ messages in thread
From: Willy Tarreau @ 2025-11-22 11:14 UTC (permalink / raw)
To: Thomas Weißschuh; +Cc: Shuah Khan, linux-kselftest, linux-kernel
On Sat, Nov 22, 2025 at 12:01:56PM +0100, Thomas Weißschuh wrote:
> LLVM 21 switched to -mcmodel=medium for LoongArch64 compilations.
> This code model uses R_LARCH_ECALL36 relocations which might not be
> supported by GNU ld which the nolibc testsuite uses by default.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Both patches make sense to me, thanks Thomas!
FWIW for the whole series: Acked-by: Willy Tarreau <w@1wt.eu>
Willy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-22 11:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-22 11:01 [PATCH 0/2] selftests/nolibc: fix loongarch build with recent versions of clang Thomas Weißschuh
2025-11-22 11:01 ` [PATCH 1/2] selftests/nolibc: use lld to link loongarch binaries Thomas Weißschuh
2025-11-22 11:01 ` [PATCH 2/2] selftests/nolibc: error out on linker warnings Thomas Weißschuh
2025-11-22 11:14 ` [PATCH 0/2] selftests/nolibc: fix loongarch build with recent versions of clang Willy Tarreau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox