Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2360961pxb; Mon, 23 Aug 2021 19:29:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHafNu13GhbfhxbLHyjUAhis2xtT/kyIF29VzANW0EyNPK7CymDU94MR2xLVyEyYuaOvAm X-Received: by 2002:a05:6638:4101:: with SMTP id ay1mr30914514jab.109.1629772180042; Mon, 23 Aug 2021 19:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629772180; cv=none; d=google.com; s=arc-20160816; b=xusGpYE13qK0FFYeDycxHcBSxsQzcVHTR/Jdp0hnJ98xoDs9KErc+6JyoHQAcZtqbD r6Txs44aakE9kmaHsoQ8tqQMJiyhEySsR0KtrYfGUN6guhR9RSukMR3mOFTvI3qD9GQt 3hXp2kwxaAujKEQ4ksbMZ6bxEWqTtwk4ICbOvENiN9us/p/8VTdRK/3gnThZeQ+JtQ2W QkehXHrbzKtQ1EmZEwHt/LzMEOutjQNfEoSH55FGH42+ebOoErLkDKCIdWJYHV7jp5dq xegNtcseB8FbNtzXtljByvrUzDHtjhlA/hLjibWFhCiuXEviGBgCdFC5BCfHTF1SkCQM HCaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OL8ChztOX7SZuwQxA3xt1i7+SJ3tx1+FMIaphZKzA54=; b=qiPrd+vMMZLd7l0w84HeBI2WVHopKxbDl4I5ohVu0k32VZcMMRmj2S5M+64CflO4Ry BWh2E7QTUyeDloDnub0TW7GE0dNxa/DG7a5tKuaiW7A595LsbxxY19By+hLVfZM4VaXD ADk5BM3GKmrFnhHaMXGSZhuX/5zXI+t2qEka1qL3sfrUIXRYoqdu0u9xlb8asisGAasn ZTjIcZM2xuyh1ZLqGx5hHVrgGlCk6oqO/bHSpCo0pFFOGenW3DKI++GUqQAzkOngxhSj Gv6jns0jHCJqm4vSMtHThjWmZ14c05+9nuNgca1ZBLFndPii5hES1b4VBKNt7vJD2Qu1 3oCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sVo8kH14; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si18159970ioa.93.2021.08.23.19.29.28; Mon, 23 Aug 2021 19:29:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sVo8kH14; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233749AbhHXC2V (ORCPT + 99 others); Mon, 23 Aug 2021 22:28:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:37032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233477AbhHXC2S (ORCPT ); Mon, 23 Aug 2021 22:28:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBDEF613D5; Tue, 24 Aug 2021 02:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629772053; bh=NOvJGCvW1HVdaDqhCUnwbbyYfhSHjlfgYPzYKkOiPeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sVo8kH14HV4YMJUOa/sFGqFKMlYvaRHWnjrvEpgstLxyWfoE1UaForX7zQQFkmpBb Geep8/Zqy1BvWYK0RIAGXu6dEpxEz/49ho/U/ehCqyXPkV6wZ0P4DPwe56qFFYhfkQ aYsarl6rdNXIFELz7+lEKIKNA21PmggLbrFWwmJmPVabnpAtAIlY7OSPmDfZCUb8zV chWdq/uS+UWzJ6Etm0OD8q7/0gzafwogKdqUygQ48muscUfP9iCwxaUwjwVvqH5nOf 7o2M2apdEIejOD0GG69EhgZOchV9AKwNyIzaze5VLDP4UmF1TlrxWdIDnN4UQgb/y8 aR7u/vij+whEg== From: Nathan Chancellor To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Masahiro Yamada Cc: "H. Peter Anvin" , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH 2/2] kbuild: Add -Werror=ignored-optimization-argument to CLANG_FLAGS Date: Mon, 23 Aug 2021 19:26:40 -0700 Message-Id: <20210824022640.2170859-3-nathan@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210824022640.2170859-1-nathan@kernel.org> References: <20210824022640.2170859-1-nathan@kernel.org> MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Similar to commit 589834b3a009 ("kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS"). Clang ignores certain GCC flags that it has not implemented, only emitting a warning: $ echo | clang -fsyntax-only -falign-jumps -x c - clang-14: warning: optimization flag '-falign-jumps' is not supported [-Wignored-optimization-argument] When one of these flags gets added to KBUILD_CFLAGS unconditionally, all subsequent cc-{disable-warning,option} calls fail because -Werror was added to these invocations to turn the above warning and the equivalent -W flag warning into errors. To catch the presence of these flags earlier, turn -Wignored-optimization-argument into an error so that the flags can either be implemented or ignored via cc-option and there are no more weird errors. Signed-off-by: Nathan Chancellor --- scripts/Makefile.clang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang index 4cce8fd0779c..2fe38a9fdc11 100644 --- a/scripts/Makefile.clang +++ b/scripts/Makefile.clang @@ -29,7 +29,11 @@ CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) else CLANG_FLAGS += -fintegrated-as endif +# By default, clang only warns on unknown warning or optimization flags +# Make it behave more like gcc by erroring when these flags are encountered +# so they can be implemented or wrapped in cc-option. CLANG_FLAGS += -Werror=unknown-warning-option +CLANG_FLAGS += -Werror=ignored-optimization-argument KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_AFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS -- 2.33.0