aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/Archive.cpp
diff options
context:
space:
mode:
authorJacek Caban <jacek@codeweavers.com>2024-02-24 17:01:54 +0100
committerGitHub <noreply@github.com>2024-02-24 17:01:54 +0100
commitcf9201cfdbc10f4606fc4ca22bf1ccaf5ee841b3 (patch)
tree01fa67dfefb37b8742d36cae646fb87a1ae71e00 /llvm/lib/Object/Archive.cpp
parentd877ab1b99496feb48db1158963abd130e2aee5c (diff)
downloadllvm-cf9201cfdbc10f4606fc4ca22bf1ccaf5ee841b3.zip
llvm-cf9201cfdbc10f4606fc4ca22bf1ccaf5ee841b3.tar.gz
llvm-cf9201cfdbc10f4606fc4ca22bf1ccaf5ee841b3.tar.bz2
[llvm-ar] Use COFF archive format for COFF targets. (#82642)
Detect COFF files by default and allow specifying it with --format argument. This is important for ARM64EC, which uses a separated symbol map for EC symbols. Since K_COFF is mostly compatible with K_GNU, this shouldn't really make a difference for other targets.
Diffstat (limited to 'llvm/lib/Object/Archive.cpp')
-rw-r--r--llvm/lib/Object/Archive.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index e447e5b..d3fdcd9 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -969,12 +969,19 @@ Archive::Archive(MemoryBufferRef Source, Error &Err)
Err = Error::success();
}
+object::Archive::Kind Archive::getDefaultKindForTriple(Triple &T) {
+ if (T.isOSDarwin())
+ return object::Archive::K_DARWIN;
+ if (T.isOSAIX())
+ return object::Archive::K_AIXBIG;
+ if (T.isOSWindows())
+ return object::Archive::K_COFF;
+ return object::Archive::K_GNU;
+}
+
object::Archive::Kind Archive::getDefaultKindForHost() {
Triple HostTriple(sys::getProcessTriple());
- return HostTriple.isOSDarwin()
- ? object::Archive::K_DARWIN
- : (HostTriple.isOSAIX() ? object::Archive::K_AIXBIG
- : object::Archive::K_GNU);
+ return getDefaultKindForTriple(HostTriple);
}
Archive::child_iterator Archive::child_begin(Error &Err,