diff options
author | Jacek Caban <jacek@codeweavers.com> | 2023-03-23 13:20:15 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2023-03-23 13:43:21 +0200 |
commit | 4fcbf3842007569880fa916831efefda6b1bd032 (patch) | |
tree | 9b7ee75fec9194217e760dd6b79a11b26eae1959 /llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp | |
parent | 257dc54be2d292acec2d6b609ebb0a4e424c9e30 (diff) | |
download | llvm-4fcbf3842007569880fa916831efefda6b1bd032.zip llvm-4fcbf3842007569880fa916831efefda6b1bd032.tar.gz llvm-4fcbf3842007569880fa916831efefda6b1bd032.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp')
-rw-r--r-- | llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp index 3a609ee..9ca63be 100644 --- a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -455,10 +455,12 @@ int llvm::libDriverMain(ArrayRef<const char *> ArgsArr) { // For compatibility with MSVC, reverse member vector after de-duplication. std::reverse(Members.begin(), Members.end()); + bool Thin = Args.hasArg(OPT_llvmlibthin); if (Error E = writeArchive(OutputPath, Members, - /*WriteSymtab=*/true, object::Archive::K_GNU, - /*Deterministic*/ true, Args.hasArg(OPT_llvmlibthin))) { + /*WriteSymtab=*/true, + Thin ? object::Archive::K_GNU : object::Archive::K_COFF, + /*Deterministic*/ true, Thin)) { handleAllErrors(std::move(E), [&](const ErrorInfoBase &EI) { llvm::errs() << OutputPath << ": " << EI.message() << "\n"; }); |