build: make prefix mapping of debug information optional
authorFelix Fietkau <nbd@nbd.name>
Mon, 22 Jun 2020 19:44:37 +0000 (21:44 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 6 Aug 2020 10:36:24 +0000 (12:36 +0200)
Remapping the local build path in debug information makes debugging
using ./scripts/remote-gdb harder, because files no longer refer to the full
path on the build host.

For local builds, debug information does not need to be reproducible,
since it will be stripped out of packages anyway.

For buildbot builds, it makes sense to keep debug information reproducible,
since the full path is not needed (nor desired) anywhere.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
config/Config-build.in
rules.mk

index 199277167bf775b10ed42c2ec37c523a781bbc4e..499f84690f5f7a0657b7fd61f71e59432d3638b5 100644 (file)
@@ -103,6 +103,15 @@ menu "Global build settings"
                help
                  If enabled, buildinfo files will be stored in /etc/build.* of firmware.
 
+       config REPRODUCIBLE_DEBUG_INFO
+               bool "Make debug information reproducible"
+               default BUILDBOT
+               help
+                 This strips the local build path out of debug information. This has the
+                 advantage of making it reproducible, but the disadvantage of making local
+                 debugging using ./scripts/remote-gdb harder, since the debug data will
+                 no longer point to the full path on the build host.
+
        config COLLECT_KERNEL_DEBUG
                bool
                prompt "Collect kernel debug information"
index e734b4a582939cb192724f931d2b1492eb3d85bb..479172de033df5c4e3463f2cef2abb229b8685b5 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -144,7 +144,7 @@ ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_TARGET_uml)),)
   ifeq ($(CONFIG_GCC_USE_IREMAP),y)
     iremap = -iremap$(1):$(2)
   else
-    iremap = -ffile-prefix-map=$(1)=$(2)
+    iremap = -f$(if $(CONFIG_REPRODUCIBLE_DEBUG_INFO),file,macro)-prefix-map=$(1)=$(2)
   endif
 endif