[PATCH] D75149: [ELF] --orphan-handling=: don't warn/error for unused synthesized sections

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 15:59:36 PST 2020


nickdesaulniers accepted this revision.
nickdesaulniers added a comment.
This revision is now accepted and ready to land.

Thanks for the patch, just minor drive by comments, mostly aesthetic.

Is there anywhere we can document what the "synthetic sections" are?



================
Comment at: lld/ELF/LinkerScript.cpp:731
 
+void LinkerScript::processOrphanHandling() {
+  for (const InputSectionBase *sec : orphanSections) {
----------------
Bikeshed: needs a better name.  `DiagnoseOrphanHandling` or `EnforceOrphanHandlingPolicy` or such.  `process` doesn't make any modifications.


================
Comment at: lld/ELF/LinkerScript.cpp:732
+void LinkerScript::processOrphanHandling() {
+  for (const InputSectionBase *sec : orphanSections) {
+    StringRef name = getOutputSectionName(sec);
----------------
Consider returning early if the loop invariant `config->orphanHandling != OrphanHandlingPolicy::Error && config->orphanHandling != OrphanHandlingPolicy::Warn`.


================
Comment at: lld/ELF/LinkerScript.h:285
   void addOrphanSections();
+  void processOrphanHandling();
   void adjustSectionsBeforeSorting();
----------------
can this method be marked `const`?


================
Comment at: lld/ELF/Writer.cpp:1681
 
     // If we reach here, then SS is an unused synthetic section and we want to
+    // remove it from the corresponding input section description, and
----------------
`s/SS/ss/`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75149





More information about the llvm-commits mailing list