Commit 801cf69c authored by Thomas Weißschuh's avatar Thomas Weißschuh

selftests/nolibc: don't use libgcc when building with clang

The logic in clang to find the libgcc.a from a GCC toolchain for a
specific ABI does not work reliably and can lead to errors.
Instead disable libgcc when building with clang, as it's not needed
anyways.
Acked-by: default avatarWilly Tarreau <w@1wt.eu>
Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240807-nolibc-llvm-v2-13-c20f2f5fc7c2@weissschuh.netSigned-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
parent 27e458bb
......@@ -157,6 +157,13 @@ CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wex
$(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA)
LDFLAGS :=
LIBGCC := -lgcc
ifneq ($(LLVM),)
# Not needed for clang
LIBGCC :=
endif
# Modify CFLAGS based on LLVM=
include $(srctree)/tools/scripts/Makefile.include
......@@ -209,11 +216,11 @@ sysroot/$(ARCH)/include:
ifneq ($(NOLIBC_SYSROOT),0)
nolibc-test: nolibc-test.c nolibc-test-linkage.c sysroot/$(ARCH)/include
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
-nostdlib -nostdinc -static -Isysroot/$(ARCH)/include nolibc-test.c nolibc-test-linkage.c -lgcc
-nostdlib -nostdinc -static -Isysroot/$(ARCH)/include nolibc-test.c nolibc-test-linkage.c $(LIBGCC)
else
nolibc-test: nolibc-test.c nolibc-test-linkage.c
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
-nostdlib -static -include $(srctree)/tools/include/nolibc/nolibc.h nolibc-test.c nolibc-test-linkage.c -lgcc
-nostdlib -static -include $(srctree)/tools/include/nolibc/nolibc.h nolibc-test.c nolibc-test-linkage.c $(LIBGCC)
endif
libc-test: nolibc-test.c nolibc-test-linkage.c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment