aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/gold
diff options
context:
space:
mode:
authorPaul Kirth <paulkirth@google.com>2023-07-20 20:53:08 +0000
committerPaul Kirth <paulkirth@google.com>2023-07-20 20:53:08 +0000
commit2f34288b2476339e532a59fc43723b6de1a9ef08 (patch)
tree73770f43fd6fc2dff89318fc65fd0fe1d283dea7 /llvm/tools/gold
parenteb3f2fe467f10b29c407e642e8a505ee6800c1d8 (diff)
downloadllvm-2f34288b2476339e532a59fc43723b6de1a9ef08.zip
llvm-2f34288b2476339e532a59fc43723b6de1a9ef08.tar.gz
llvm-2f34288b2476339e532a59fc43723b6de1a9ef08.tar.bz2
Revert "[gold] Add preliminary FatLTO support to the Gold plugin"
This reverts commit 421e4026111315d002879b1e7a0cf3aacd00f488. One of the test needs a requires line, but we've also seen some issues for downstream projects that may need coordination, so I'm reverting this for until we can address those issues. see https://reviews.llvm.org/D152973#4520240 for context.
Diffstat (limited to 'llvm/tools/gold')
-rw-r--r--llvm/tools/gold/gold-plugin.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 59bd3f6..a47dba3 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -538,6 +538,14 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
BufferRef = Buffer->getMemBufferRef();
}
+ // Only use bitcode files for LTO. InputFile::create() will load bitcode
+ // from the .llvmbc section within a binary object, this bitcode is typically
+ // generated by -fembed-bitcode and is not to be used by LLVMgold.so for LTO.
+ if (identify_magic(BufferRef.getBuffer()) != file_magic::bitcode) {
+ *claimed = 0;
+ return LDPS_OK;
+ }
+
*claimed = 1;
Expected<std::unique_ptr<InputFile>> ObjOrErr = InputFile::create(BufferRef);