aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ObjectFile.cpp
diff options
context:
space:
mode:
authorHubert Tong <hubert.reinterpretcast@gmail.com>2020-03-31 17:24:22 -0400
committerHubert Tong <hubert.reinterpretcast@gmail.com>2020-03-31 17:26:30 -0400
commit478af4479ab65b90a4c7bd6460ff685d8e95d625 (patch)
treea72384a0bab16eeac499164be4b3143171eb4373 /llvm/lib/Object/ObjectFile.cpp
parent494abe139a9aab991582f1b3f3370b99b252944c (diff)
downloadllvm-478af4479ab65b90a4c7bd6460ff685d8e95d625.zip
llvm-478af4479ab65b90a4c7bd6460ff685d8e95d625.tar.gz
llvm-478af4479ab65b90a4c7bd6460ff685d8e95d625.tar.bz2
[Object] Update ObjectFile::makeTriple for XCOFF
Summary: When we encounter an XCOFF file, reflect that in the triple information. In addition to knowing the object file format, we know that the associated OS is AIX. This means that we can expect that there is no output difference in the processing of an XCOFF32 input file between cases where the triple is left unspecified by the user and cases where the user specifies `--triple powerpc-ibm-aix` explicitly. Reviewers: jhenderson, sfertile, jasonliu, daltenty Reviewed By: jasonliu Subscribers: wuzish, nemanjai, hiraditya, MaskRay, rupprecht, steven.zhang, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77025
Diffstat (limited to 'llvm/lib/Object/ObjectFile.cpp')
-rw-r--r--llvm/lib/Object/ObjectFile.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Object/ObjectFile.cpp b/llvm/lib/Object/ObjectFile.cpp
index 098b3d8..7879e2e 100644
--- a/llvm/lib/Object/ObjectFile.cpp
+++ b/llvm/lib/Object/ObjectFile.cpp
@@ -108,14 +108,17 @@ Triple ObjectFile::makeTriple() const {
setARMSubArch(TheTriple);
// TheTriple defaults to ELF, and COFF doesn't have an environment:
- // the best we can do here is indicate that it is mach-o.
- if (isMachO())
+ // something we can do here is indicate that it is mach-o.
+ if (isMachO()) {
TheTriple.setObjectFormat(Triple::MachO);
-
- if (isCOFF()) {
+ } else if (isCOFF()) {
const auto COFFObj = cast<COFFObjectFile>(this);
if (COFFObj->getArch() == Triple::thumb)
TheTriple.setTriple("thumbv7-windows");
+ } else if (isXCOFF()) {
+ // XCOFF implies AIX.
+ TheTriple.setOS(Triple::AIX);
+ TheTriple.setObjectFormat(Triple::XCOFF);
}
return TheTriple;