[llvm] [llvm-ar][Object] Use K_GNU instead of K_COFF for archives with no symtab. (PR #82898)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 06:18:27 PST 2024
cjacek wrote:
> I was going to ask what MSVC does... but apparently, it specifically forbids creating empty archives (LNK1160), so there's no equivalent.
Yes, the closest I could do was adding a file with no symbols, but lib.exe just emits an empty symbol table then.
> If someone creates an archive, then add something to it/removes something from it, does llvm-ar/llvm-lib rerun the heuristic for choosing an archive format? If it does, this is probably fine.
With the previous version, we'd then use the COFF format. A similar logic to mitigate it is already there for BSD/DARWIN distinction, so we could just use that. I added a commit that does that. I guarded it with `hasSymbolTable()` to preserve current behavior in irrelevant cases, but we could potentially skip that.
(This PR now depends on reverted #82642, but should be committed first; I plan to rebase and move things a bit between them before pushing to get it right).
https://github.com/llvm/llvm-project/pull/82898
More information about the llvm-commits
mailing list