[PATCH] D87015: [DebugInfo] Use a common method to determine a suitable form for section offsts (6/19).

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 22:24:47 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcae7c1eb781d: [DebugInfo] Use a common method to determine a suitable form for section offsts… (authored by ikudrin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87015/new/

https://reviews.llvm.org/D87015

Files:
  llvm/lib/CodeGen/AsmPrinter/DIE.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  llvm/unittests/CodeGen/DIETest.cpp


Index: llvm/unittests/CodeGen/DIETest.cpp
===================================================================
--- llvm/unittests/CodeGen/DIETest.cpp
+++ llvm/unittests/CodeGen/DIETest.cpp
@@ -162,8 +162,10 @@
     DIETestParams, DIEDeltaFixture,
     testing::Values(
         DIETestParams{4, dwarf::DWARF32, dwarf::DW_FORM_data4, 4u},
+        DIETestParams{4, dwarf::DWARF32, dwarf::DW_FORM_data8, 8u},
         DIETestParams{4, dwarf::DWARF32, dwarf::DW_FORM_sec_offset, 4u},
         DIETestParams{4, dwarf::DWARF64, dwarf::DW_FORM_data4, 4u},
+        DIETestParams{4, dwarf::DWARF64, dwarf::DW_FORM_data8, 8u},
         DIETestParams{4, dwarf::DWARF64, dwarf::DW_FORM_sec_offset, 8u}), );
 
 struct DIELocListFixture : public DIEFixtureBase {
Index: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -300,10 +300,7 @@
 
 void DwarfUnit::addSectionOffset(DIE &Die, dwarf::Attribute Attribute,
                                  uint64_t Integer) {
-  if (DD->getDwarfVersion() >= 4)
-    addUInt(Die, Attribute, dwarf::DW_FORM_sec_offset, Integer);
-  else
-    addUInt(Die, Attribute, dwarf::DW_FORM_data4, Integer);
+  addUInt(Die, Attribute, DD->getDwarfSectionOffsetForm(), Integer);
 }
 
 unsigned DwarfTypeUnit::getOrCreateSourceID(const DIFile *File) {
@@ -1750,8 +1747,7 @@
 DwarfUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,
                            const MCSymbol *Hi, const MCSymbol *Lo) {
   return Die.addValue(DIEValueAllocator, Attribute,
-                      DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset
-                                                 : dwarf::DW_FORM_data4,
+                      DD->getDwarfSectionOffsetForm(),
                       new (DIEValueAllocator) DIEDelta(Hi, Lo));
 }
 
Index: llvm/lib/CodeGen/AsmPrinter/DIE.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -550,6 +550,8 @@
   switch (Form) {
   case dwarf::DW_FORM_data4:
     return 4;
+  case dwarf::DW_FORM_data8:
+    return 8;
   case dwarf::DW_FORM_sec_offset:
     return AP->getDwarfOffsetByteSize();
   default:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87015.291785.patch
Type: text/x-patch
Size: 2319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/2142914f/attachment.bin>


More information about the llvm-commits mailing list