aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
diff options
context:
space:
mode:
authorGravatar Manuel Klimek <klimek@google.com>2015-08-05 09:07:51 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-08-05 20:54:09 +0000
commit64afefaa40a5c1f90f1197b24ffdae329cacea3a (patch)
treef325e7feab08ecea472fa15b1fc8114f9f752665 /src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
parenta6d8cbee5834897a2f7b89591270374799048f49 (diff)
Use pic mode for cc_fake_binary if pic actions are used for binaries.
To allow the commands in the cc_fake_binary to work with modules (which is a precondition to writing nocompile tests for modules), we need to create header modules in the same pic/nopic mode as the rest of the commandline indicates. There are two ways to resolve this problem: a) Make cc_fake_binary use the same pic mode as other binaries. b) Make sure fake compile actions get all their inputs in non-pic mode. This patch proposes solution a), as that makes sure cc_fake_binary is as close to the actual compilation going on as possible; for example, if we decide to always use pic in the future, this will simply work; additionally, we will currently get more test coverage through different compilation modes. RELNOTES: 'cc_fake_binary' uses the same pic/nopic mode as other binaries. -- MOS_MIGRATED_REVID=99902738
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
index ceeff8cd12..cc0caa11d4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
@@ -266,7 +266,8 @@ public final class CppLinkAction extends AbstractAction {
// Concatenate all the (fake) .o files into the result.
for (LinkerInput linkerInput : getLinkCommandLine().getLinkerInputs()) {
Artifact objectFile = linkerInput.getArtifact();
- if (CppFileTypes.OBJECT_FILE.matches(objectFile.getFilename())
+ if ((CppFileTypes.OBJECT_FILE.matches(objectFile.getFilename())
+ || CppFileTypes.PIC_OBJECT_FILE.matches(objectFile.getFilename()))
&& linkerInput.isFake()) {
s.append(FileSystemUtils.readContentAsLatin1(objectFile.getPath())); // (IOException)
}