linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Dave Martin <Dave.Martin@arm.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	clang-built-linux@googlegroups.com,
	Nathan Chancellor <natechancellor@gmail.com>,
	Qian Cai <cai@lca.pw>
Subject: [PATCH] arm64: Don't unconditionally add -Wno-psabi to KBUILD_CFLAGS
Date: Fri,  7 Jun 2019 09:12:01 -0700	[thread overview]
Message-ID: <20190607161201.73430-1-natechancellor@gmail.com> (raw)

This is a GCC only option, which warns about ABI changes within GCC, so
unconditionally adding breaks Clang with tons of:

warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]

and link time failures:

ld.lld: error: undefined symbol: __efistub___stack_chk_guard
>>> referenced by arm-stub.c:73
(/home/nathan/cbl/linux/drivers/firmware/efi/libstub/arm-stub.c:73)
>>>               arm-stub.stub.o:(__efistub_install_memreserve_table)
in archive ./drivers/firmware/efi/libstub/lib.a

I suspect the link time failure comes from some flags not being added
via cc-option, which will always fail when an unknown flag is
unconditionally added to KBUILD_CFLAGS because -Werror is added after
commit c3f0d0bc5b01 ("kbuild, LLVMLinux: Add -Werror to cc-option to
support clang").

$ echo "int main() { return 0; }" | clang -Wno-psabi -o /dev/null -x c -
warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
1 warning generated.

$ echo $?
0

$ echo "int main() { return 0; }" | clang -Werror -Wno-psabi -o /dev/null -x c -
error: unknown warning option '-Wno-psabi' [-Werror,-Wunknown-warning-option]

$ echo $?
1

This side effect is user visible (aside from the inordinate amount of
-Wunknown-warning-option and build failure), as some warnings that are
normally disabled like -Waddress-of-packed-member or
-Wunused-const-variable show up.

Use cc-disable-warning so that it gets disabled for GCC and does nothing
for Clang.

Fixes: ebcc5928c5d9 ("arm64: Silence gcc warnings about arch ABI drift")
Link: https://github.com/ClangBuiltLinux/linux/issues/511
Reported-by: Qian Cai <cai@lca.pw>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 arch/arm64/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 8fbd583b18e1..e9d2e578cbe6 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -51,7 +51,7 @@ endif
 
 KBUILD_CFLAGS	+= -mgeneral-regs-only $(lseinstr) $(brokengasinst)
 KBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables
-KBUILD_CFLAGS	+= -Wno-psabi
+KBUILD_CFLAGS	+= $(call cc-disable-warning, psabi)
 KBUILD_AFLAGS	+= $(lseinstr) $(brokengasinst)
 
 KBUILD_CFLAGS	+= $(call cc-option,-mabi=lp64)
-- 
2.22.0.rc3


             reply	other threads:[~2019-06-07 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-07 16:12 Nathan Chancellor [this message]
2019-06-07 16:24 ` [PATCH] arm64: Don't unconditionally add -Wno-psabi to KBUILD_CFLAGS Dave Martin
2019-06-07 16:27 ` Nick Desaulniers
2019-06-11 17:19 ` [PATCH v2] " Nathan Chancellor
2019-06-12  9:25   ` Dave Martin
2019-06-12  9:33     ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190607161201.73430-1-natechancellor@gmail.com \
    --to=natechancellor@gmail.com \
    --cc=Dave.Martin@arm.com \
    --cc=cai@lca.pw \
    --cc=catalin.marinas@arm.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).