aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java8
1 files changed, 5 insertions, 3 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 c31f6ab688..061e6fea73 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
@@ -185,9 +185,11 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory {
// if cc_binary includes "linkshared=1", then gcc will be invoked with
// linkopt "-shared", which causes the result of linking to be a shared
// library. In this case, the name of the executable target should end
- // in ".so".
- PathFragment binaryPath =
- new PathFragment(ruleContext.getTarget().getName() + OsUtils.executableExtension());
+ // in ".so" or "dylib" or ".dll".
+ PathFragment binaryPath = new PathFragment(ruleContext.getTarget().getName());
+ if (!isLinkShared(ruleContext)) {
+ binaryPath = new PathFragment(binaryPath.getPathString() + OsUtils.executableExtension());
+ }
Artifact binary = ruleContext.getPackageRelativeArtifact(
binaryPath, ruleContext.getConfiguration().getBinDirectory());
CppLinkAction.Builder linkActionBuilder =