1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[DebugInfo] Fix LineTest byteswap for cross-targeting builds

Summary:
The byte swap fix for big endian hosts in 9782c922cb21 (for D81570)
swaps based on the host endianess,  but for cross-targeting builds (i.e.
big endian host targeting little endian) the host-endianess won't
necessarily match the generated DWARF. This change updates the test
to use symmetrical constants so the results aren't endian dependent.

Reviewers: jhenderson, hubert.reinterpretcast, stevewan, ikudrin

Reviewed By: ikudrin

Subscribers: ikudrin, aprantl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D82827
This commit is contained in:
David Tenty 2020-07-02 14:35:30 -04:00
parent abe0d64460
commit c0fffb92d9

View File

@ -1443,21 +1443,6 @@ 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;
@ -1492,8 +1477,8 @@ INSTANTIATE_TEST_CASE_P(
"unexpected end of data at offset 0x32 while reading [0x32, 0x3a)"),
std::make_tuple(
10, 9, DW_LNE_set_address,
ValueAndLengths{{0x1234567890abcdef, LineTable::Quad}},
"DW_LNE_set_address (<parsing error> ef cd ab 90 78 56 34)",
ValueAndLengths{{0x1234567878563412, LineTable::Quad}},
"DW_LNE_set_address (<parsing error> 12 34 56 78 78 56 34)",
"unexpected end of data at offset 0x39 while reading [0x32, 0x3a)"),
std::make_tuple(3, 6, DW_LNE_define_file,
ValueAndLengths{{'a', LineTable::Byte},
@ -1537,8 +1522,8 @@ INSTANTIATE_TEST_CASE_P(
"malformed uleb128, extends past end"),
std::make_tuple(
6, 5, /*Unknown=*/0x7f,
ValueAndLengths{{0x12345678, LineTable::Long}},
"Unrecognized extended op 0x7f length 5 (<parsing error> 78 56 34)",
ValueAndLengths{{0x12343412, LineTable::Long}},
"Unrecognized extended op 0x7f length 5 (<parsing error> 12 34 34)",
"unexpected end of data at offset 0x35 while reading [0x32, "
"0x36)")), );