aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
diff options
context:
space:
mode:
authorGravatar Cal Peyser <cpeyser@google.com>2016-06-01 14:08:22 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-06-01 14:21:08 +0000
commit3be23361e3d5a8409628aeeff06ce6fa1793ec3d (patch)
tree0027354db2acc4362e4d7bac17ebe6f2de0154c4 /src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
parent74461cd76e7ac2a1e5bbce2bd6a5f715b212b823 (diff)
If an action_config is given for a particular type of link action, use that action_config to configure the build. Otherwise, revert to hard-coded behavior.
This change is designed to provide backwards-compatible support for crosstools that describe platform-specific linking semantics. -- MOS_MIGRATED_REVID=123748494
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java26
1 files changed, 18 insertions, 8 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 c51a06e533..38ab7e8ccf 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
@@ -94,32 +94,34 @@ public abstract class Link {
*/
public enum LinkTargetType {
/** A normal static archive. */
- STATIC_LIBRARY(".a", true),
+ STATIC_LIBRARY(".a", true, "c++-link-static-library"),
/** A static archive with .pic.o object files (compiled with -fPIC). */
- PIC_STATIC_LIBRARY(".pic.a", true),
+ PIC_STATIC_LIBRARY(".pic.a", true, "c++-link-pic-static-library"),
/** An interface dynamic library. */
- INTERFACE_DYNAMIC_LIBRARY(".ifso", false),
+ INTERFACE_DYNAMIC_LIBRARY(".ifso", false, "c++-link-interface-dynamic-library"),
/** A dynamic library. */
- DYNAMIC_LIBRARY(".so", false),
+ DYNAMIC_LIBRARY(".so", false, "c++-link-dynamic-library"),
/** A static archive without removal of unused object files. */
- ALWAYS_LINK_STATIC_LIBRARY(".lo", true),
+ ALWAYS_LINK_STATIC_LIBRARY(".lo", true, "c++-link-alwayslink-static-library"),
/** A PIC static archive without removal of unused object files. */
- ALWAYS_LINK_PIC_STATIC_LIBRARY(".pic.lo", true),
+ ALWAYS_LINK_PIC_STATIC_LIBRARY(".pic.lo", true, "c++-link-alwayslink-pic-static-library"),
/** An executable binary. */
- EXECUTABLE("", false);
+ EXECUTABLE("", false, "c++-link-executable");
private final String extension;
private final boolean staticLibraryLink;
+ private final String actionName;
- private LinkTargetType(String extension, boolean staticLibraryLink) {
+ private LinkTargetType(String extension, boolean staticLibraryLink, String actionName) {
this.extension = extension;
this.staticLibraryLink = staticLibraryLink;
+ this.actionName = actionName;
}
public String getExtension() {
@@ -129,6 +131,14 @@ public abstract class Link {
public boolean isStaticLibraryLink() {
return staticLibraryLink;
}
+
+ /**
+ * The name of a link action with this LinkTargetType, for the purpose of crosstool feature
+ * selection.
+ */
+ public String getActionName() {
+ return actionName;
+ }
}
/**