Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc_wrapper: make built artifacts more reproducible but specifying -ffile-prefix-map #445

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ParkMyCar
Copy link
Contributor

This PR aims to make artifacts built with toolchains_llvm more reproducible by specifying:

-ffile-prefix-map=${{pwd}}=__bazel_toolchain_llvm_repo__

in the compile and linker flags. Then in cc_wrapper.sh we replace ${{pwd}} with the current absolute path the script is being invoked from. This should result in builds being more reproducible by replacing absolute local paths in the binary with __bazel_toolchain_llvm_repo__.

For example, today in the MaterializeInc/materialize repo, building the @bzip2//:bzip2 target and running strings on the final binary, I get several results like this:

/private/var/tmp/_bazel_parker.timmerman/497be8b2783f71dbb03155dd9130f54f/sandbox/darwin-sandbox/977/execroot/__main__

After this PR all said entries are replaced with:

__bazel_toolchain_llvm_repo__

@keith I see in #440 you removed the use of -fdebug-prefix-path, I'm curious what you think of this since it not only effects debug info but also pre-processor macros.

@ParkMyCar ParkMyCar force-pushed the cc_toolchain/remap-debug-paths branch from b3c694e to de3c616 Compare January 18, 2025 02:45
@ParkMyCar ParkMyCar force-pushed the cc_toolchain/remap-debug-paths branch from de3c616 to 3f7280c Compare January 18, 2025 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant