linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>,
	Jonathan Corbet <corbet@lwn.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH v2] kbuild: make all file references relative to source root
Date: Tue, 29 Apr 2025 22:51:17 +0300	[thread overview]
Message-ID: <aBEttQH4kimHFScx@intel.com> (raw)
In-Reply-To: <20250315-kbuild-prefix-map-v2-1-00e1983b2a23@weissschuh.net>

On Sat, Mar 15, 2025 at 02:20:14PM +0100, 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.

Hi,

This broke 'objdump -S' completely for me.

I see the following difference in the debug info:
-    <12>   DW_AT_name        : (indirect line string, offset: 0): drivers/gpu/drm/i915/i915_config.c
-    <16>   DW_AT_comp_dir    : (indirect line string, offset: 0x23): /home/.../src/linux-2.6/build
+    <12>   DW_AT_name        : (indirect line string, offset: 0): ../drivers/gpu/drm/i915/i915_config.c
+    <16>   DW_AT_comp_dir    : (indirect line string, offset: 0x26): /home/.../src/linux-2.6/build

Looks like I can work around it with some combination of --prefix and
--prefix-strip, but that seems far too tedious to have to do every
time I need to decode an oops.

> 
> Suggested-by: Ben Hutchings <ben@decadent.org.uk>
> Link: https://lore.kernel.org/lkml/c49cc967294f9a3a4a34f69b6a8727a6d3959ed8.camel@decadent.org.uk/
> Acked-by: Borislav Petkov (AMD) <bp@alien8.de> # arch/x86/
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Changes in v2:
> - Pick up Ack from Borislav
> - Merge all changes into single patch
> - Also drop link to KCFLAGS from docs
> - Link to v1: https://lore.kernel.org/r/20250313-kbuild-prefix-map-v1-0-38cea8448c5f@weissschuh.net
> ---
>  Documentation/kbuild/reproducible-builds.rst | 17 -----------------
>  Makefile                                     |  2 +-
>  arch/x86/boot/Makefile                       |  2 +-
>  arch/x86/boot/compressed/Makefile            |  2 +-
>  4 files changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/Documentation/kbuild/reproducible-builds.rst b/Documentation/kbuild/reproducible-builds.rst
> index f2dcc39044e66ddd165646e0b51ccb0209aca7dd..a7762486c93fcd3eba08b836bed622a41e829e41 100644
> --- a/Documentation/kbuild/reproducible-builds.rst
> +++ b/Documentation/kbuild/reproducible-builds.rst
> @@ -46,21 +46,6 @@ The kernel embeds the building user and host names in
>  `KBUILD_BUILD_USER and KBUILD_BUILD_HOST`_ variables.  If you are
>  building from a git commit, you could use its committer address.
>  
> -Absolute filenames
> -------------------
> -
> -When the kernel is built out-of-tree, debug information may include
> -absolute filenames for the source files.  This must be overridden by
> -including the ``-fdebug-prefix-map`` option in the `KCFLAGS`_ variable.
> -
> -Depending on the compiler used, the ``__FILE__`` macro may also expand
> -to an absolute filename in an out-of-tree build.  Kbuild automatically
> -uses the ``-fmacro-prefix-map`` option to prevent this, if it is
> -supported.
> -
> -The Reproducible Builds web site has more information about these
> -`prefix-map options`_.
> -
>  Generated files in source packages
>  ----------------------------------
>  
> @@ -131,7 +116,5 @@ See ``scripts/setlocalversion`` for details.
>  
>  .. _KBUILD_BUILD_TIMESTAMP: kbuild.html#kbuild-build-timestamp
>  .. _KBUILD_BUILD_USER and KBUILD_BUILD_HOST: kbuild.html#kbuild-build-user-kbuild-build-host
> -.. _KCFLAGS: kbuild.html#kcflags
> -.. _prefix-map options: https://reproducible-builds.org/docs/build-path/
>  .. _Reproducible Builds project: https://reproducible-builds.org/
>  .. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/
> 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
>  
> diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
> index 9cc0ff6e9067d574488a35573eff4d0f8449e398..f500f82864aae80deb74faa3df9a8b6333d6c4ca 100644
> --- a/arch/x86/boot/Makefile
> +++ b/arch/x86/boot/Makefile
> @@ -54,7 +54,7 @@ targets += cpustr.h
>  
>  KBUILD_CFLAGS	:= $(REALMODE_CFLAGS) -D_SETUP
>  KBUILD_AFLAGS	:= $(KBUILD_CFLAGS) -D__ASSEMBLY__
> -KBUILD_CFLAGS	+= $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
> +KBUILD_CFLAGS	+= $(call cc-option,-ffile-prefix-map=$(srctree)/=)
>  KBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables
>  KBUILD_CFLAGS	+= $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
>  
> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index 5edee7a9786c67e13c295473751b82387bcbd67e..ad324978b2e5b1b6f8be82647769c99db8257ac7 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -38,7 +38,7 @@ KBUILD_CFLAGS += -fno-stack-protector
>  KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
>  KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
>  KBUILD_CFLAGS += -Wno-pointer-sign
> -KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
> +KBUILD_CFLAGS += $(call cc-option,-ffile-prefix-map=$(srctree)/=)
>  KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
>  KBUILD_CFLAGS += -D__DISABLE_EXPORTS
>  # Disable relocation relaxation in case the link is not PIE.
> 
> ---
> base-commit: a57512d6cd88eba04cdc1fb83832c00d248bd0d1
> change-id: 20250312-kbuild-prefix-map-5ae76c209e7a
> 
> Best regards,
> -- 
> Thomas Weißschuh <linux@weissschuh.net>
> 

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2025-04-29 19:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-15 13:20 [PATCH v2] kbuild: make all file references relative to source root Thomas Weißschuh
2025-03-16  2:06 ` Masahiro Yamada
2025-03-16 19:08 ` Ben Hutchings
2025-03-17 17:17   ` Nathan Chancellor
2025-04-29 16:12 ` Matthieu Baerts
2025-05-01 16:48   ` Thomas Weißschuh
2025-05-02 11:33   ` Peter Oberparleiter
2025-04-29 19:51 ` Ville Syrjälä [this message]
2025-05-05  7:30   ` Thomas Weißschuh
2025-05-11  3:37     ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aBEttQH4kimHFScx@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=ben@decadent.org.uk \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=masahiroy@kernel.org \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).