[llvm] 01fee8d - [DebugInfo][test] Attempt to fix big endian build bots
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 23 04:35:36 PDT 2020
Author: James Henderson
Date: 2020-06-23T12:34:27+01:00
New Revision: 01fee8dce549a7c3787655c48a35ce22168d87e2
URL: https://github.com/llvm/llvm-project/commit/01fee8dce549a7c3787655c48a35ce22168d87e2
DIFF: https://github.com/llvm/llvm-project/commit/01fee8dce549a7c3787655c48a35ce22168d87e2.diff
LOG: [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.
Added:
Modified:
llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
index c8b7535b9066..ad59098ff405 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;
More information about the llvm-commits
mailing list