[PATCH] D50089: [DWARF v4] Suppressing the __debug_ranges section when there are no ranges

Wolfgang Pieb via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 31 11:10:00 PDT 2018


wolfgangp created this revision.
wolfgangp added reviewers: aprantl, JDevlieghere, dblaikie.

One of the clang tests in debuginfo-tests (apple-accel.cpp) insists on checking for the existence of the __debug_ranges section (it requires darwin) even for trivial code which doesn't need any range lists. My recent patch to implement DWARF v5 rnglists suppressed the section for trivial cases and broke the test. To pacify the bots I disabled the suppression for DWARF 4, restoring the original behavior.

This patch (actually 2, debuginfo-tests is a separate repo) fixes the test and re-enables the suppression of unneeded DWARF 4 (and earlier) range lists.

@aprantl , @JDevlieghere Could you please make sure the test change makes sense. I am not that well-versed with Mach-O. I'm just trying to force the compiler to emit ranges.


https://reviews.llvm.org/D50089

Files:
  apple-accel.cpp
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp


Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2136,7 +2136,7 @@
     return;
   }
 
-  if (getDwarfVersion() >= 5 && NoRangesPresent())
+  if (NoRangesPresent())
     return;
 
   // Start the dwarf ranges section.
Index: apple-accel.cpp
===================================================================
--- apple-accel.cpp
+++ apple-accel.cpp
@@ -8,6 +8,7 @@
 // RUN: %clang %s %target_itanium_abi_host_triple -gdwarf-4 -O0 -c -g -o %t-ex
 // RUN: llvm-objdump -section-headers %t-ex | FileCheck %s
 
+__attribute__((section("1,__text_foo"))) void foo() {}
 int main (int argc, char const *argv[]) { return argc; }
 
 // CHECK: __debug_str


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50089.158328.patch
Type: text/x-patch
Size: 798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180731/8bf30b40/attachment.bin>


More information about the cfe-commits mailing list