forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose virtual:original header mappings via CcToolchain variables
Whenever `prefix` and/or `strip_include_prefix` is passed into `cc_library` rules, Bazel copies the headers into a special "_virtual_includes" directory that allows for such path transformations to occur. Unfortunately, this also has the side-effect of changing how source files are designated within the source binaries: they will refer to the file in the `_virtual_includes` sandbox directory instead of the actual files in the build tree. This change allows us to work around this problem by providing a mapping between the "virtual" and where they are in the filesystem as a [CcToolchainConfigInfo variable][1], `virtual_to_original_dirs`, which ends up being a list of `<virtual>=<original>` mappings that can be used in rules_cc toolchain features, specifically using [-ffile-prefix-map][2]. Questions ========= - Is `<virtual>=<original>` okay, or do we need a more sophisticated lazy expansion involving subvariables like what `libraries_to_link` has? E.g., do we imagine another compiler command-line flag format that'd require `A:B` instead of `A=B`? (Then again, considering MSVC's ASan is implemented w/ `/fsanitize=address`, maybe they're on the `A=B` train now?) Notes ===== - We mostly mimicked coverage's `virtual_to_original_headers`. Fixes upstream bazelbuild#11874. [1]: https://docs.bazel.build/versions/master/cc-toolchain-config-reference.html#cctoolchainconfiginfo-build-variables [2]: https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#index-ffile-prefix-map Co-authored-by: Andrew Psaltis <apsaltis@vmware.com>
- Loading branch information
Showing
13 changed files
with
240 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.