aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Cal Peyser <cpeyser@google.com>2017-03-01 19:39:08 +0000
committerGravatar Yue Gan <yueg@google.com>2017-03-02 13:32:00 +0000
commit7cc6c629c2475062bed3abca004c4fcfb9d4adb5 (patch)
treeea0a0d02377b2683b825b0db3a1349f1d4c3bf3a
parent33093ca444d979dfcd81a56655d4e5dbbd1b35e9 (diff)
ios_test provides test-specific command line args when using the crosstool.
This requires passing linkopts through CrosstoolCompilationSupport into the 'legacy_link_flags' feature, as is done in c++. -- PiperOrigin-RevId: 148911500 MOS_MIGRATED_REVID=148911500
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java27
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java1
3 files changed, 15 insertions, 17 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
index bddde77baf..ff24408a40 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
@@ -146,7 +146,7 @@ public abstract class Link {
/** An objc executable. */
OBJC_EXECUTABLE(
"",
- Staticness.STATIC,
+ Staticness.DYNAMIC,
"objc-executable",
Picness.NOPIC,
ArtifactCategory.EXECUTABLE,
@@ -155,7 +155,7 @@ public abstract class Link {
/** An objc executable that includes objc++/c++ source. */
OBJCPP_EXECUTABLE(
"",
- Staticness.STATIC,
+ Staticness.DYNAMIC,
"objc++-executable",
Picness.NOPIC,
ArtifactCategory.EXECUTABLE,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
index bb3cdbdb79..82d2e26bc7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
@@ -397,18 +397,6 @@ public final class LinkCommandLine extends CommandLine {
.build()));
break;
- case DYNAMIC_LIBRARY:
- argv.add(toolPath);
- argv.addAll(
- featureConfiguration.getCommandLine(
- actionName,
- new Variables.Builder()
- .addAll(variables)
- .addStringSequenceVariable(
- CppLinkActionBuilder.LEGACY_LINK_FLAGS_VARIABLE, getToolchainFlags())
- .build()));
- break;
-
case STATIC_LIBRARY:
case PIC_STATIC_LIBRARY:
case ALWAYS_LINK_STATIC_LIBRARY:
@@ -421,14 +409,23 @@ public final class LinkCommandLine extends CommandLine {
argv.addAll(featureConfiguration.getCommandLine(actionName, variables));
break;
- // Since the objc case is not hardcoded in CppConfiguration, we can use the actual tool.
- // TODO(b/30109612): make this pattern the case for all link variants.
+ // Since the objc case/dynamic libs is not hardcoded in CppConfiguration, we can use the
+ // actual tool.
+ // TODO(b/30109612): make this pattern the case for all link variants.
+ case DYNAMIC_LIBRARY:
case OBJC_ARCHIVE:
case OBJC_FULLY_LINKED_ARCHIVE:
case OBJC_EXECUTABLE:
case OBJCPP_EXECUTABLE:
argv.add(toolPath);
- argv.addAll(featureConfiguration.getCommandLine(actionName, variables));
+ argv.addAll(
+ featureConfiguration.getCommandLine(
+ actionName,
+ new Variables.Builder()
+ .addAll(variables)
+ .addStringSequenceVariable(
+ CppLinkActionBuilder.LEGACY_LINK_FLAGS_VARIABLE, getToolchainFlags())
+ .build()));
break;
default:
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java
index dbf6632d3c..52cf6b828c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java
@@ -252,6 +252,7 @@ public class CrosstoolCompilationSupport extends CompilationSupport {
.addActionInput(inputFileList)
.setLinkType(linkType)
.setLinkStaticness(LinkStaticness.FULLY_STATIC)
+ .addLinkopts(ImmutableList.copyOf(extraLinkArgs))
.addVariablesExtension(extension)
.setFeatureConfiguration(getFeatureConfiguration(ruleContext, buildConfiguration))
.build();