aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
diff options
context:
space:
mode:
authorJames Henderson <james.henderson@sony.com>2020-06-23 12:33:19 +0100
committerJames Henderson <james.henderson@sony.com>2020-06-23 12:34:27 +0100
commit01fee8dce549a7c3787655c48a35ce22168d87e2 (patch)
tree0f2dcea1a3d9af245d480782e53c8e2a103c3c6f /llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
parent36bab8484d6e681a6eb1522343b273e113503ffb (diff)
downloadllvm-01fee8dce549a7c3787655c48a35ce22168d87e2.zip
llvm-01fee8dce549a7c3787655c48a35ce22168d87e2.tar.gz
llvm-01fee8dce549a7c3787655c48a35ce22168d87e2.tar.bz2
[DebugInfo][test] Attempt to fix big endian build bots
Commit 9782c922c broke them since it prints raw bytes, whose order will be different dependent on the endianness of the host.
Diffstat (limited to 'llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp')
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
index c8b7535..ad59098 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -1443,6 +1443,21 @@ struct TruncatedExtendedOpcodeFixture
void SetUp() {
std::tie(BodyLength, OpcodeLength, Opcode, Operands, ExpectedOutput,
ExpectedErr) = GetParam();
+ // Swap the byte order of the operands on big endian hosts, so that the raw
+ // bytes are always in the same order. ValLen.Value is a uint64_t, so make
+ // sure to shift the value back to the actually used bits for the
+ // appropriate type.
+ if (sys::IsBigEndianHost)
+ for (LineTable::ValueAndLength &ValLen : Operands)
+ if (ValLen.Length != LineTable::SLEB &&
+ ValLen.Length != LineTable::ULEB &&
+ ValLen.Length != LineTable::Byte) {
+ sys::swapByteOrder(ValLen.Value);
+ if (ValLen.Length == LineTable::Long)
+ ValLen.Value >>= 32;
+ if (ValLen.Length == LineTable::Half)
+ ValLen.Value >>= 48;
+ }
}
uint64_t OpcodeLength;