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