Re: [PATCH 10/12] efi/libstub: Remove obsolete .note.gnu.property workaround
From: Nick Desaulniers <ndesaulniers@google.com>
Date: 2026-08-17 19:55:00
Also in:
linux-arm-kernel, linux-toolchains, lkml
On Fri, Aug 14, 2026 at 9:45 PM Josh Poimboeuf [off-list ref] wrote:
Commit e2179a09ab08 ("efi/libstub: Disable -mbranch-protection") added
--remove-section=.note.gnu.property to the stub objcopy invocation to
work around a Clang bug where the note was emitted for code-less object
files even with -mbranch-protection=none.
That was fixed by LLVM commit a48f6079f288 ("[AArch64] Generate
.note.gnu.property based on module flags") which was released with
Clang 12. The minimum Clang version is now Clang 17, so this workaround
is no longer needed.
On arm64, the stub also no longer builds with -mbranch-protection=none,
as it has inherited the kernel's flags since commit 8358098b9787
("arm64: efi: Enable BTI codegen and add PE/COFF annotation").I verified the above all looks correct. Thanks for the cleanup. Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
quoted hunk ↗ jump to hunk
Remove the workaround. This fixes BTI on arm64, and is a no-op on RISC-V and LoongArch where the vmlinux generic NOTES macro discards it, and the x86 and ARM decompressors discard .note.* explicitly. Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> --- drivers/firmware/efi/libstub/Makefile | 6 ------ 1 file changed, 6 deletions(-)diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index b1c95f69e807d..e18e124a89acf 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile@@ -106,12 +106,6 @@ lib-$(CONFIG_UNACCEPTED_MEMORY) += unaccepted_memory.o bitmap.o find.o targets := $(lib-y) lib-y := $(patsubst %.o,%.stub.o,$(lib-y)) -# Even when -mbranch-protection=none is set, Clang will generate a -# .note.gnu.property for code-less object files (like lib/ctype.c), -# so work around this by explicitly removing the unwanted section. -# https://llvm.org/pr46480 -STUBCOPY_FLAGS-y += --remove-section=.note.gnu.property - STUBCOPY_RELOC-$(CONFIG_X86_32) := R_386_32 STUBCOPY_RELOC-$(CONFIG_X86_64) := R_X86_64_64 --2.55.0
-- Thanks, ~Nick Desaulniers