From: Vagrant Cascadian <vagrant@debian.org>
To: u-boot@lists.denx.de
Cc: Vagrant Cascadian <vagrant@reproducible-builds.org>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Simon Glass <sjg@chromium.org>
Subject: [PATCH] Makefile: Use relative paths for debugging symbols.
Date: Thu, 18 Aug 2022 10:31:34 -0700 [thread overview]
Message-ID: <20220818173133.12552-1-vagrant@debian.org> (raw)
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
The KBUILD_CFLAGS and KBUILD_AFLAGS variables are adjusted to use
-ffile-prefix-map and --debug-prefix-map, respectively, to use
relative paths for occurrences of __FILE__ and debug paths.
This enables reproducible builds regardless of the absolute path to
the build directory:
https://reproducible-builds.org/docs/build-path/
Signed-off-by: Vagrant Cascadian <vagrant@reproducible-builds.org>
---
Makefile | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 1a66f69a4b..b40b9b2444 100644
--- a/Makefile
+++ b/Makefile
@@ -751,14 +751,18 @@ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
# Enabled with W=2, disabled by default as noisy
KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
-# change __FILE__ to the relative path from the srctree
-KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
+# change __FILE__ and debugging symbols to the relative path from the
+# srctree
+KBUILD_CFLAGS += $(call cc-option,-ffile-prefix-map=$(srctree)/=)
KBUILD_CFLAGS += -g
# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
# option to the assembler.
KBUILD_AFLAGS += -g
+# Use relative paths in debugging symbols
+KBUILD_AFLAGS += --debug-prefix-map=$(srctree)/=
+
# Report stack usage if supported
# ARC tools based on GCC 7.1 has an issue with stack usage
# with naked functions, see commit message for more details
--
2.35.1
next reply other threads:[~2022-08-18 17:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 17:31 Vagrant Cascadian [this message]
2022-08-19 9:54 ` [PATCH] Makefile: Use relative paths for debugging symbols Rasmus Villemoes
2022-08-26 20:59 ` Tom Rini
2022-08-28 12:24 ` Rasmus Villemoes
2022-08-28 18:01 ` Vagrant Cascadian
2022-08-28 21:46 ` Vagrant Cascadian
2022-08-29 7:15 ` Rasmus Villemoes
2022-08-29 7:55 ` Rasmus Villemoes
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=20220818173133.12552-1-vagrant@debian.org \
--to=vagrant@debian.org \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
--cc=vagrant@reproducible-builds.org \
--cc=xypron.glpk@gmx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.