All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Makefile: Use relative paths for debugging symbols.
@ 2022-08-18 17:31 Vagrant Cascadian
  2022-08-19  9:54 ` Rasmus Villemoes
  2022-08-26 20:59 ` Tom Rini
  0 siblings, 2 replies; 8+ messages in thread
From: Vagrant Cascadian @ 2022-08-18 17:31 UTC (permalink / raw)
  To: u-boot; +Cc: Vagrant Cascadian, Heinrich Schuchardt, Simon Glass

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-29  7:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-18 17:31 [PATCH] Makefile: Use relative paths for debugging symbols Vagrant Cascadian
2022-08-19  9:54 ` 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

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.