Skip to content

Commit 864cee9

Browse files
Add support for Dwarf 5 Line table header parsing in MCCAS
1 parent 6c8cbe8 commit 864cee9

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

llvm/lib/MCCAS/MCCASObjectV1.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,9 +743,23 @@ getLineTableLengthInfoAndVersion(DWARFDataExtractor &LineTableDataReader,
743743
auto Version = LineTableDataReader.getU16(OffsetPtr, &Err);
744744
if (Err)
745745
return std::move(Err);
746-
if (Version >= 5)
747-
return createStringError(inconvertibleErrorCode(),
748-
"DWARF 5 and above is not currently supported");
746+
if (Version >= 5) {
747+
// Dwarf 5 Section 6.2.4:
748+
// Line Table Header Format is now changed with an address_size and
749+
// segment_selector_size after the version. Parse both values from the
750+
// header.
751+
auto AddressSize = LineTableDataReader.getU8(OffsetPtr, &Err);
752+
if (Err)
753+
return std::move(Err);
754+
if (AddressSize != 8)
755+
return createStringError(
756+
inconvertibleErrorCode(),
757+
"Address size is not 8 bytes, unsupported architecture for MCCAS!");
758+
LineTableDataReader.getU8(OffsetPtr, &Err);
759+
if (Err)
760+
return std::move(Err);
761+
}
762+
749763
Prologue.Version = Version;
750764
// Since we do not support 64 bit DWARF, the prologue length is 4 bytes in
751765
// size.

0 commit comments

Comments
 (0)