summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2017-12-12 11:32:21 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2017-12-12 11:32:21 +0000
commite75cd3860cf000f3ba6d9e69bbdcdfa3d591b51a (patch)
treefd9db50fa6744d19f390f66c071a0b697855b409 /tools
parent45aa4ec9badd7d80c148ff4dc2316331760868b8 (diff)
[dsymutil] Accept line tables up to DWARFv5.
This patch removes the hard-coded check for DWARFv2 line tables. Now dsymutil accepts line tables for DWARF versions 2 to 5 (inclusive). Differential revision: https://reviews.llvm.org/D41084 rdar://35968319 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320469 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/dsymutil/DwarfLinker.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/dsymutil/DwarfLinker.cpp b/tools/dsymutil/DwarfLinker.cpp
index 68f1505de1c..50ffc69dfaa 100644
--- a/tools/dsymutil/DwarfLinker.cpp
+++ b/tools/dsymutil/DwarfLinker.cpp
@@ -3232,16 +3232,21 @@ void DwarfLinker::patchLineTableForUnit(CompileUnit &Unit,
}
// Finished extracting, now emit the line tables.
- uint32_t PrologueEnd = *StmtList + 10 + LineTable.Prologue.PrologueLength;
- // FIXME: LLVM hardcodes it's prologue values. We just copy the
+ // FIXME: LLVM hardcodes its prologue values. We just copy the
// prologue over and that works because we act as both producer and
// consumer. It would be nicer to have a real configurable line
// table emitter.
- if (LineTable.Prologue.getVersion() != 2 ||
+ if (LineTable.Prologue.getVersion() < 2 ||
+ LineTable.Prologue.getVersion() > 5 ||
LineTable.Prologue.DefaultIsStmt != DWARF2_LINE_DEFAULT_IS_STMT ||
LineTable.Prologue.OpcodeBase > 13)
reportWarning("line table parameters mismatch. Cannot emit.");
else {
+ uint32_t PrologueEnd = *StmtList + 10 + LineTable.Prologue.PrologueLength;
+ // DWARFv5 has an extra 2 bytes of information before the header_length
+ // field.
+ if (LineTable.Prologue.getVersion() == 5)
+ PrologueEnd += 2;
StringRef LineData = OrigDwarf.getDWARFObj().getLineSection().Data;
MCDwarfLineTableParams Params;
Params.DWARF2LineOpcodeBase = LineTable.Prologue.OpcodeBase;