From: Sam Edwards Date: Sat, 15 Mar 2025 22:18:07 +0000 (-0700) Subject: makefile: Add `norelro` linker option X-Git-Tag: v2025.07-rc1~119^2~15^2~6 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a8121fe6d314b314531eee7487272601f469c1d;p=pandora-u-boot.git makefile: Add `norelro` linker option RELRO is an instruction to a dynamic loader to make a memory range read-only after relocations are applied, for added security. Some linkers (e.g. LLD) require that all sections covered by the RELRO are contiguous, so that only a single RELRO is needed. U-Boot at present neither satisfies this requirement (e.g. x86_64 linker script currently puts .dynamic too far from .got) nor preserves the RELRO when converting away from ELF, therefore add `-z norelro` to global linker options. This can be brought back in the future when the linker scripts are cleaned up and U-Boot understands RELROs. Signed-off-by: Sam Edwards Reviewed-by: Ilias Apalodimas --- diff --git a/Makefile b/Makefile index 9c353af17cd..05a93813afa 100644 --- a/Makefile +++ b/Makefile @@ -820,6 +820,7 @@ KBUILD_AFLAGS += $(KAFLAGS) KBUILD_CFLAGS += $(KCFLAGS) KBUILD_LDFLAGS += -z noexecstack +KBUILD_LDFLAGS += -z norelro KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g)