From nobody Sun Nov 24 00:32:45 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D75C3153573; Sun, 10 Nov 2024 01:37:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731202631; cv=none; b=IQ2pv1VOil6u+Gp+1YYXasrokP5lvOXGFB/8S434yDEWPvPpaUtIHmv6+xU2RqyixmGSYDDbBRG2n9W0V6Gdz/edSvfEAuQ5hbndW8iHF7UgQZRotZJjE8nm7lY07E9bCr0472lM0v6NhYy9lqtNWlRV29uakgJW2aUqF7q52yE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731202631; c=relaxed/simple; bh=us5XMqVwdbsYqray5sAUkCpHJq/PzlTni1SE6suosWA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qdCxgChqVYUem7cpkQYCKLAhe0oYXLQrDp+/fJK24+FU8bsfzrXNrMdE4ylfpQl91yXPucdLQVSmOqKJ1UUYAWWD5hm0lSq6dYgfHumZt2i8eNQZbUjK2wnIFrzt4AW+jqlTajFoyIa1aJKF7A0bDvmJaYjGZSEdMmFviMjJ5ik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FYpHijwk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FYpHijwk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70568C4CED2; Sun, 10 Nov 2024 01:37:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731202631; bh=us5XMqVwdbsYqray5sAUkCpHJq/PzlTni1SE6suosWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYpHijwk9mcoVCtK/bAUiFUeeUIfQf92dIktH/Ui4EM0+1FbLTrjZKR8ZDDZWsG8R 3tdxMA9KnbGlYbhUQoCkE3K/POCpboPw+Tsj8vHCI3RcxuB5dR0DL155C80qzwUqFa LflcVEYQv/FONuhc6bx14auG8qGNtGBwrxL5Z73IrBNDp4teVkkwgILQpFk1uqSihY hYnx4j3hz4//F5pxW0welWeNGSBQBr78iNnllRAmzWQQE7qyLqutK/JYjOeXc0u1QJ 6860ZflHe8fte6sr/phGtKskgwCDD3qWGZ4rRIzRALRMWDg9ZDbtMmBIVHbZCVUAL+ k0lEGg/1Euv5g== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, cocci@inria.fr, Masahiro Yamada , Nicolas Schier Subject: [PATCH v2 08/11] kbuild: support -fmacro-prefix-map for external modules Date: Sun, 10 Nov 2024 10:34:36 +0900 Message-ID: <20241110013649.34903-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241110013649.34903-1-masahiroy@kernel.org> References: <20241110013649.34903-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit makes -fmacro-prefix-map work for external modules built in a separate output directory. It improves the reproducibility of external modules and provides the benefits described in commit a73619a845d5 ("kbuild: use -fmacro-prefix-map to make __FILE__ a relative path"). When building_out_of_srctree is not defined (e.g., when the kernel or external module is built in the source directory), this option is unnecessary. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- Changes in v2: - Check building_out_of_srctree instead of VPATH Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 38ce19747728..5488aa96b46b 100644 --- a/Makefile +++ b/Makefile @@ -1041,8 +1041,10 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS +=3D -fconserve-stack endif =20 -# change __FILE__ to the relative path from the srctree -KBUILD_CPPFLAGS +=3D $(call cc-option,-fmacro-prefix-map=3D$(srctree)/=3D) +# change __FILE__ to the relative path to the source directory +ifdef building_out_of_srctree +KBUILD_CPPFLAGS +=3D $(call cc-option,-fmacro-prefix-map=3D$(srcroot)/=3D) +endif =20 # include additional Makefiles when needed include-y :=3D scripts/Makefile.extrawarn --=20 2.43.0