dwarfdump: Handle relocs to zlib (.zdebug*) compressed sections
llvm-svn: 305152
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 42ab488..fb48253 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -1250,7 +1250,7 @@
continue;
RelSecName = RelSecName.substr(
- RelSecName.find_first_not_of("._")); // Skip . and _ prefixes.
+ RelSecName.find_first_not_of("._z")); // Skip . and _ prefixes.
// TODO: Add support for relocations in other sections as needed.
// Record relocations for the debug_info and debug_line sections.
diff --git a/llvm/test/DebugInfo/Inputs/dwarfdump-test-zlib.cc b/llvm/test/DebugInfo/Inputs/dwarfdump-test-zlib.cc
index 966a465..6c50638 100644
--- a/llvm/test/DebugInfo/Inputs/dwarfdump-test-zlib.cc
+++ b/llvm/test/DebugInfo/Inputs/dwarfdump-test-zlib.cc
@@ -22,6 +22,7 @@
// $ cp dwarfdump-test-zlib.cc /tmp/dbginfo
// $ cd /tmp/dbginfo
// $ clang++ -g dwarfdump-test-zlib.cc -Wl,--compress-debug-sections=zlib -o dwarfdump-test-zlib.elf-x86-64
+// $ clang++ -g dwarfdump-test-zlib.cc -Wa,--compress-debug-sections=zlib -c -o dwarfdump-test-zlib.o.elf-x86-64
// $ clang++ -g dwarfdump-test-zlib.cc -Wl,--compress-debug-sections=zlib-gnu -o dwarfdump-test-zlibgnu.elf-x86-64
// llvm-readobj -sections can be used to see that outputs really contain the compressed sections, also output in both
-// cases is slightly smaller, that is because of compression.
\ No newline at end of file
+// cases is slightly smaller, that is because of compression.
diff --git a/llvm/test/DebugInfo/Inputs/dwarfdump-test-zlib.o.elf-x86-64 b/llvm/test/DebugInfo/Inputs/dwarfdump-test-zlib.o.elf-x86-64
new file mode 100644
index 0000000..55f5cb0
--- /dev/null
+++ b/llvm/test/DebugInfo/Inputs/dwarfdump-test-zlib.o.elf-x86-64
Binary files differ
diff --git a/llvm/test/DebugInfo/dwarfdump-zlib.test b/llvm/test/DebugInfo/dwarfdump-zlib.test
index d3ef806..82f29af 100644
--- a/llvm/test/DebugInfo/dwarfdump-zlib.test
+++ b/llvm/test/DebugInfo/dwarfdump-zlib.test
@@ -1,6 +1,7 @@
REQUIRES: zlib
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test-zlib.elf-x86-64 | FileCheck %s
+RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test-zlib.o.elf-x86-64 | FileCheck %s
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test-zlibgnu.elf-x86-64 | FileCheck %s
CHECK: .debug_abbrev contents
@@ -10,3 +11,7 @@
// that sections names are properly shown in zlib-gnu style (without additional 'z' prefix).
CHECK: .debug_info contents
CHECK: 0x00000000: Compile Unit: length = 0x00000144 version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000148)
+
+// Also check that relocations in the .zdebug sections are handled correctly:
+CHECK: DW_AT_ranges {{.*}} (0x00000000{{$}}
+CHECK-NEXT: [0x