[PATCH] D39552: [ELF] - Teach LLD to strip .zdebug_* sections when --strip-debug/--strip-all is specified.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 01:13:54 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL317306: [ELF] - Teach LLD to strip .zdebug_* sections when --strip-debug/--strip-all is… (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D39552?vs=121307&id=121439#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39552

Files:
  lld/trunk/ELF/InputFiles.cpp
  lld/trunk/test/ELF/strip-debug.s


Index: lld/trunk/test/ELF/strip-debug.s
===================================================================
--- lld/trunk/test/ELF/strip-debug.s
+++ lld/trunk/test/ELF/strip-debug.s
@@ -1,25 +1,14 @@
 # REQUIRES: x86
-
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -g %s -o %t
-# RUN: ld.lld %t -o %t2
-# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=DEFAULT %s
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: ld.lld %t -o %t2 --strip-debug
-# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=STRIP %s
+# RUN: llvm-readobj -sections %t2 | FileCheck %s
 # RUN: ld.lld %t -o %t2 -S
-# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=STRIP %s
+# RUN: llvm-readobj -sections %t2 | FileCheck %s
 # RUN: ld.lld %t -o %t2 --strip-all
-# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=STRIP %s
-
-# DEFAULT: Name: .debug_info
-# DEFAULT: Name: .debug_abbrev
-# DEFAULT: Name: .debug_aranges
-# DEFAULT: Name: .debug_line
+# RUN: llvm-readobj -sections %t2 | FileCheck %s
 
-# STRIP-NOT: Name: .debug_info
-# STRIP-NOT: Name: .debug_abbrev
-# STRIP-NOT: Name: .debug_aranges
-# STRIP-NOT: Name: .debug_line
+# CHECK-NOT: Foo
+# CHECK-NOT: Bar
 
-.globl _start
-_start:
-  ret
+.section .debug_Foo,"", at progbits
+.section .zdebug_Bar,"", at progbits
Index: lld/trunk/ELF/InputFiles.cpp
===================================================================
--- lld/trunk/ELF/InputFiles.cpp
+++ lld/trunk/ELF/InputFiles.cpp
@@ -537,7 +537,8 @@
     return &InputSection::Discarded;
   }
 
-  if (Config->Strip != StripPolicy::None && Name.startswith(".debug"))
+  if (Config->Strip != StripPolicy::None &&
+      (Name.startswith(".debug") || Name.startswith(".zdebug")))
     return &InputSection::Discarded;
 
   // The linkonce feature is a sort of proto-comdat. Some glibc i386 object


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39552.121439.patch
Type: text/x-patch
Size: 1890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171103/fbe882fe/attachment.bin>


More information about the llvm-commits mailing list