[llvm-lib] Use COFF archive format in llvm-lib (other archive tools don't use this...
authorJacek Caban <jacek@codeweavers.com>
Thu, 23 Mar 2023 11:20:15 +0000 (13:20 +0200)
committerMartin Storsjö <martin@martin.st>
Thu, 23 Mar 2023 11:43:21 +0000 (13:43 +0200)
commit4fcbf3842007569880fa916831efefda6b1bd032
tree9b7ee75fec9194217e760dd6b79a11b26eae1959
parent257dc54be2d292acec2d6b609ebb0a4e424c9e30
[llvm-lib] Use COFF archive format in llvm-lib (other archive tools don't use this format).

We currently just use GNU format for llvm-lib. This mostly works, but
ARM64EC needs an additional section that does not really fit GNU format.
This patch implements writing in COFF format (as in, it's what archive
reader considers as K_COFF). This mostly requires symbol emitting symbol
map. Note that, just like in case of MSVC, symbols are de-duplicated in
both usual symbol table and the new symbol map.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D143540
llvm/lib/Object/ArchiveWriter.cpp
llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
llvm/test/tools/llvm-lib/duplicate.test