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)
May 19 2024, 9:33 AM
Unknown Object (File)
May 13 2024, 6:16 AM
Unknown Object (File)
Mar 19 2024, 4:53 AM
Unknown Object (File)
Mar 19 2024, 3:22 AM
Unknown Object (File)
Feb 12 2024, 12:17 PM
Unknown Object (File)
Jan 26 2024, 12:16 PM
Unknown Object (File)
Dec 20 2023, 7:47 AM
Unknown Object (File)
Dec 12 2023, 5:52 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.