[clang] [lld] [llvm] Add FatLTO support for COFF (PR #165529)

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 08:07:47 PST 2025


================
@@ -256,6 +257,23 @@ MemoryBufferRef LinkerDriver::takeBuffer(std::unique_ptr<MemoryBuffer> mb) {
   return mbref;
 }
 
+InputFile *LinkerDriver::tryCreateFatLTOFile(MemoryBufferRef mb,
+                                             StringRef archiveName,
+                                             uint64_t offsetInArchive,
+                                             bool lazy) {
+  if (!ctx.config.fatLTOObjects)
+    return nullptr;
+
+  Expected<MemoryBufferRef> fatLTOData =
+      IRObjectFile::findBitcodeInMemBuffer(mb);
+
+  if (errorToBool(fatLTOData.takeError()))
----------------
aganea wrote:

This does not segregate between "we haven't found the bitstream in the COFF object" vs. "there's an error while parsing the object". If the return code is `object_error::bitcode_section_not_found` we should fallback on the `ObjFile::create` case; whereas any other error should be emitted in the log (`Fatal(ctx) << ...`)

https://github.com/llvm/llvm-project/pull/165529


More information about the llvm-commits mailing list