Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3101601rwl; Sun, 9 Apr 2023 08:02:44 -0700 (PDT) X-Google-Smtp-Source: AKy350bDW4SaOoz6hZZRqAQXB3V4K6ytiWlp0rKT2/Zhu6rgdogIUT5tH/Eq/QvRurU/BXPTknyk X-Received: by 2002:a05:6a20:9304:b0:d9:199a:c719 with SMTP id r4-20020a056a20930400b000d9199ac719mr8669988pzh.37.1681052564381; Sun, 09 Apr 2023 08:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681052564; cv=none; d=google.com; s=arc-20160816; b=VVRiQLjrWIyY5V0CBbtf9eP4irZbZiPF49C9lffl1KiMLequUnne55eaCjJyXbnsMX kyX+/RSCrY/1gQDSg3JJy26w2MsH5rkYeWTLQE+6i/gsJphIT3ojN2uUmk2uqdxah0RS ITzMJLJ15yxi2yyosKlaby6G3E2W126hnHRU5mniGWRKOW6lY8FQRdSlISOIuZ/qsPTw GpUUUJpqe7fMaLLtkjVbRGF7QhP5ozP+cMKMTWIQPJMfnUrvuzSqGCS1wAJNfQ9omRgD 24wb14hxpBTUEbEti+b2IYqrbmAsblEWuxjsua8ne3y77XFStznRTirx7DTNHsrEORph Fisw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=UT+KZY/0NdCZUrolZImODuWcHv5Zp8rAn6+BjpqCZog=; b=iJfILq2Fso5Vn0+PhPHUpbFeHUp4O55f897uB6O3FAVAlEKpGIH5tJufQabrLoNEN5 S8VIhY8i/rnG6/y/7HJ5g7iG1g3klq1iMEtXzFvxAeT0YTDnfbZHLFCe3Dzf8Mr8jwTi uPC+VJUbj/l1igIYSBNYOHT/MFNRIci5x86IlqZoQQk7isKGtr/Hm9bU4KZEswseVmvs j8nHt1VtLij5go2SntloRv+Iy63t4dizLam3RpXkBCPj4QD/Tx8/xxjBZh9QXRARIHea ceG4NPyUuXb0iOvcbRFM50/3PSjjgtXx9B9AMAsUs6nMsot3RZyjTh9nm3EUaUQoQVhe aP+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c7+bCLim; 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 b3-20020aa79503000000b005a84d4b045esi8427529pfp.118.2023.04.09.08.02.21; Sun, 09 Apr 2023 08:02:44 -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=c7+bCLim; 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 S229597AbjDIOyI (ORCPT + 99 others); Sun, 9 Apr 2023 10:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjDIOyG (ORCPT ); Sun, 9 Apr 2023 10:54:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 136973A87; Sun, 9 Apr 2023 07:54:06 -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 A0F9E60B9F; Sun, 9 Apr 2023 14:54:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 601D6C433EF; Sun, 9 Apr 2023 14:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681052045; bh=sR52KGMqxK6Vt6XY9CUVOsj3Fqld4NSi7ibY6IQOrls=; h=From:To:Cc:Subject:Date:From; b=c7+bCLim2D3xhHj9JAL0ZLjWdWnrvkOKClHaZBXuRTJFRMzoD8+7yJCMn65AyhspJ r/A8d6GIy75OYca0Ddu2CRsJQzfb6/ttOugEx92E3i+u0hQF7CJlv+1l3c9fZPqdEt 7kehPv01N4jrHKBwDghBZA5gWap3UGFm7P19NLQqAQ8yPSo9/PdcSqmei6+punbR02 CoFynNaG9cf9QaRFNCKr+yGod6Ajoewn/kCBzpR0egG9Qggebl5e+fCbE/rXiCX3Fj ZnH3QCzmboEVdeLxLQf1TQ0lx3TKAr4NuZVb4F7OwoSB27ubtdDp1gvW2MJytgEgAm vH/w1ohaBirdw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Tom Rini , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Tom Rix , llvm@lists.linux.dev Subject: [PATCH] kbuild: add $(CLANG_CFLAGS) to KBUILD_CPPFLAGS Date: Sun, 9 Apr 2023 23:53:57 +0900 Message-Id: <20230409145358.2538266-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 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 will be processed with the proper target triple. Reported-by: Tom Rini Signed-off-by: Masahiro Yamada --- 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