[llvm] [Archive][COFF] Split hybrid COFF files when adding them to an archive (PR #205160)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 07:09:03 PDT 2026
================
@@ -855,6 +858,35 @@ computeMemberData(raw_ostream &StringTable, raw_ostream &SymNames,
if (!SymFileOrErr)
return createFileError(M.MemberName, SymFileOrErr.takeError());
D.SymFile = std::move(*SymFileOrErr);
+
+ if (SymMap && D.SymFile.get()) {
----------------
cjacek wrote:
Currently, it is limited even more strictly to cases where we use SymMap, which is specific to COFF. For this to work fully, we also need two separate symbol tables, which is currently only possible with the COFF format and its ECSYMBOLS section. In cases like thin archives, there is nothing we can do. For GNU formats, acting in a hybrid-unaware manner seems consistent to me. The COFF format requires a symbol table, so we fall back to GNU when no symbol table is requested (see the check at the beginning of writeArchiveToStream).
In practice, archives without symbol tables seem useful either for running ranlib over them later (at which point we would do the split) or for being passed to the linker as a whole archive (which is handled by the LLD patches in #202740). The split in the separate pass changing the format makes for an interesting test case, so I have added it.
https://github.com/llvm/llvm-project/pull/205160
More information about the llvm-commits
mailing list