diff mbox series

[4/4] um: Use CFLAGS_vmlinux

Message ID 20230112-um-v1-4-6bec9e97ad13@pefoley.com
State Accepted
Headers show
Series um: Various build fixes for allyesconfig | expand

Commit Message

Peter Foley Jan. 13, 2023, 4:49 a.m. UTC
link-vmlinux.sh doesn't use LDFLAGS_vmlinux when linking the kernel for
UML. Move the LDFLAGS_EXESTACK options into CFLAGS_vmlinux so they're
actually respected.

e.g.
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: warning: .tmp_vmlinux.kallsyms3.o: missing .note.GNU-stack section implies executable stack
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: warning: vmlinux has a LOAD segment with RWX permissions
---
 arch/um/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

David Gow Jan. 13, 2023, 6:43 a.m. UTC | #1
On Fri, 13 Jan 2023 at 12:49, Peter Foley <pefoley2@pefoley.com> wrote:
>
> link-vmlinux.sh doesn't use LDFLAGS_vmlinux when linking the kernel for
> UML. Move the LDFLAGS_EXESTACK options into CFLAGS_vmlinux so they're
> actually respected.
>
> e.g.
> /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: warning: .tmp_vmlinux.kallsyms3.o: missing .note.GNU-stack section implies executable stack
> /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
> /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: warning: vmlinux has a LOAD segment with RWX permissions
> ---

Thanks very much for fixing this -- the LDFLAGS/CFLAGS fun here always
trips me up!

Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David


>  arch/um/Makefile | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/um/Makefile b/arch/um/Makefile
> index f1d4d67157be..93dfb23bd263 100644
> --- a/arch/um/Makefile
> +++ b/arch/um/Makefile
> @@ -139,11 +139,10 @@ ifeq ($(CONFIG_LD_IS_BFD),y)
>  LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments)
>  endif
>
> -LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
> +LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS) $(LDFLAGS_EXECSTACK),-Wl,$(opt))
>
>  # Used by link-vmlinux.sh which has special support for um link
>  export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
> -export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK)
>
>  # When cleaning we don't include .config, so we don't include
>  # TT or skas makefiles and don't clean skas_ptregs.h.
>
> --
> 2.39.0
>
> _______________________________________________
> linux-um mailing list
> linux-um@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-um
diff mbox series

Patch

diff --git a/arch/um/Makefile b/arch/um/Makefile
index f1d4d67157be..93dfb23bd263 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -139,11 +139,10 @@  ifeq ($(CONFIG_LD_IS_BFD),y)
 LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments)
 endif
 
-LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
+LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS) $(LDFLAGS_EXECSTACK),-Wl,$(opt))
 
 # Used by link-vmlinux.sh which has special support for um link
 export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
-export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK)
 
 # When cleaning we don't include .config, so we don't include
 # TT or skas makefiles and don't clean skas_ptregs.h.