aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2016-08-22 14:53:38 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-08-23 09:28:15 +0000
commit76a2bbcf5e20f42400a5dad47729553ce8514e66 (patch)
treee204bbd30dbe408ac48aa5f949946bbea853534b /src/main
parentfd843fe97e5e088ec422e5a294d71040e80b4cbd (diff)
Remove support for thin archives.
-- MOS_MIGRATED_REVID=130938527
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java28
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java3
-rw-r--r--src/main/protobuf/crosstool_config.proto4
5 files changed, 10 insertions, 49 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
index ae9218d134..70af928677 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
@@ -271,7 +271,6 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
private final CcToolchainFeatures toolchainFeatures;
private final boolean supportsGoldLinker;
- private final boolean supportsThinArchives;
private final boolean supportsStartEndLib;
private final boolean supportsDynamicLinker;
private final boolean supportsInterfaceSharedObjects;
@@ -324,7 +323,6 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
private final ImmutableList<String> objcopyOptions;
private final ImmutableList<String> ldOptions;
private final ImmutableList<String> arOptions;
- private final ImmutableList<String> arThinArchivesOptions;
private final ImmutableMap<String, String> additionalMakeVariables;
@@ -409,7 +407,6 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
toolchain = addLegacyFeatures(toolchain);
this.toolchainFeatures = new CcToolchainFeatures(toolchain);
this.supportsGoldLinker = toolchain.getSupportsGoldLinker();
- this.supportsThinArchives = toolchain.getSupportsThinArchives();
this.supportsStartEndLib = toolchain.getSupportsStartEndLib();
this.supportsInterfaceSharedObjects = toolchain.getSupportsInterfaceSharedObjects();
this.supportsEmbeddedRuntimes = toolchain.getSupportsEmbeddedRuntimes();
@@ -515,8 +512,6 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
this.objcopyOptions = ImmutableList.copyOf(toolchain.getObjcopyEmbedFlagList());
this.ldOptions = ImmutableList.copyOf(toolchain.getLdEmbedFlagList());
this.arOptions = copyOrDefaultIfEmpty(toolchain.getArFlagList(), "rcsD");
- this.arThinArchivesOptions = copyOrDefaultIfEmpty(
- toolchain.getArThinArchivesFlagList(), "rcsDT");
this.abi = toolchain.getAbiVersion();
this.abiGlibcVersion = toolchain.getAbiLibcVersion();
@@ -1239,13 +1234,6 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
}
/**
- * Returns whether the toolchain supports thin archives.
- */
- public boolean supportsThinArchives() {
- return supportsThinArchives;
- }
-
- /**
* Returns whether the toolchain supports the --start-lib/--end-lib options.
*/
public boolean supportsStartEndLib() {
@@ -1311,20 +1299,14 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
* Returns the type of archives being used.
*/
public Link.ArchiveType archiveType() {
- if (useStartEndLib()) {
- return Link.ArchiveType.START_END_LIB;
- }
- if (useThinArchives()) {
- return Link.ArchiveType.THIN;
- }
- return Link.ArchiveType.FAT;
+ return useStartEndLib() ? Link.ArchiveType.START_END_LIB : Link.ArchiveType.REGULAR;
}
/**
* Returns the ar flags to be used.
*/
- public ImmutableList<String> getArFlags(boolean thinArchives) {
- return thinArchives ? arThinArchivesOptions : arOptions;
+ public ImmutableList<String> getArFlags() {
+ return arOptions;
}
/**
@@ -1707,10 +1689,6 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
return cppOptions.useStartEndLib && supportsStartEndLib();
}
- public boolean useThinArchives() {
- return cppOptions.useThinArchives && supportsThinArchives();
- }
-
/**
* Returns true if interface shared objects should be used.
*/
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
index 47cd385670..0b7b82c193 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
@@ -173,16 +173,6 @@ public class CppOptions extends FragmentOptions {
)
public String glibc;
- @Option(
- name = "thin_archives",
- defaultValue = "false",
- category = "strategy", // but also adds edges to the action graph
- help =
- "Pass the 'T' flag to ar if supported by the toolchain. "
- + "All supported toolchains support this setting."
- )
- public boolean useThinArchives;
-
// O intrepid reaper of unused options: Be warned that the [no]start_end_lib
// option, however tempting to remove, has a use case. Look in our telemetry data.
@Option(
@@ -581,7 +571,6 @@ public class CppOptions extends FragmentOptions {
// -g0 first and let the user options override it.
host.coptList = ImmutableList.<String>builder().add("-g0").addAll(hostCoptList).build();
- host.useThinArchives = useThinArchives;
host.useStartEndLib = useStartEndLib;
host.stripBinaries = StripMode.ALWAYS;
host.fdoOptimize = null;
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 f03f128199..ec51c8413f 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
@@ -60,10 +60,6 @@ public abstract class Link {
CppFileTypes.VERSIONED_SHARED_LIBRARY,
CppFileTypes.INTERFACE_SHARED_LIBRARY);
- /**
- * These need special handling when --thin_archive is true. {@link CppLinkAction} checks that
- * these files are never added as non-libraries.
- */
public static final FileTypeSet ARCHIVE_LIBRARY_FILETYPES = FileTypeSet.of(
CppFileTypes.ARCHIVE,
CppFileTypes.PIC_ARCHIVE,
@@ -239,12 +235,11 @@ public abstract class Link {
}
/**
- * Types of archive.
+ * How to pass archives to the linker on the command line.
*/
public enum ArchiveType {
- FAT, // Regular archive that includes its members.
- THIN, // Thin archive that just points to its members.
- START_END_LIB // A --start-lib ... --end-lib group in the command line.
+ REGULAR, // Put the archive itself on the linker command line.
+ START_END_LIB // Put the object files enclosed by --start-lib / --end-lib on the command line
}
static boolean useStartEndLib(LinkerInput linkerInput, ArchiveType archiveType) {
@@ -331,7 +326,7 @@ public abstract class Link {
// start_end_lib archive (aka static library). Also check if the library contains object
// files - otherwise getObjectFiles returns null, which would lead to an NPE in
// simpleLinkerInputs.
- boolean needMembersForLink = archiveType != ArchiveType.FAT
+ boolean needMembersForLink = archiveType != ArchiveType.REGULAR
&& (inputLibrary.getArtifactCategory() == ArtifactCategory.STATIC_LIBRARY
|| inputLibrary.getArtifactCategory() == ArtifactCategory.ALWAYSLINK_STATIC_LIBRARY)
&& inputLibrary.containsObjectFiles();
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 b3a0cc7d09..bb4826e242 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
@@ -433,8 +433,7 @@ public final class LinkCommandLine extends CommandLine {
// The static library link command follows this template:
// ar <cmd> <output_archive> <input_files...>
argv.add(cppConfiguration.getArExecutable().getPathString());
- argv.addAll(
- cppConfiguration.getArFlags(cppConfiguration.archiveType() == Link.ArchiveType.THIN));
+ argv.addAll(cppConfiguration.getArFlags());
argv.add(output.getExecPathString());
argv.addAll(featureConfiguration.getCommandLine(actionName, variables));
argv.addAll(noWholeArchiveFlags);
diff --git a/src/main/protobuf/crosstool_config.proto b/src/main/protobuf/crosstool_config.proto
index 0ce4984b8f..295426f8c4 100644
--- a/src/main/protobuf/crosstool_config.proto
+++ b/src/main/protobuf/crosstool_config.proto
@@ -303,6 +303,7 @@ message CToolchain {
// Feature flags.
// TODO(bazel-team): Sink those into 'Feature' instances.
optional bool supports_gold_linker = 10 [default = false];
+ // Legacy field, ignored by Bazel.
optional bool supports_thin_archives = 11 [default = false];
optional bool supports_start_end_lib = 28 [default = false];
optional bool supports_interface_shared_objects = 32 [default = false];
@@ -347,8 +348,7 @@ message CToolchain {
// Ar flags for combining object files into archives. If this is not set, it
// defaults to "rcsD".
repeated string ar_flag = 47;
- // Ar flags for combining object files into archives when thin_archives is
- // enabled. If this is not set, it defaults to "rcsDT".
+ // Legacy field, ignored by Bazel.
repeated string ar_thin_archives_flag = 48;
// Additional compiler flags that are added for cc_plugin rules of type 'gcc'
repeated string gcc_plugin_compiler_flag = 34;