Re: [PATCH 10/12] efi/libstub: Remove obsolete .note.gnu.property workaround

Nick Desaulniers <[email protected]>
Newsgroups org.kernel.vger.live-patching,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-toolchains
Message-ID <CAKwvOd=Vn4L1sJ=8zVk9qcDLtaDYxfxn+0aG4tMrbETsqY5_PQ@mail.gmail.com>
On Fri, Aug 14, 2026 at 9:45 PM Josh Poimboeuf <[email protected]> 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 <[email protected]>

>
> 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 <[email protected]>
> ---
>  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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.