From patchwork Tue Jun 11 17:19:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10987917 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 786236C5 for ; Tue, 11 Jun 2019 17:21:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57BA6287AB for ; Tue, 11 Jun 2019 17:21:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 487C9287B1; Tue, 11 Jun 2019 17:21:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CA2BC287AB for ; Tue, 11 Jun 2019 17:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Nw4AmiivFutlwXTozFO2XFqF35bLExtT/g5PjsUw0q8=; b=sjXYYuF22REiZf xIgyFSZtimIa3w/cpaquMKbvX/wLSuKQLHqtvNT6z2uoveQFMQLm2AIwbItJzLqdhYxEcLwzav7Ay 1dfWZIpmiouFsBgCClI+lFjajU9SLbyn6+WWB4xGhDr3oNTPMpCRCo4vgRM6cAM+VkTyxUHGYbsGE eHSCxiJk+sEIb8IQrJj5zq23kzxFkmIbLmiR7DftuEX6qm1579/BVfBj82nhw5q1enSQDHeV9vIbZ L/n7FL1H6THQRh3xWQoBMz6gsFFu+t17VGl650F6aTPD78ueMZ7VdMqfKFzFibIsfrz+61bfZ+z09 u4mXaNqwvPHM3otEwM7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hakSV-0003PZ-RX; Tue, 11 Jun 2019 17:21:19 +0000 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hakSS-0003P8-FS for linux-arm-kernel@lists.infradead.org; Tue, 11 Jun 2019 17:21:18 +0000 Received: by mail-ed1-x542.google.com with SMTP id g13so21216429edu.5 for ; Tue, 11 Jun 2019 10:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oLZoCH+w0vEsUh5B0jjb151kNbWDekY9Hx2peXKMbk4=; b=p6M2O8JBT2y4hXNXJ+k4giMVUWIS/Vosq/FvvB5BUcx5CPLUCVhxMVpiKnBWJjmM+j bpuaGCRGv3v0FS4vVfk6v3U5vqxLynpHPLlsCXUykwcn1Ztl5JH+vHVIe7GMg0z+CPBr LzbhW4T+KhsMjCaPYzE5s6M5K9kOVr3z2uwec/+WMTXMQ3ppTHziHNvlDaySYajKXhpd FQvVjnanOlnC/2R6c/9V1sx0kbvm5T7fxtOXsSmsRjSSLd2u4doQFURIdkmck2CsNZu5 BLGgTvnkcl0ZS2Pst76joa7hhkGeR5KfgWZin00PDYtmQZsnEHwmJNw7N1jq6PrmoVG4 vh9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oLZoCH+w0vEsUh5B0jjb151kNbWDekY9Hx2peXKMbk4=; b=uhgdQc/EXI83IdTEQrQXLCxqUNInvbgm4wewSazJ+svfBKYaybVSHUxJxsyxMLFsgv aEiDSsdUXemiPsb+zT2C708hTc0ynas7Pi4Q96fJceiJhIVJMhbpk5n3NQo0d9KSYCur 6Ybym9Rw/lQj3fieCfFyOEhqffPLlHD8bniz3sWIwwQdoS9Ci2kQ/7xzWE6iQPFLE7T/ Q1m5WG1bCjiwn05wK3N8Q52cuf2tPAiyiT1IjPHskk8uYzSdOc+Ypg/lrxnHcnL6Z4y8 HD90+/ZWAd6O/32tT5MS5tahkCi4t/P9Q0P5N/XRESlyE8n4nks8Ui0TPMot1rtLTFXJ y+ug== X-Gm-Message-State: APjAAAXqLj182ZD4ZN0Ox+IhGuOwWx/ejEZe6D76uxod49Jnt9NrYePX EJLQo/8nG3e3KeXMBbJoqcVIzYGa7sY= X-Google-Smtp-Source: APXvYqyFh8CR41gRS/XNKx0eEHFjObJh4Rmr0MyxvtAXn6PhWqRAH/Y2ng7P1x+vtBW7ACiKuHvkyw== X-Received: by 2002:a17:906:d6a:: with SMTP id s10mr29877187ejh.180.1560273674134; Tue, 11 Jun 2019 10:21:14 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f9:2b:2b15::2]) by smtp.gmail.com with ESMTPSA id k9sm2403111eja.72.2019.06.11.10.21.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 11 Jun 2019 10:21:13 -0700 (PDT) From: Nathan Chancellor To: Catalin Marinas , Will Deacon Subject: [PATCH v2] arm64: Don't unconditionally add -Wno-psabi to KBUILD_CFLAGS Date: Tue, 11 Jun 2019 10:19:32 -0700 Message-Id: <20190611171931.99705-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190607161201.73430-1-natechancellor@gmail.com> References: <20190607161201.73430-1-natechancellor@gmail.com> MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190611_102116_539160_5AF3EE09 X-CRM114-Status: GOOD ( 14.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Qian Cai , Nathan Chancellor , Dave Martin , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This is a GCC only option, which warns about ABI changes within GCC, so unconditionally adding it 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 These failures come from the lack of -fno-stack-protector, which is added via cc-option in drivers/firmware/efi/libstub/Makefile. When an unknown flag is added to KBUILD_CFLAGS, clang will noisily warn that it is ignoring the option like above, unlike gcc, who will just error. $ echo "int main() { return 0; }" > tmp.c $ clang -Wno-psabi tmp.c; echo $? warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option] 1 warning generated. 0 $ gcc -Wsometimes-uninitialized tmp.c; echo $? gcc: error: unrecognized command line option ‘-Wsometimes-uninitialized’; did you mean ‘-Wmaybe-uninitialized’? 1 For cc-option to work properly with clang and behave like gcc, -Werror is needed, which was done in commit c3f0d0bc5b01 ("kbuild, LLVMLinux: Add -Werror to cc-option to support clang"). $ clang -Werror -Wno-psabi tmp.c; echo $? error: unknown warning option '-Wno-psabi' [-Werror,-Wunknown-warning-option] 1 As a consequence of this, when an unknown flag is unconditionally added to KBUILD_CFLAGS, it will cause cc-option to always fail and those flags will never get added: $ clang -Werror -Wno-psabi -fno-stack-protector tmp.c; echo $? error: unknown warning option '-Wno-psabi' [-Werror,-Wunknown-warning-option] 1 This can be seen when compiling the whole kernel as some warnings that are normally disabled (see below) show up. The full list of flags missing from drivers/firmware/efi/libstub are the following (gathered from diffing .arm64-stub.o.cmd): -fno-delete-null-pointer-checks -Wno-address-of-packed-member -Wframe-larger-than=2048 -Wno-unused-const-variable -fno-strict-overflow -fno-merge-all-constants -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -ffreestanding -fno-stack-protector 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 Acked-by: Dave Martin Reviewed-by: Nick Desaulniers Signed-off-by: Nathan Chancellor --- v1 -> v2: * Improve commit message explanation, I wasn't entirely happy with the first one; let me know if there are any issues/questions. * Carry forward Dave's ack and Nick's review (let me know if you disagree with the commit messasge rewording). 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)