Makefile: Link with -z noexectack
PATCH 1/2 Makefile: Link with -z noexectack
When moving to gcc-12.2 we started trying to quiet some of the new linker warnings, that are not relevant to us. However, a misunderstanding of the mechanics at play meant that I intentionally omitted passing -z noexecstack to the linker, when we do need to. Add this flag and in turn remove warnings from the linker.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -806,6 +806,7 @@ KBUILD_CPPFLAGS += $(KCPPFLAGS) KBUILD_AFLAGS += $(KAFLAGS) KBUILD_CFLAGS += $(KCFLAGS) +KBUILD_LDFLAGS += -z noexecstack KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g)
Signature · 1 line
2.34.1
PATCH 2/2 x86: Pass -z execstack for EFI payload flags
To match how we link EFI executables elsewhere, and to silence a linker warning, pass -z execstack here as well.
--- arch/x86/config.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/config.mk +2 -1
@@ -37,7 +37,8 @@ KBUILD_LDFLAGS += -m $(if $(IS_32BIT),elf_i386,elf_x86_64) # This is used in the top-level Makefile which does not include # KBUILD_LDFLAGS -LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined -s +LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined \ + -s -zexecstack OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \ -j .rel -j .rela -j .reloc --strip-all
Signature · 1 line
2.34.1
Re: [PATCH 2/2] x86: Pass -z execstack for EFI payload flags
Quoted 6 lines · Tom Rini
To match how we link EFI executables elsewhere, and to silence a linker warning, pass -z execstack here as well.
Cc Bin Meng <[email protected]>Cc Heinrich Schuchardt <[email protected]>Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Quoted 7 lines · Tom Rini
When moving to gcc-12.2 we started trying to quiet some of the new linker warnings, that are not relevant to us. However, a misunderstanding of the mechanics at play meant that I intentionally omitted passing -z noexecstack to the linker, when we do need to. Add this flag and in turn remove warnings from the linker.
Quoted 6 lines
Fixes 1e1c51f8ace8 ("Makefile: link with --no-warn-rwx-segments")Signed-off-by Tom Rini <[email protected]>--- Makefile | 1 + 1 file changed, 1 insertion(+)
Quoted 9 lines · Tom Rini
When moving to gcc-12.2 we started trying to quiet some of the new linker warnings, that are not relevant to us. However, a misunderstanding of the mechanics at play meant that I intentionally omitted passing -z noexecstack to the linker, when we do need to. Add this flag and in turn remove warnings from the linker.
Fixes 1e1c51f8ace8 ("Makefile: link with --no-warn-rwx-segments")Signed-off-by Tom Rini <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom