Page MenuHomeFreeBSD

Add fileprefixmap compiler feature
ClosedPublic

Authored by dan.mcgregor_usask.ca on Feb 12 2021, 10:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 12, 7:22 PM
Unknown Object (File)
Thu, Dec 5, 11:34 AM
Unknown Object (File)
Fri, Nov 29, 4:57 AM
Unknown Object (File)
Thu, Nov 28, 7:45 AM
Unknown Object (File)
Nov 22 2024, 3:09 PM
Unknown Object (File)
Nov 17 2024, 1:36 AM
Unknown Object (File)
Nov 17 2024, 12:28 AM
Unknown Object (File)
Nov 10 2024, 11:27 PM

Details

Summary

-ffile-prefix-map=<old>=<new> is a compiler feature first added in
GCC 8, and implemented for clang 10. It remaps old paths to new paths
in both debug information and FILE and BASE_FILE macros. It can
be used to improve reproducibility or to hide local system directories.

I plan to use it in future reviews to replace the real source directory
and real object directory with constant values across all builds.

Diff Detail

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

Event Timeline

brooks added a reviewer: arichardson.

This seems reasonable. Adding Alex in case he's interested (we might want to use this in cheribuild to match src paths match smbfs mounts).

This revision is now accepted and ready to land.Feb 15 2021, 6:51 PM

This seems reasonable. Adding Alex in case he's interested (we might want to use this in cheribuild to match src paths match smbfs mounts).

Yes this seems useful for us. We should probably use it in Jenkins to avoid including the full path with the temporary cheribsd@N subdirectories.
In normal builds, I re-create the source path when mounting the sources via SMBFS. This allows the paths to work when coredump debugging on the host and also in the guest, so I don't think we need it outside of jenkins.

Thanks for the review. I'm not a committer, so I can't submit it myself.

@arichardson, if you're curious the full series can be found at my gitlab branch. With that change series, I can build a full distribution (but not release) in a byte-for-byte identical manner across directories, build users, and host versions (as long as it's FreeBSD 12+). I'm cleaning that branch up now for pushing upstream, since I think it'll be generally useful.

This revision was automatically updated to reflect the committed changes.

Thanks for the gitlab reference, being able to cherry-pick the commit and preserve author data was helpful.