[PATCH] D43943: [DEBUGINFO] Add flag for DWARF2 to use sections as references.

Eric Christopher via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 8 17:43:50 PST 2018


echristo added a comment.

Some inline comments.



================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:320
 
+  // Use sections as references in DWARF v2.
+  UseSectionsAsReferences =
----------------
Why?


================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:751
     if (unsigned NumRanges = TheCU.getRanges().size()) {
-      if (NumRanges > 1)
+      if (NumRanges > 1 && !useSectionsAsReferences())
         // A DW_AT_low_pc attribute may also be specified in combination with
----------------
Can you explain why this one is necessary?


================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1579-1583
+  if (useSectionsAsReferences()) {
+    Asm->EmitLabelPlusOffset(TheU->getSection()->getBeginSymbol(),
+                             TheU->getDebugSectionOffset(),
+                             Asm->MAI->getCodePointerSize());
+  } else {
----------------
Let's refactor this into a "DwarfEmitOffset" function and use it in all of the places we want to emit a label plus an offset, then this becomes a two line patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D43943





More information about the llvm-commits mailing list