aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ArchiveWriter.cpp
diff options
context:
space:
mode:
authorQiongsi Wu <qwu@ibm.com>2023-04-28 08:42:51 -0400
committerQiongsi Wu <qwu@ibm.com>2023-04-28 09:14:10 -0400
commitfae9d4df8fcff802dc7b0c344c61c70cc2a20697 (patch)
treed10456b285a567124b76508bb01cfc087919613c /llvm/lib/Object/ArchiveWriter.cpp
parentd75e70d7ae1f84cea71f0be5fbee836bdc22138a (diff)
downloadllvm-fae9d4df8fcff802dc7b0c344c61c70cc2a20697.zip
llvm-fae9d4df8fcff802dc7b0c344c61c70cc2a20697.tar.gz
llvm-fae9d4df8fcff802dc7b0c344c61c70cc2a20697.tar.bz2
[AIX][llvm-ar] Use the Correct Kind for Bitcode File Inputs
On AIX, when the input files are LLVM bitcode files, `llvm-ar` should set the archive kind to `K_AIXBIG` as well, instead of leaving it to the default `K_GNU`. Reviewed By: daltenty Differential Revision: https://reviews.llvm.org/D149377
Diffstat (limited to 'llvm/lib/Object/ArchiveWriter.cpp')
-rw-r--r--llvm/lib/Object/ArchiveWriter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp
index e9b8811..1a540e2 100644
--- a/llvm/lib/Object/ArchiveWriter.cpp
+++ b/llvm/lib/Object/ArchiveWriter.cpp
@@ -76,9 +76,11 @@ object::Archive::Kind NewArchiveMember::detectKindFromObject() const {
if (auto ObjOrErr = object::SymbolicFile::createSymbolicFile(
MemBufferRef, file_magic::bitcode, &Context)) {
auto &IRObject = cast<object::IRObjectFile>(**ObjOrErr);
- return Triple(IRObject.getTargetTriple()).isOSDarwin()
+ auto TargetTriple = Triple(IRObject.getTargetTriple());
+ return TargetTriple.isOSDarwin()
? object::Archive::K_DARWIN
- : object::Archive::K_GNU;
+ : (TargetTriple.isOSAIX() ? object::Archive::K_AIXBIG
+ : object::Archive::K_GNU);
} else {
// Squelch the error in case this was not a SymbolicFile.
consumeError(ObjOrErr.takeError());