Page MenuHomeFreeBSD

share/mk: Substitute reproducible prefixes in dwarf info
ClosedPublic

Authored by markj on Jun 20 2025, 5:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 3:06 PM
Unknown Object (File)
Fri, Oct 3, 1:18 AM
Unknown Object (File)
Thu, Oct 2, 2:55 PM
Unknown Object (File)
Thu, Oct 2, 5:05 AM
Unknown Object (File)
Wed, Oct 1, 4:59 AM
Unknown Object (File)
Tue, Sep 30, 7:34 PM
Unknown Object (File)
Tue, Sep 30, 8:12 AM
Unknown Object (File)
Wed, Sep 24, 12:53 PM
Subscribers

Details

Summary

Ensure that releases built from different source paths are reproducible.
Currently they are not since src and obj paths appear in DWARF info.
There are a few uses of FILE in the src tree as well, they are
handled by this change as well.

Use /usr/src and /usr/obj as the canonical src and obj paths when
WITH_REPRODUCIBLE_BUILD is defined. Define a DEBUG_PREFIX variable
which is used to ask the compiler to substitute paths in output files
using -ffile-prefix-map.

Compat builds (i.e., lib32) complicate things, since they override
OBJROOT to point to obj-${compat} but still refer to headers from the
native objroot (e.g., llvm headers). I have a hack for this case, but
suggestions for better solutions are welcome.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Jun 20 2025, 5:13 PM

Does anyone have any comments on the patch? I'd like to commit it as part of a larger project to improve src build reproducibility.

Same comment as in D50953 -- I think this is directionally the right thing but think it's unfortunate that we have four instances of similar logic. (Of course we have other build bits that are also repeated in this same set of files, this is not an entirely new complaint.)

Same comment as in D50953 -- I think this is directionally the right thing but think it's unfortunate that we have four instances of similar logic. (Of course we have other build bits that are also repeated in this same set of files, this is not an entirely new complaint.)

I tried to minimize the harm by first deduplicating related bits into bsd.debug.mk: D51805. If that patch is ok, I will rebase this one on top of that.

Rebase on top of bsd.debug.mk to eliminate the duplication

This revision was not accepted when it landed; it landed in state Needs Review.Aug 21 2025, 3:58 PM
This revision was automatically updated to reflect the committed changes.