HomeFreeBSD

share/mk: Substitute reproducible prefixes in dwarf info

Description

share/mk: Substitute reproducible prefixes in dwarf info

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

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).

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D50951

(cherry picked from commit 4f81c42fbd76e25c9fe696fa08296b79c55fbf09)

Details

Provenance
markjAuthored on Aug 21 2025, 2:06 PM
Differential Revision
D50951: share/mk: Substitute reproducible prefixes in dwarf info
Parents
rG8545586793f2: share/mk: Deduplicate some handling of debug info
Branches
Unknown
Tags
Unknown