Skip to content

Commit

Permalink
Rename some variables for easier understanding of the code.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 164581142
  • Loading branch information
iirina authored and hlopko committed Aug 9, 2017
1 parent deab0cf commit ece0a14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ private static Runfiles collectRunfiles(RuleContext context,
public ConfiguredTarget create(RuleContext context)
throws RuleErrorException, InterruptedException {
RuleConfiguredTargetBuilder builder = new RuleConfiguredTargetBuilder(context);
LinkTargetType linkType = getStaticLinkType(context);
LinkTargetType staticLinkType = getStaticLinkType(context);
boolean linkStatic = context.attributes().get("linkstatic", Type.BOOLEAN);
init(semantics, context, builder, linkType,
init(semantics, context, builder, staticLinkType,
/*neverLink =*/ false,
linkStatic,
/*collectLinkstamp =*/ true,
Expand All @@ -100,7 +100,7 @@ public static void init(
CppSemantics semantics,
RuleContext ruleContext,
RuleConfiguredTargetBuilder targetBuilder,
LinkTargetType linkType,
LinkTargetType staticLinkType,
boolean neverLink,
boolean linkStatic,
boolean collectLinkstamp,
Expand Down Expand Up @@ -132,7 +132,7 @@ public static void init(
// between Bazel and Blaze.
.setGenerateLinkActionsIfEmpty(
ruleContext.getRule().getImplicitOutputsFunction() != ImplicitOutputsFunction.NONE)
.setLinkType(linkType)
.setLinkType(staticLinkType)
.setNeverLink(neverLink)
.addPrecompiledFiles(precompiledFiles);

Expand Down
22 changes: 10 additions & 12 deletions src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1268,9 +1268,7 @@ public CcLinkingOutputs createCcLinkActions(
SolibSymlinkAction.getDynamicLibrarySoname(soImpl.getRootRelativePath(), false));
}

// Should we also link in any libraries that this library depends on?
// That is required on some systems...
CppLinkActionBuilder linkActionBuilder =
CppLinkActionBuilder dynamicLinkActionBuilder =
newLinkActionBuilder(soImpl)
.setInterfaceOutput(soInterface)
.addObjectFiles(ccOutputs.getObjectFiles(usePicForSharedLibs))
Expand All @@ -1290,29 +1288,29 @@ public CcLinkingOutputs createCcLinkActions(

if (!ccOutputs.getLtoBitcodeFiles().isEmpty()
&& featureConfiguration.isEnabled(CppRuleClasses.THIN_LTO)) {
linkActionBuilder.setLtoIndexing(true);
linkActionBuilder.setUsePicForLtoBackendActions(usePicForSharedLibs);
dynamicLinkActionBuilder.setLtoIndexing(true);
dynamicLinkActionBuilder.setUsePicForLtoBackendActions(usePicForSharedLibs);
// If support is ever added for generating a dwp file for shared
// library targets (e.g. when linkstatic=0), then this should change
// to generate dwo files when cppConfiguration.useFission(),
// and the dwp generating action for the shared library should
// include all of the resulting dwo files.
linkActionBuilder.setUseFissionForLtoBackendActions(false);
CppLinkAction indexAction = linkActionBuilder.build();
dynamicLinkActionBuilder.setUseFissionForLtoBackendActions(false);
CppLinkAction indexAction = dynamicLinkActionBuilder.build();
env.registerAction(indexAction);

linkActionBuilder.setLtoIndexing(false);
dynamicLinkActionBuilder.setLtoIndexing(false);
}

CppLinkAction action = linkActionBuilder.build();
env.registerAction(action);
CppLinkAction dynamicLinkAction = dynamicLinkActionBuilder.build();
env.registerAction(dynamicLinkAction);

if (linkType == LinkTargetType.EXECUTABLE) {
return result.build();
}

LibraryToLink dynamicLibrary = action.getOutputLibrary();
LibraryToLink interfaceLibrary = action.getInterfaceOutputLibrary();
LibraryToLink dynamicLibrary = dynamicLinkAction.getOutputLibrary();
LibraryToLink interfaceLibrary = dynamicLinkAction.getInterfaceOutputLibrary();
if (interfaceLibrary == null) {
interfaceLibrary = dynamicLibrary;
}
Expand Down

0 comments on commit ece0a14

Please sign in to comment.