[PATCH] D131618: [WIP][Do NOT review] LLD related changes for -ffat-lto-objects support
Arda Unal via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 11 10:27:38 PDT 2022
arda updated this revision to Diff 451904.
arda added a comment.
Reverting the magic number based design. FatLTO object files stay as ELF files
with embedded bitcode. That's also how GCC does it. Current change checks if
there is a bitcode section named .fatlto.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131618/new/
https://reviews.llvm.org/D131618
Files:
lld/ELF/InputFiles.cpp
llvm/lib/Object/ObjectFile.cpp
Index: llvm/lib/Object/ObjectFile.cpp
===================================================================
--- llvm/lib/Object/ObjectFile.cpp
+++ llvm/lib/Object/ObjectFile.cpp
@@ -79,7 +79,7 @@
bool ObjectFile::isSectionBitcode(DataRefImpl Sec) const {
Expected<StringRef> NameOrErr = getSectionName(Sec);
if (NameOrErr)
- return *NameOrErr == ".llvmbc";
+ return *NameOrErr == ".llvmbc" || *NameOrErr == ".fatlto";
consumeError(NameOrErr.takeError());
return false;
}
Index: lld/ELF/InputFiles.cpp
===================================================================
--- lld/ELF/InputFiles.cpp
+++ lld/ELF/InputFiles.cpp
@@ -1712,9 +1712,16 @@
InputFile *elf::createObjectFile(MemoryBufferRef mb, StringRef archiveName,
uint64_t offsetInArchive) {
+ Expected<MemoryBufferRef> bcData = IRObjectFile::findBitcodeInMemBuffer(mb);
+
+ // If it is a fatLTO object file
+ if (!errorToBool(bcData .takeError()))
+ return make<BitcodeFile>(*bcData, archiveName, offsetInArchive, /*lazy=*/false);
+
if (isBitcode(mb))
return make<BitcodeFile>(mb, archiveName, offsetInArchive, /*lazy=*/false);
+
switch (getELFKind(mb, archiveName)) {
case ELF32LEKind:
return make<ObjFile<ELF32LE>>(mb, archiveName);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131618.451904.patch
Type: text/x-patch
Size: 1276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220811/9ca62fd4/attachment.bin>
More information about the llvm-commits
mailing list