From f484427d10a5ff6c2437c2f7c671e9e552ad6766 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Sun, 26 Mar 2023 10:58:35 +0200 Subject: [PATCH] ArmPkg, BaseTools AARCH64: Add BTI ELF note to .hii objects The ELF based toolchains use objcopy to create HII object files, which contain only a single .hii section. This means no GNU note is inserted that describes the object as compatible with BTI, even though the lack of executable code in such an object makes the distinction irrelevant. However, the linker will not add the note globally to the resulting ELF executable, and this breaks BTI compatibility. So let's insert a GNU BTI-compatible ELF note by hand when generating such object files. Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm Reviewed-by: Oliver Smith-Denny --- ArmPkg/Library/GnuNoteBti.bin | Bin 0 -> 32 bytes BaseTools/Conf/tools_def.template | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 ArmPkg/Library/GnuNoteBti.bin diff --git a/ArmPkg/Library/GnuNoteBti.bin b/ArmPkg/Library/GnuNoteBti.bin new file mode 100644 index 0000000000000000000000000000000000000000..339567b4e89943c610b44767ddad5f631229ed3b GIT binary patch literal 32 dcmZQ!U|