[PATCH] D46628: [ELF] Add --strip-debug-non-line option

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 23 19:41:57 PDT 2019


MaskRay added inline comments.


================
Comment at: lld/ELF/Config.h:47
+// For --strip-{all,debug,debug-non-line}.
+enum class StripPolicy { None, All, Debug, DebugNonLine};
 
----------------
Since there is a total order, this can be ordered by the strip level: None, DebugNonLine, Debug, All.


================
Comment at: lld/ELF/Driver.cpp:1851
+          .EndsWith("debug_line", false)
+          .EndsWith("debug_ranges", false)
+          .EndsWith("debug_str", false)
----------------
Do you need .debug_rnglists?


================
Comment at: lld/ELF/OutputSections.cpp:229
 
+  // If -strip-debug-non-line is specified and if this is a debug seciton,
+  // we've already reduced section contents. If that's the case,
----------------
Consider using the double dash form since that is what will be in the manpage.


================
Comment at: lld/ELF/OutputSections.h:116
+  // Reduced .debug_info/.debug_abbrev when using --strip-debug-non-line.
+  llvm::SmallVector<char, 1> ReducedDebugData;
+
----------------
Is size 1 `ReducedDebugData` common? If not, a container other than `SmallVector<char, 1>` may be better.


================
Comment at: lld/ELF/Writer.cpp:595
 
+  // If -strip-debug-non-line is specified reduce the .debug_abbrev/.debug_info
+  // sections. Do it right now because:
----------------
double-dash form


================
Comment at: lld/test/ELF/Inputs/strip-debug-non-line-multi-cu-bar.s:6
+	.file	"-"
+	.globl	bar                     # -- Begin function bar
+	.type	bar, at function
----------------
The comment markers are misaligned. Do you mix tabs and spaces? That'll render the comments badly on Phabricator.


================
Comment at: lld/test/ELF/strip-debug-non-line-multi-cu.s:116
+	.long	.Linfo_string0          # DW_AT_producer
+	.short	12                      # DW_AT_language
+	.long	.Linfo_string1          # DW_AT_name
----------------
misaligned


================
Comment at: lld/test/ELF/strip-debug-non-line.s:55
+	.type	_start, at function
+_start:                                 # @_start
+.Lfunc_begin1:
----------------
misaligned


================
Comment at: lld/test/ELF/strip-debug-non-line.s:208
+
+	.ident	"clang version 9.0.0 (https://github.com/llvm/llvm-project 01a99c0aa5ae5be47ea62bd6c87ca6bb63f5a454)"
+	.section	".note.GNU-stack","", at progbits
----------------
.ident, .note.GNU-stack are unnecessary


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D46628/new/

https://reviews.llvm.org/D46628





More information about the llvm-commits mailing list