File: Makefile-Use-relative-paths-for-debugging-symbols.patch

package info (click to toggle)
u-boot 2025.01-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 330,740 kB
  • sloc: ansic: 2,627,855; python: 60,773; sh: 41,641; asm: 21,854; makefile: 15,048; perl: 12,447; cs: 6,763; cpp: 1,868; yacc: 1,100; lex: 747; awk: 57; tcl: 32; sed: 24
file content (46 lines) | stat: -rw-r--r-- 1,740 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 513a75c02573680e6594bd328f698e2460db1a76 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Tue, 16 Aug 2022 19:00:04 -0700
Subject: [PATCH] Makefile: Use relative paths for debugging symbols.

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/

Series-to: u-boot

Signed-off-by: Vagrant Cascadian <vagrant@reproducible-builds.org>
---
 Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Index: u-boot/Makefile
===================================================================
--- u-boot.orig/Makefile
+++ u-boot/Makefile
@@ -758,14 +758,18 @@ KBUILD_CFLAGS += $(call cc-disable-warni
 # 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	+= -gdwarf-4
 # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
 # option to the assembler.
 KBUILD_AFLAGS	+= -gdwarf-4
 
+# 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