|
| 1 | +From c7f5ef329953a798f1a06f87df3cdd38e31879bc Mon Sep 17 00:00:00 2001 |
| 2 | +From: Nathan Chancellor <natechancellor@gmail.com> |
| 3 | +Date: Fri, 7 Jun 2019 09:06:38 -0700 |
| 4 | +Subject: [PATCH] arm64: Don't unconditionally add -Wno-psabi to KBUILD_CFLAGS |
| 5 | + |
| 6 | +This is a GCC only option, which warns about ABI changes within GCC, so |
| 7 | +unconditionally adding breaks Clang with tons of: |
| 8 | + |
| 9 | +warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option] |
| 10 | + |
| 11 | +and link time failures: |
| 12 | + |
| 13 | +ld.lld: error: undefined symbol: __efistub___stack_chk_guard |
| 14 | +>>> referenced by arm-stub.c:73 |
| 15 | +(/home/nathan/cbl/linux/drivers/firmware/efi/libstub/arm-stub.c:73) |
| 16 | +>>> arm-stub.stub.o:(__efistub_install_memreserve_table) |
| 17 | +in archive ./drivers/firmware/efi/libstub/lib.a |
| 18 | + |
| 19 | +I suspect the link time failure comes from some flags not being added |
| 20 | +via cc-option, which will always fail when an unknown flag is |
| 21 | +unconditionally added to KBUILD_CFLAGS because -Werror is added after |
| 22 | +commit c3f0d0bc5b01 ("kbuild, LLVMLinux: Add -Werror to cc-option to |
| 23 | +support clang"). |
| 24 | + |
| 25 | +$ echo "int main() { return 0; }" | clang -Wno-psabi -o /dev/null -x c - |
| 26 | +warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option] |
| 27 | +1 warning generated. |
| 28 | + |
| 29 | +$ echo $? |
| 30 | +0 |
| 31 | + |
| 32 | +$ echo "int main() { return 0; }" | clang -Werror -Wno-psabi -o /dev/null -x c - |
| 33 | +error: unknown warning option '-Wno-psabi' [-Werror,-Wunknown-warning-option] |
| 34 | + |
| 35 | +$ echo $? |
| 36 | +1 |
| 37 | + |
| 38 | +This side effect is user visible (aside from the inordinate amount of |
| 39 | +-Wunknown-warning-option and build failure), as some warnings that are |
| 40 | +normally disabled like -Waddress-of-packed-member or |
| 41 | +-Wunused-const-variable show up. |
| 42 | + |
| 43 | +Use cc-disable-warning so that it gets disabled for GCC and does nothing |
| 44 | +for Clang. |
| 45 | + |
| 46 | +Fixes: ebcc5928c5d9 ("arm64: Silence gcc warnings about arch ABI drift") |
| 47 | +Link: https://github.com/ClangBuiltLinux/linux/issues/511 |
| 48 | +Reported-by: Qian Cai <cai@lca.pw> |
| 49 | +Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> |
| 50 | +--- |
| 51 | + arch/arm64/Makefile | 2 +- |
| 52 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 53 | + |
| 54 | +diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile |
| 55 | +index 8fbd583b18e1..e9d2e578cbe6 100644 |
| 56 | +--- a/arch/arm64/Makefile |
| 57 | ++++ b/arch/arm64/Makefile |
| 58 | +@@ -51,7 +51,7 @@ endif |
| 59 | + |
| 60 | + KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) |
| 61 | + KBUILD_CFLAGS += -fno-asynchronous-unwind-tables |
| 62 | +-KBUILD_CFLAGS += -Wno-psabi |
| 63 | ++KBUILD_CFLAGS += $(call cc-disable-warning, psabi) |
| 64 | + KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) |
| 65 | + |
| 66 | + KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) |
| 67 | +-- |
| 68 | +2.22.0.rc3 |
| 69 | + |
0 commit comments