From 64afefaa40a5c1f90f1197b24ffdae329cacea3a Mon Sep 17 00:00:00 2001 From: Manuel Klimek Date: Wed, 5 Aug 2015 09:07:51 +0000 Subject: 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 --- .../java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java') 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) } -- cgit v1.2.3