]> granicus.if.org Git - llvm/commitdiff
dwarfdump: Handle relocs to zlib (.zdebug*) compressed sections
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 10 Jun 2017 19:32:50 +0000 (19:32 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 10 Jun 2017 19:32:50 +0000 (19:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305152 91177308-0d34-0410-b5e6-96231b3b80d8

lib/DebugInfo/DWARF/DWARFContext.cpp
test/DebugInfo/Inputs/dwarfdump-test-zlib.cc
test/DebugInfo/Inputs/dwarfdump-test-zlib.o.elf-x86-64 [new file with mode: 0644]
test/DebugInfo/dwarfdump-zlib.test

index 42ab48808f9a45d6617d44af16df16ecf071cee0..fb48253b2ad2d41fc22c17b50d7531236e2a7b1c 100644 (file)
@@ -1250,7 +1250,7 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj,
       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.
index 966a465f9046c15d14e0d1ff1783ff7e926734b3..6c506381aa5dcce0d247e2d997c28e35537dbafe 100644 (file)
@@ -22,6 +22,7 @@ int main() {
 // $ 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/test/DebugInfo/Inputs/dwarfdump-test-zlib.o.elf-x86-64 b/test/DebugInfo/Inputs/dwarfdump-test-zlib.o.elf-x86-64
new file mode 100644 (file)
index 0000000..55f5cb0
Binary files /dev/null and b/test/DebugInfo/Inputs/dwarfdump-test-zlib.o.elf-x86-64 differ
index d3ef806f3f877d9d4cdef56c794dc5803dd1a33d..82f29afdebdee107bae3519ba94214fa86cc5e42 100644 (file)
@@ -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 @@ CHECK: .debug_abbrev contents
 // 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