Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4407757rwl; Mon, 10 Apr 2023 10:32:13 -0700 (PDT) X-Google-Smtp-Source: AKy350bMHNm8ChSgqKUQI1Dn5aSkFhHU1uolAXd59JqG/ylS3vCPJV3BoO5Wa5CiFH1QLebh0nUz X-Received: by 2002:a17:903:228e:b0:1a1:a727:a802 with SMTP id b14-20020a170903228e00b001a1a727a802mr20711017plh.19.1681147933570; Mon, 10 Apr 2023 10:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681147933; cv=none; d=google.com; s=arc-20160816; b=gGq7Dcw0nxwPr3yBLtuehAA9h47zAuMsR5onJhZxJH6AM1laYxaqqfxzYa8e5Cm6Vm aAXaAucyGjgBRF2vwVcrakBaP69iSGncGVZ2vtPRKwMmoHtiPi8SK08RraITj7maUJBw P35h0Crzp5/SZUS588sWxYA6L3XxxJtGV7Po8ypFvRfN15GlUbZUpt1rSo+4PYMeHGV2 bNP7uyIHSk9ID/xjuMrb74Wu1aK2ihFuGt1uuiHRVyceQ+tS2YtoHwH0p0JPhbvCCIt5 fiuFpheHjkNL2i4Lh2pSNzdKPmk9AbpnhbOp17uvK1/MixiTRk+j9jKRLnkb3oWY01TA 0BZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ku3Tl0rpCygRTPCg9hFB0eUtVehNDLNBFA4MMcJRX4c=; b=n7sabNglc95+CJpYDbCLwo1wLKEYb/ePzsyoMp4gtpI8LJyRsKkpfbBxa1MwBzsmnB vrEUfgcIDfZhmWAUCe2ogCLtJph8v9mPYPY9MsCfnJys1hc3RJGhS3YWMnpudvxFhu6d FUlHiSh4qiyHLNESeaV/N/qlPUkMPWpGgKNXYIDicgecwhvYbyehw9w1IqyMgDgfYWPT 66g9yBuqxfdFGCZ7r3OxyLGDLP50lRhF2vXlVxeu/c7p9xJpKCOickPKeddREOwCVKzP GKp0PJQbjW/CMX1cDt1eMYhXFQxA7xnV2xCrhXfjTqOUj0ifkRcX8Vj6zhricVLs6TEu txHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FxDSH1Vw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a17090311d100b0019926d9c734si12246687plh.602.2023.04.10.10.32.01; Mon, 10 Apr 2023 10:32:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FxDSH1Vw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230168AbjDJR0A (ORCPT + 99 others); Mon, 10 Apr 2023 13:26:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbjDJRZ6 (ORCPT ); Mon, 10 Apr 2023 13:25:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96E212114; Mon, 10 Apr 2023 10:25:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3245E61DEC; Mon, 10 Apr 2023 17:25:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2105FC433D2; Mon, 10 Apr 2023 17:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681147556; bh=XyF3KjeGz3tqYqm7+dQVUy0htjweUQJJzaPWHD7QUg4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FxDSH1VwPka9DHMiADKBky8GjMJMjDYA/U1pHszfpK5jpAKnhwl2PdIFayTLI+z5q 9v+HZV9Yt0uBfAz1VctkK0CxIWvautSK0WXb7rbkeTvEmaSm7pYLMT2fgK3g8KJhPO 3Ir0UFnR//sXM6jqgbkqQP72fkI2Cwh2gm1KTUKbkboB3Ga/eR21IE6UjLhvP9wQQK Y7cnGZwmkKHzEVJvv8/9dgnsiGg8yXH3kbTzPXYdVuEQXD7UmuNnj68pc2VDudvzlR oMUWsbmzNPHfCBT28E9RDU6OrQ9qE8B8+go3XLEi5fvWdKPDNVrsx42MhI1fKVNp/K JyrttkAi/M32g== Date: Mon, 10 Apr 2023 10:25:54 -0700 From: Nathan Chancellor To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Tom Rini , Nick Desaulniers , Nicolas Schier , Tom Rix , llvm@lists.linux.dev Subject: Re: [PATCH] kbuild: add $(CLANG_CFLAGS) to KBUILD_CPPFLAGS Message-ID: <20230410172554.GA178820@dev-arch.thelio-3990X> References: <20230409145358.2538266-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230409145358.2538266-1-masahiroy@kernel.org> X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masahiro, Nit: s/CLANG_CFLAGS/CLANG_FLAGS/ in the title and a small typo below. On Sun, Apr 09, 2023 at 11:53:57PM +0900, Masahiro Yamada wrote: > When preprocessing arch/*/kernel/vmlinux.lds.S, the target triple is > not passed to $(CPP) because we add it only to KBUILD_{C,A}FLAGS. > > As a result, the linker script is preprocessed with predefined macros > for the build host instead of the target. > > Assuming you use an x86 build machine, compare the following: > > $ clang -dM -E -x c /dev/null > $ clang -dM -E -x c /dev/null -target aarch64-linux-gnu > > There is no actual problem presumably because our linker scripts do not > rely on such predefined macros, but it is better to define correct ones. > > Move $(CFLAGS_CFLAGS) to KBUILD_CPPFLAGS, so that all *.c, *.S, *.lds.S ^ CLANG_FLAGS > will be processed with the proper target triple. > > Reported-by: Tom Rini > Signed-off-by: Masahiro Yamada We will need to sort out the report from the kbuild test robot before we can do this. Otherwise, I think this should be fine, although I am curious if -Wunused-command-line-argument might fire more because there may be flags are unused while preprocessing. I will run this through my test matrix once the other report has been addressed to make sure there is nothing else obviously wrong with this change. Cheers, Nathan > --- > > scripts/Makefile.clang | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang > index 70b354fa1cb4..93ca059cc3b8 100644 > --- a/scripts/Makefile.clang > +++ b/scripts/Makefile.clang > @@ -38,6 +38,5 @@ CLANG_FLAGS += -Werror=unknown-warning-option > CLANG_FLAGS += -Werror=ignored-optimization-argument > CLANG_FLAGS += -Werror=option-ignored > CLANG_FLAGS += -Werror=unused-command-line-argument > -KBUILD_CFLAGS += $(CLANG_FLAGS) > -KBUILD_AFLAGS += $(CLANG_FLAGS) > +KBUILD_CPPFLAGS += $(CLANG_FLAGS) > export CLANG_FLAGS > -- > 2.37.2 >