Page MenuHomeFreeBSD

Add fileprefixmap compiler feature
ClosedPublic

Authored by dan.mcgregor_usask.ca on Fri, Feb 12, 10:23 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
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; 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.Mon, Feb 15, 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.