[PATCH] D77025: [Object] Update ObjectFile::makeTriple for XCOFF
Hubert Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 29 16:36:37 PDT 2020
hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: jhenderson, sfertile, jasonliu, daltenty.
Herald added subscribers: steven.zhang, rupprecht, MaskRay, hiraditya, nemanjai.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77025
Files:
llvm/lib/Object/ObjectFile.cpp
llvm/test/CodeGen/PowerPC/aix-return55.ll
llvm/test/tools/llvm-objdump/XCOFF/disassemble-all.test
Index: llvm/test/tools/llvm-objdump/XCOFF/disassemble-all.test
===================================================================
--- llvm/test/tools/llvm-objdump/XCOFF/disassemble-all.test
+++ llvm/test/tools/llvm-objdump/XCOFF/disassemble-all.test
@@ -55,7 +55,7 @@
CHECK-NEXT: ...
CHECK: Disassembly of section .tdata:
CHECK: 00000000 <d>:
-CHECK-NEXT: 0: 40 09 21 f9 bdnzfl 9, .+8696
+CHECK-NEXT: 0: 40 09 21 f9 bdnzfl 9, $+8696
CHECK-NEXT: 4: f0 1b 86 6e <unknown>
CHECK: Disassembly of section .tbss:
CHECK: 00000008 <c>:
Index: llvm/test/CodeGen/PowerPC/aix-return55.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/aix-return55.ll
+++ llvm/test/CodeGen/PowerPC/aix-return55.ll
@@ -31,7 +31,7 @@
;CHECKOBJ-NEXT: 18: 00 01 23 45 <unknown>
;CHECKOBJ-NEXT: 1c: 67 8a bc de oris 10, 28, 48350{{[[:space:]] *}}
;CHECKOBJ-NEXT: 00000020 <d>:
-;CHECKOBJ-NEXT: 20: 40 14 00 00 bdnzf 20, .+0
+;CHECKOBJ-NEXT: 20: 40 14 00 00 bdnzf 20, $+0
;CHECKOBJ-NEXT: 24: 00 00 00 00 <unknown>{{[[:space:]] *}}
;CHECKOBJ-NEXT: 00000028 <foo>:
;CHECKOBJ-NEXT: 28: 00 00 00 00 <unknown>
Index: llvm/lib/Object/ObjectFile.cpp
===================================================================
--- llvm/lib/Object/ObjectFile.cpp
+++ llvm/lib/Object/ObjectFile.cpp
@@ -108,14 +108,17 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77025.253464.patch
Type: text/x-patch
Size: 2255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200329/8fd561c3/attachment-0001.bin>
More information about the llvm-commits
mailing list