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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 9 09:43:15 PDT 2018


ruiu added inline comments.


================
Comment at: ELF/Driver.cpp:505-508
+  auto ID = Arg->getOption().getID();
+  if (ID == OPT_strip_all)
     return StripPolicy::All;
+  else if (ID == OPT_strip_debug)
----------------
Maybe I would call getOption().getID() twice instead of using a local variable because the cost of the function call should be negligible.


================
Comment at: ELF/Driver.cpp:1314
+  } else if (Config->Strip == StripPolicy::DebugNonLine) {
+    llvm::erase_if(InputSections, [](InputSectionBase *S) {
+      return StringSwitch<bool>(S->Name)
----------------
Do you think you can make a list of sections you want to strip, instead of making a list of sections you want to keep?


================
Comment at: test/ELF/strip-debug-non-line.s:1
+# REQUIRES: x86
+# RUN: llvm-mc -g -filetype=obj -triple=x86_64-unknown-linux %s -o %t
----------------
I wonder if there's a way to verify that the debug info generated by --strip-debug-non-line is valid. (Say, if we accidentally removed .debug_str for that option, the result wouldn't work, so I want to make sure that the result can be consumed by the debugger, for example.)


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46628





More information about the llvm-commits mailing list