diff options
author | 2016-08-17 13:33:16 +0000 | |
---|---|---|
committer | 2016-08-18 08:29:34 +0000 | |
commit | c486637cb984cf3ba778c392de975888e5b48a68 (patch) | |
tree | 4ecfd0fdbd449fdfabffffc93c87b4cfcd4b977b /src/main/java/com/google/devtools/build/lib/rules/cpp | |
parent | 5c54c1cb3311dd78980a70e7cbfa6c4e6a625033 (diff) |
Set the LibraryIdentifier before building the LTO Indexing link action
Otherwise we fail the Precondition check added at the start of CppLinkAction
build() for a shared library target's indexing action.
Added a test which reproduces the issue without the fix.
--
MOS_MIGRATED_REVID=130513291
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java index 975d9d218c..0a641af0c4 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java @@ -240,6 +240,10 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory { CppLinkAction.symbolCountsFileName(binaryPath))); } + if (isLinkShared(ruleContext)) { + linkActionBuilder.setLibraryIdentifier(CcLinkingOutputs.libraryIdentifierOf(binary)); + } + // Store immutable context for use in other *_binary rules that are implemented by // linking the interpreter (Java, Python, etc.) together with native deps. CppLinkAction.Context linkContext = new CppLinkAction.Context(linkActionBuilder); @@ -257,10 +261,6 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory { linkActionBuilder.setLTOIndexing(false); } - if (isLinkShared(ruleContext)) { - linkActionBuilder.setLibraryIdentifier(CcLinkingOutputs.libraryIdentifierOf(binary)); - } - CppLinkAction linkAction = linkActionBuilder.build(); ruleContext.registerAction(linkAction); LibraryToLink outputLibrary = linkAction.getOutputLibrary(); |