[lld] lld: Add initial support for GNU LTO format (PR #157175)

Tulio Magno Quites Machado Filho via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 14:53:23 PDT 2025


================
@@ -421,3 +420,242 @@ SmallVector<std::unique_ptr<InputFile>, 0> BitcodeCompiler::compile() {
   }
   return ret;
 }
+
+void BitcodeCompiler::addObject(IRFile &f,
+                                std::vector<llvm::lto::SymbolResolution> &r) {
+  checkError(ctx.e, ltoObj->add(std::move(f.obj), r));
+}
+
+#if LLD_ENABLE_GNU_LTO
+#include <dlfcn.h>
----------------
tuliom wrote:

That's a good question. From what I read, I believe it could work.
But my knowledge on Windows is limited and I don't have access to a system in order to test it.
With that said, I replaced the usage of `dlfcn.h` with `llvm::sys::DynamicLibrary`. This should help to add support to mingw.

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


More information about the llvm-commits mailing list