-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C++: Do not look at nocopts in usePicForBinaries
This required looking at the rule context and we want to stop doing that from behind the C++ Starlark API. This was only used by one target in the depot that is broken anyway. Temporarily in case this breaks anyone in Bazel, rather than using an incompatible flag, we can fix anyone broken by this using a rule feature. If no one complains, this replacement will be removed in a later release. #4570 RELNOTES:none PiperOrigin-RevId: 232848408
- Loading branch information
Showing
7 changed files
with
19 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -505,16 +505,17 @@ public static void checkLinkstampsUnique( | |
|
||
/** Returns whether binaries must be compiled with position independent code. */ | ||
public static boolean usePicForBinaries( | ||
RuleContext ruleContext, | ||
CcToolchainProvider toolchain, | ||
FeatureConfiguration featureConfiguration) { | ||
CppConfiguration config = ruleContext.getFragment(CppConfiguration.class); | ||
if (CcCommon.noCoptsMatches("-fPIC", ruleContext)) { | ||
// TODO(b/124030770): Please do not use this feature without contacting the C++ rules team at | ||
// [email protected]. The feature will be removed in a later Bazel release and it might | ||
// break you. Contact us so we can find alternatives for your build. | ||
if (featureConfiguration.getRequestedFeatures().contains("coptnopic")) { | ||
return false; | ||
} | ||
return config.forcePic() | ||
return toolchain.getCppConfiguration().forcePic() | ||
|| (toolchain.usePicForDynamicLibraries(featureConfiguration) | ||
&& config.getCompilationMode() != CompilationMode.OPT); | ||
&& toolchain.getCppConfiguration().getCompilationMode() != CompilationMode.OPT); | ||
} | ||
|
||
/** | ||
|
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