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: Willy Tarreau <w@1wt.eu> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Link: https://lore.kernel.org/r/20240807-nolibc-llvm-v2-13-c20f2f5fc7c2@weissschuh.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user