From: Nathan Chancellor Date: Wed, 15 Feb 2023 18:41:15 +0000 (-0700) Subject: powerpc/boot: Only use '-mabi=elfv2' with CONFIG_PPC64_BOOT_WRAPPER X-Git-Tag: v6.6.7~2957^2~141 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1c5accacb234c3a9f1609a73b4b2eaa4ef07d1a;p=platform%2Fkernel%2Flinux-starfive.git powerpc/boot: Only use '-mabi=elfv2' with CONFIG_PPC64_BOOT_WRAPPER When CONFIG_PPC64_ELF_ABI_V2 is enabled with clang through CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2, building the powerpc boot wrapper in 32-bit mode (i.e. with CONFIG_PPC64_BOOT_WRAPPER=n) fails with: error: unknown target ABI 'elfv2' The ABI cannot be changed with '-m32'; GCC silently accepts it but clang errors out. Only provide '-mabi=elfv2' when CONFIG_PPC64_BOOT_WRAPPER is enabled, which is the only way '-mabi=elfv2' will be useful. Tested-by: "Erhard F." Signed-off-by: Nathan Chancellor Signed-off-by: Michael Ellerman Link: https://msgid.link/20230118-ppc64-elfv2-llvm-v1-1-b9e2ec9da11d@kernel.org --- diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 295f76df13b5..08071bac056d 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -40,6 +40,9 @@ BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ ifdef CONFIG_PPC64_BOOT_WRAPPER BOOTCFLAGS += -m64 +ifdef CONFIG_PPC64_ELF_ABI_V2 +BOOTCFLAGS += $(call cc-option,-mabi=elfv2) +endif else BOOTCFLAGS += -m32 endif @@ -61,9 +64,6 @@ BOOTCFLAGS += -mbig-endian else BOOTCFLAGS += -mlittle-endian endif -ifdef CONFIG_PPC64_ELF_ABI_V2 -BOOTCFLAGS += $(call cc-option,-mabi=elfv2) -endif BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc