In preparation for adding --orphan-handling=warn to more architectures,
this disables -mbranch-protection, as EFI does not yet support it[1].
This was noticed due to it producing unwanted .note.gnu.property sections
(prefixed with .init due to the objcopy build step).

[1] 
https://lore.kernel.org/lkml/CAMj1kXHck12juGi=E=p4hwp_8vqhq+-x3vbmc3tgerwdq-x...@mail.gmail.com

Cc: Ard Biesheuvel <[email protected]>
Cc: Arvind Sankar <[email protected]>
Cc: Atish Patra <[email protected]>
Cc: [email protected]
Signed-off-by: Kees Cook <[email protected]>
---
 drivers/firmware/efi/libstub/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/Makefile 
b/drivers/firmware/efi/libstub/Makefile
index 75daaf20374e..10fa342ef40c 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -18,7 +18,8 @@ cflags-$(CONFIG_X86)          += -m$(BITS) -D__KERNEL__ \
 # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly
 # disable the stackleak plugin
 cflags-$(CONFIG_ARM64)         := $(subst 
$(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \
-                                  -fpie $(DISABLE_STACKLEAK_PLUGIN)
+                                  -fpie $(DISABLE_STACKLEAK_PLUGIN) \
+                                  $(call cc-option,-mbranch-protection=none)
 cflags-$(CONFIG_ARM)           := $(subst 
$(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \
                                   -fno-builtin -fpic \
                                   $(call cc-option,-mno-single-pic-base)
-- 
2.25.1

Reply via email to