From f0945f48bd79669e046c9e10895112a5c5da2a08 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 12 Dec 2017 11:32:21 +0000 Subject: [PATCH] [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 llvm-svn: 320469 --- llvm/test/tools/dsymutil/Inputs/dwarf4.o | Bin 0 -> 1912 bytes llvm/test/tools/dsymutil/Inputs/dwarf5.o | Bin 0 -> 1940 bytes .../tools/dsymutil/X86/dwarf4-linetable.test | 23 ++++++++++++++++++ .../tools/dsymutil/X86/dwarf5-linetable.test | 23 ++++++++++++++++++ llvm/tools/dsymutil/DwarfLinker.cpp | 11 ++++++--- 5 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 llvm/test/tools/dsymutil/Inputs/dwarf4.o create mode 100644 llvm/test/tools/dsymutil/Inputs/dwarf5.o create mode 100644 llvm/test/tools/dsymutil/X86/dwarf4-linetable.test create mode 100644 llvm/test/tools/dsymutil/X86/dwarf5-linetable.test diff --git a/llvm/test/tools/dsymutil/Inputs/dwarf4.o b/llvm/test/tools/dsymutil/Inputs/dwarf4.o new file mode 100644 index 0000000000000000000000000000000000000000..0c6487ac974c2d70fe40104abd711cfcf9c7f6ba GIT binary patch literal 1912 zcmb7F&rcIk5T5O}1u0z?F%hFNYk~>*qf|hNVx$C+8Z{CG#DjTm%L0q-cC#!6jftF$ z+`Q_^KfynN#Dno92mKG^XyRE7b!K&&;`ynS!`_4m)+CICqW9MGfa z+caqCXs6KUC_ca*MEoCqaZV5;Cy*z(P6*dncR4^1VtRaTx)uksHl7e)!(*ec5#$gG zF>mBn7sZO}c*{bJJsO$1T}=siW_hL3K;|v7az7#9({nk;C=-7ppTRr>j59Hw)L>se z(^@D|N|^5**WG2@WWEe;8WZiy=jhg=v9g!%2lE8*?TGq{dft;5))(;6nIJoyPq*!Y zAuPQ}^7iz*Ao*2R47ah}v5w10K_Y&{?58xQeaJtCj` z+}^ielldlC&*MY+@}(l`a>c5(W?J(?+#9R40`QUfG+z9Gd~|0g@x1U)p?-}evEbm_ z@C(BCZJUcS%(umS96|zMDVP%m_oHB19%Fd_RDSw!P(+s>ZSDYl^xjlTNVd@Eo%v40 zr<`viHe-xBU=qFFNIJ`}Up~@&CcC+FW$W|!U&?;+DPO?*q?HY4#VlFcwNyHl*1BD1 z)q1A&_oe%;5B6x?g+jU5TV3lPNcX_}n(izNr1H>fJ7!sTjb68CLs2&^FfA9PcImv* z5t9}5vB*Ip7GJnlKiOa9vzr2KNUOD0gNfzK)D0{Y?NE!kj2*I7*WAM@bUUL(rw#YsLkDW7Un9Vsguu dNCb1?qMsW-%See>8^6p*Tx~Q2CcIMu{{R?C!!7^- literal 0 HcmV?d00001 diff --git a/llvm/test/tools/dsymutil/Inputs/dwarf5.o b/llvm/test/tools/dsymutil/Inputs/dwarf5.o new file mode 100644 index 0000000000000000000000000000000000000000..a9767f6d93762c341acffc20e12d5a2d5ca30573 GIT binary patch literal 1940 zcmb7FUr!T35TEUFP$@l%n26EDi@^k2yZ!w8=S~ZNPyh$i zCe$x9=%^?sQ0K|tN9Uj1e;+D zp_B_|c6CXXJlCI=a_rvd^h7lz|-!}7v@b!@O<&B(QVzj=Hk9vaSU_PT* zv`y(4c`9$$dVlyV09P2l9avw$SIDm9C?#6o87{1w`HnWTQG>|-)zw!ta#6mC2;a~l z`Mk%)J=eR!d^fqC`v>yn3VE!{ldH~}O9g1`ZN6(hkNxN+b-w(s&fN_nO;~}Gu*|&bPoE8u2nWXv(L*HA#Yd?SdIsx zL!8w*RYgl3KdE&H>djah$QbETv`dN0iCdl5@MTrHLD8-z612!kR22lRIapj943mvA z;*Y^V?^^Ys$q{q6X%y5g$}|pY6O!E>oeX!0unm~8<^El_HBc7uGl=@uq zqq!B7|Ba#V9wRc8;Gd=$QN 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;