Source: binutils
Severity: normal
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: buildpath
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

The build path is embedded in debugging symbols:

  
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/armhf/diffoscope-results/binutils.html

  /usr/lib/debug/.dwz/arm-linux-gnueabihf/binutils-arm-linux-gnueabihf.debug

  /build/1st/binutils-2.40/builddir-single/binutils
  vs.
  /build/2/binutils-2.40/2nd/builddir-single/binutils

The attached patch to debian/rules fixes this by passing the
-ffile-prefix-map in CFLAGS and CXXFLAGS, which strips the build path
from occurences of __FILE__ and in debug symbols.

Unfortunately, this patch alone does not solve all reproducibility
issues, but applying this patch should significantly reduce the
differences, making it easier to debug remaining issues.


Thanks for maintaining binutils!


live well,
  vagrant
From 50a1fd550c04ed9656df87e95477187f693e6954 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Tue, 4 Apr 2023 16:16:37 -0700
Subject: [PATCH 2/2] debian/rules: Add -ffile-prefix-map to CFLAGS and
 CXXFLAGS.

This avoids embedding the full paths to files used in the __FILE__
macro and and in debug symbols.

https://tests.reproducible-builds.org/debian/issues/unstable/gcc_captures_build_path_issue.html
---
 debian/rules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/rules b/debian/rules
index a697df43..a681e3da 100755
--- a/debian/rules
+++ b/debian/rules
@@ -289,8 +289,8 @@ ifneq (,$(filter $(DEB_HOST_ARCH), $(gold_targets)))
   gold_provides = -Vgold:Provides=binutils-gold
 endif
 
-CFLAGS = -g -O2
-CXXFLAGS = -g -O2
+CFLAGS = -g -O2 -ffile-prefix-map=$(CURDIR)=.
+CXXFLAGS = -g -O2 -ffile-prefix-map=$(CURDIR)=.
 LDFLAGS =
 CROSS := $(DEB_HOST_GNU_TYPE)-
 CC     = $(CROSS)gcc
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature

Reply via email to