[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <edc50aa7-0740-4942-8c15-96f12f2acc7e@kernel.org>
Date: Tue, 29 Apr 2025 18:12:29 +0200
From: Matthieu Baerts <matttbe@...nel.org>
To: Thomas Weißschuh <linux@...ssschuh.net>,
Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>, Jonathan Corbet <corbet@....net>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Ben Hutchings <ben@...adent.org.uk>,
Peter Oberparleiter <oberpar@...ux.ibm.com>,
MPTCP Linux <mptcp@...ts.linux.dev>
Subject: Re: [PATCH v2] kbuild: make all file references relative to source
root
Hi Thomas, Masahiro,
+Cc Peter Oberparleiter, MPTCP ML
On 15/03/2025 14:20, Thomas Weißschuh wrote:
> -fmacro-prefix-map only affects __FILE__ and __BASE_FILE__.
> Other references, for example in debug information, are not affected.
> This makes handling of file references in the compiler outputs harder to
> use and creates problems for reproducible builds.
>
> Switch to -ffile-prefix map which affects all references.
>
> Also drop the documentation section advising manual specification of
> -fdebug-prefix-map for reproducible builds, as it is not necessary
> anymore.
>
> Suggested-by: Ben Hutchings <ben@...adent.org.uk>
> Link: https://lore.kernel.org/lkml/c49cc967294f9a3a4a34f69b6a8727a6d3959ed8.camel@decadent.org.uk/
> Acked-by: Borislav Petkov (AMD) <bp@...en8.de> # arch/x86/
> Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
Thank you for having worked on that!
(...)
> diff --git a/Makefile b/Makefile
> index 5c333682dc9142b1aacfe454a5c77f5923554b7d..4f920187cee658ae4d1b807fca365f6994274828 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1067,7 +1067,7 @@ endif
>
> # change __FILE__ to the relative path to the source directory
> ifdef building_out_of_srctree
> -KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srcroot)/=)
> +KBUILD_CPPFLAGS += $(call cc-option,-ffile-prefix-map=$(srcroot)/=)
> KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/=
> endif
Today, I noticed that my CI for the MPTCP subsystem couldn't produce
code coverage files like before: the source files are not found. A 'git
bisect' pointed me to this patch. Reverting it seems to fix the issue.
My CI is building the kernel out of the source tree, in ".virtme/build".
Before and after this patch, GCOV seems to do its job properly.
Capturing GCOV data with this lcov command seems OK too:
lcov --capture --keep-going -j "${INPUT_CPUS}" \
--rc geninfo_unexecuted_blocks=1 \
--include '/net/mptcp/' \
--function-coverage --branch-coverage \
-b "${PWD}/.virtme/build" -o kernel.lcov
But after this patch, lcov complains some files are not found, e.g.
ERROR: (source) unable to open
${WORKDIR}/.virtme/build/net/mptcp/ctrl.c: No such file or directory
The output file is different: the path to the source file is wrong
because it points to the build dir. Instead of ...
SF:${WORKDIR}/net/mptcp/ctrl.c
... now I have ...
SF:${WORKDIR}/.virtme/build/net/mptcp/ctrl.c
Are there modifications needed on GCOV side to adapt to the behaviour
change introduced by this patch? Or something else needed on the
userspace side?
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
Powered by blists - more mailing lists