From 82ddd2bd76539021891d74797d6ab626f3cfe2f6 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 23 Sep 2026 17:34:32 +0200 Subject: [PATCH] um: improve checking for --no-warn-rwx-segments Since LLVM=1 might end up using different linkers for CC as linker and LD, use detect --no-warn-rwx-segments support using CC. Link: https://patch.msgid.link/20260923173523.15f90065ca57.I3079cffd8db3a639e93c3e2624c61bbebadc3cbd@changeid Signed-off-by: Johannes Berg --- arch/um/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/um/Makefile b/arch/um/Makefile index 937639edc295..d930c5f25fb9 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -134,9 +134,10 @@ LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc # Avoid binutils 2.39+ warnings by marking the stack non-executable and # ignorning warnings for the kallsyms sections. LDFLAGS_EXECSTACK = -z noexecstack -ifeq ($(CONFIG_LD_IS_BFD),y) -LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments) -endif +# check --no-warn-rwx-segments with CC-as-linker since that gets used +# for vmlinux and is where we need the option, in particular with LLVM=1 +# it might be different links (ld.bfd vs. ld.lld) +LDFLAGS_EXECSTACK += $(call try-run,$(CC) -Wl$(comma)--no-warn-rwx-segments -shared -x c /dev/null -o "$$TMP",--no-warn-rwx-segments) LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS) $(LDFLAGS_EXECSTACK),-Wl,$(opt))