The following commit has been merged into the x86/build branch of tip: Commit-ID: 58d746c119dfa28e72fc35aacaf3d2a3ac625cd0 Gitweb: https://git.kernel.org/tip/58d746c119dfa28e72fc35aacaf3d2a3ac625cd0 Author: Nathan Chancellor <nathan@xxxxxxxxxx> AuthorDate: Thu, 25 Mar 2021 17:04:35 -07:00 Committer: Borislav Petkov <bp@xxxxxxx> CommitterDate: Fri, 26 Mar 2021 11:34:58 +01:00 efi/libstub: Add $(CLANG_FLAGS) to x86 flags When cross compiling x86 on an ARM machine with clang, there are several errors along the lines of: arch/x86/include/asm/page_64.h:52:7: error: invalid output constraint '=D' in asm This happens because the x86 flags in the EFI stub are not derived from KBUILD_CFLAGS like the other architectures are and the clang flags that set the target architecture ('--target=') and the path to the GNU cross tools ('--prefix=') are not present, meaning that the host architecture is targeted. These flags are available as $(CLANG_FLAGS) from the main Makefile so add them to the cflags for x86 so that cross compiling works as expected. Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx> Signed-off-by: Borislav Petkov <bp@xxxxxxx> Acked-by: Ard Biesheuvel <ardb@xxxxxxxxxx> Link: https://lkml.kernel.org/r/20210326000435.4785-4-nathan@xxxxxxxxxx --- 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 c23466e..d053757 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -13,7 +13,8 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \ -Wno-pointer-sign \ $(call cc-disable-warning, address-of-packed-member) \ $(call cc-disable-warning, gnu) \ - -fno-asynchronous-unwind-tables + -fno-asynchronous-unwind-tables \ + $(CLANG_FLAGS) # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly # disable the stackleak plugin