[PATCH] D22617: [ELF] - Linkerscript: add InputSectionDescription command to LS parser.

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 02:47:57 PDT 2016


evgeny777 added inline comments.

================
Comment at: ELF/LinkerScript.cpp:220
@@ -211,4 +219,3 @@
 bool LinkerScript<ELFT>::shouldKeep(InputSectionBase<ELFT> *S) {
-  for (StringRef Pat : Opt.KeptSections)
-    if (globMatch(Pat, S->getSectionName()))
-      return true;
+  for (const std::unique_ptr<BaseCommand> &Base : Opt.Commands)
+    if (auto *OutSec = dyn_cast<OutputSectionCommand>(Base.get()))
----------------
grimar wrote:
> evgeny777 wrote:
> > It looks like a slow-down compared with previous one, no?
> That fits in new design. I am sure we will spend time on optimization of LS later,
> when will be able to run benchmarks. And probably many places will need tweaking,
> for now I don't think it is critical to change until major slowdown is proven.
> 
As far as I understand if --gc-sections command line switch is set, then markLive() calls LinkerScript::shouldKeep() for every input section. There could easily be millions of input sections in large projects like WebKit or LLVM itself. It might not be a good idea to sacrifice performance that much in favor of design improvements.


https://reviews.llvm.org/D22617





More information about the llvm-commits mailing list