Skip to content

Commit 80623f2

Browse files
t-8chNicolas Schier
authored andcommitted
init: deduplicate cc-can-link.sh invocations
The command to invoke scripts/cc-can-link.sh is very long and new usages are about to be added. Add a helper variable to make the code easier to read and maintain. Signed-off-by: Thomas Weißschuh <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Nicolas Schier <[email protected]>
1 parent d81d9d3 commit 80623f2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

init/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ config RUSTC_LLVM_VERSION
8484

8585
config CC_CAN_LINK
8686
bool
87-
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag)) if 64BIT
88-
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag))
87+
default $(cc_can_link_user,$(m64-flag)) if 64BIT
88+
default $(cc_can_link_user,$(m32-flag))
8989

9090
# Fixed in GCC 14, 13.3, 12.4 and 11.5
9191
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921

scripts/Kconfig.include

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$
6565
m32-flag := $(cc-option-bit,-m32)
6666
m64-flag := $(cc-option-bit,-m64)
6767

68+
# Test whether the compiler can link userspace applications
69+
cc_can_link_user = $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(1))
70+
6871
rustc-version := $(shell,$(srctree)/scripts/rustc-version.sh $(RUSTC))
6972
rustc-llvm-version := $(shell,$(srctree)/scripts/rustc-llvm-version.sh $(RUSTC))
7073

0 commit comments

Comments
 (0)