Package: src:kfreebsd-10 Version: 10.0-6 Severity: wishlist Tags: patch User: reproducible-builds at lists.alioth.debian.org Usertags: toolchain
Hi, Some of kfreebsd's .ko module files contain the build path of the Debian package, for example: aac.ko: /build/kfreebsd-10-Odh4L_/kfreebsd-10-10.0/flavor-10.0-1-686/sys/modules/aac/../../dev/aac/aac.c /build/kfreebsd-10-Odh4L_/kfreebsd-10-10.0/flavor-10.0-1-686/sys/modules/aac/../../dev/aac/aac_disk.c /build/kfreebsd-10-Odh4L_/kfreebsd-10-10.0/flavor-10.0-1-686/sys/modules/aac/../../dev/aac/aac_cam.c aacraid.ko: /build/kfreebsd-10-Odh4L_/kfreebsd-10-10.0/flavor-10.0-1-686/sys/modules/aacraid/../../dev/aacraid/aacraid.c /build/kfreebsd-10-Odh4L_/kfreebsd-10-10.0/flavor-10.0-1-686/sys/modules/aacraid/../../dev/aacraid/aacraid_cam.c These are _not_ DWARF debugging symbols, but appear in the ELF .text sections. Having the absolute (rather than relative) path here is: * not helpful, it conveys no useful information * wastes disk space and memory * often different for each build, and thus a problem in terms of the Reproducible Builds effort: https://wiki.debian.org/ReproducibleBuilds In most cases it seems because: * modules are built with -DKLD_MODULE * KLD_MODULE causes LOCK_DEBUG to be defined (sys/lock.h) * LOCK_DEBUG causes mtx_assert() to use __FILE__ in debug messages (sys/mutex.h) And: * __FILE__ contains what was literally given to the compiler as the source file argument * freebsd-make compiles many source files giving the full path * this seems to come from $(.PATH) in the Makefiles * most Makefiles set .PATH: $(.CURDIR)/foo/bar * $(.CURDIR) returns an absolute path But that seems to be unnecessary -- $(.CURDIR)/ is already implied if you give a relative path (should be true because Make targets are not supposed to change working directory) -- so when I tried removing it like this, it seems to have just worked: $ find sys/modules/ \( -name Makefile -o -name Makefile.inc \) \ -exec sed -i 's@${.CURDIR}/@@' \{\} \; The whole build succeeded, the build log is somewhat cleaner, and the strings in the _text sections now look like this, which is clean enough for our purposes: aac.ko: .../../dev/aac/aac.c .../../dev/aac/aac_disk.c .../../dev/aac/aac_cam.c aacraid.ko: .../../dev/aacraid/aacraid.c .../../dev/aacraid/aacraid_cam.c I wanted to document all of this because: * I've been trying for weeks to figure this out, and many hours today * I wouldn't want to forget * I'd like to be able to point to this bug as a full explanation, if I commit something odd like this to our debian/rules * someone else may like to give some input or opinions before I do that Thanks! -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: kfreebsd-amd64 (x86_64) Kernel: kFreeBSD 9.0-2-amd64-xenhvm-ipsec Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org