[PATCH] D38491: [ELF] Decompress debug info sections early

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 08:48:47 PDT 2017


smeenai updated this revision to Diff 117537.
smeenai added a comment.

Simplify test


https://reviews.llvm.org/D38491

Files:
  ELF/GdbIndex.cpp
  test/ELF/compressed-debug-conflict.s


Index: test/ELF/compressed-debug-conflict.s
===================================================================
--- /dev/null
+++ test/ELF/compressed-debug-conflict.s
@@ -0,0 +1,19 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple i686-linux-gnu -compress-debug-sections=zlib %s -o %t.o
+# RUN: not ld.lld %t.o %t.o -o %tout 2>&1 | FileCheck %s
+
+# CHECK:      error: duplicate symbol: main
+# CHECK-NEXT: >>> defined at reduced.c:2 (/tmp/reduced.c:2)
+# CHECK-NEXT: >>>
+# CHECK-NEXT: >>> defined at reduced.c:2 (/tmp/reduced.c:2)
+# CHECK-NEXT: >>>
+
+	.text
+	.file	"reduced.c"
+	.globl	main
+main:
+	.file	1 "/tmp" "reduced.c"
+	.loc	1 2 0
+	xorl	%eax, %eax
+	retl
+	.file	2 "/tmp/repeat/repeat/repeat/repeat" "repeat.h"
Index: ELF/GdbIndex.cpp
===================================================================
--- ELF/GdbIndex.cpp
+++ ELF/GdbIndex.cpp
@@ -17,6 +17,7 @@
 #include "GdbIndex.h"
 #include "Memory.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h"
+#include "llvm/Object/Decompressor.h"
 #include "llvm/Object/ELFObjectFile.h"
 
 using namespace llvm;
@@ -33,6 +34,8 @@
                                  .Case(".debug_ranges", &RangeSection)
                                  .Case(".debug_line", &LineSection)
                                  .Default(nullptr)) {
+      if (Decompressor::isCompressedELFSection(Sec->Flags, Sec->Name))
+        Sec->uncompress();
       M->Data = toStringRef(Sec->Data);
       M->Sec = Sec;
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38491.117537.patch
Type: text/x-patch
Size: 1481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171003/328d1e83/attachment.bin>


More information about the llvm-commits mailing list