aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java50
1 files changed, 44 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java
index 70ab54de4f..808db7be7d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java
@@ -117,6 +117,11 @@ public abstract class LinkerInputs {
public String toString() {
return "SimpleLinkerInput(" + artifact + ")";
}
+
+ @Override
+ public boolean isMustKeepDebug() {
+ return false;
+ }
}
/**
@@ -262,6 +267,11 @@ public abstract class LinkerInputs {
public int hashCode() {
return solibSymlinkArtifact.hashCode();
}
+
+ @Override
+ public boolean isMustKeepDebug() {
+ return false;
+ }
}
/** This class represents a library that may contain object files. */
@@ -278,6 +288,7 @@ public abstract class LinkerInputs {
private final Iterable<Artifact> objectFiles;
private final ImmutableMap<Artifact, Artifact> ltoBitcodeFiles;
private final ImmutableMap<Artifact, LtoBackendArtifacts> sharedNonLtoBackends;
+ private final boolean mustKeepDebug;
@AutoCodec.Instantiator
@VisibleForSerialization
@@ -287,13 +298,15 @@ public abstract class LinkerInputs {
String libraryIdentifier,
Iterable<Artifact> objectFiles,
ImmutableMap<Artifact, Artifact> ltoBitcodeFiles,
- ImmutableMap<Artifact, LtoBackendArtifacts> sharedNonLtoBackends) {
+ ImmutableMap<Artifact, LtoBackendArtifacts> sharedNonLtoBackends,
+ boolean mustKeepDebug) {
this.libraryArtifact = libraryArtifact;
this.category = category;
this.libraryIdentifier = libraryIdentifier;
this.objectFiles = objectFiles;
this.ltoBitcodeFiles = ltoBitcodeFiles;
this.sharedNonLtoBackends = sharedNonLtoBackends;
+ this.mustKeepDebug = mustKeepDebug;
}
private CompoundLibraryToLink(
@@ -303,7 +316,8 @@ public abstract class LinkerInputs {
Iterable<Artifact> objectFiles,
ImmutableMap<Artifact, Artifact> ltoBitcodeFiles,
ImmutableMap<Artifact, LtoBackendArtifacts> sharedNonLtoBackends,
- boolean allowArchiveTypeInAlwayslink) {
+ boolean allowArchiveTypeInAlwayslink,
+ boolean mustKeepDebug) {
String basename = libraryArtifact.getFilename();
switch (category) {
case ALWAYSLINK_STATIC_LIBRARY:
@@ -332,6 +346,7 @@ public abstract class LinkerInputs {
this.ltoBitcodeFiles =
(ltoBitcodeFiles == null) ? ImmutableMap.<Artifact, Artifact>of() : ltoBitcodeFiles;
this.sharedNonLtoBackends = sharedNonLtoBackends;
+ this.mustKeepDebug = mustKeepDebug;
}
@Override
@@ -402,6 +417,11 @@ public abstract class LinkerInputs {
public int hashCode() {
return libraryArtifact.hashCode();
}
+
+ @Override
+ public boolean isMustKeepDebug() {
+ return this.mustKeepDebug;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////
@@ -467,7 +487,8 @@ public abstract class LinkerInputs {
/* objectFiles= */ null,
/* ltoBitcodeFiles= */ null,
/* sharedNonLtoBackends= */ null,
- /* allowArchiveTypeInAlwayslink= */ false);
+ /* allowArchiveTypeInAlwayslink= */ false,
+ /* mustKeepDebug= */ false);
}
public static LibraryToLink opaqueLibraryToLink(
@@ -479,7 +500,8 @@ public abstract class LinkerInputs {
/* objectFiles= */ null,
/* ltoBitcodeFiles= */ null,
/* sharedNonLtoBackends= */ null,
- /* allowArchiveTypeInAlwayslink= */ false);
+ /* allowArchiveTypeInAlwayslink= */ false,
+ /* mustKeepDebug= */ false);
}
public static LibraryToLink opaqueLibraryToLink(
@@ -488,7 +510,22 @@ public abstract class LinkerInputs {
String libraryIdentifier,
boolean allowArchiveTypeInAlwayslink) {
return new CompoundLibraryToLink(
- artifact, category, libraryIdentifier, null, null, null, allowArchiveTypeInAlwayslink);
+ artifact, category, libraryIdentifier, null, null, null, allowArchiveTypeInAlwayslink,
+ /* mustKeepDebug= */ false);
+ }
+
+ public static LibraryToLink opaqueLibraryToLink(
+ Artifact artifact, ArtifactCategory category, String libraryIdentifier,
+ CppConfiguration.StripMode stripMode) {
+ return new CompoundLibraryToLink(
+ artifact,
+ category,
+ libraryIdentifier,
+ /* objectFiles= */ null,
+ /* ltoBitcodeFiles= */ null,
+ /* sharedNonLtoBackends= */ null,
+ /* allowArchiveTypeInAlwayslink= */ false,
+ /* mustKeepDebug= */ stripMode == CppConfiguration.StripMode.NEVER);
}
/** Creates a library to link with the specified object files. */
@@ -501,7 +538,8 @@ public abstract class LinkerInputs {
ImmutableMap<Artifact, LtoBackendArtifacts> sharedNonLtoBackends) {
return new CompoundLibraryToLink(
library, category, libraryIdentifier, objectFiles, ltoBitcodeFiles, sharedNonLtoBackends,
- /* allowArchiveTypeInAlwayslink= */ false);
+ /* allowArchiveTypeInAlwayslink= */ false,
+ /* mustKeepDebug= */ false);
}
public static Iterable<Artifact> toNonSolibArtifacts(Iterable<LibraryToLink> libraries) {