[PATCH] D37520: [ELF] - Fix removing of unused synthetic sections.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 12:37:43 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/Writer.cpp:1210
 
-    // If there are no other sections in the output section, remove it from the
-    // output.
+    // Remove whole section description commands if them became empty.
+    llvm::erase_if(OS->Commands, [](BaseCommand *B) {
----------------
ruiu wrote:
> Please fix grammatical errors.
// If SS was the only section content, remove the entire output section.


================
Comment at: ELF/Writer.cpp:1205
+    for (BaseCommand *B : OS->Commands) {
       if (auto *ISD = dyn_cast<InputSectionDescription>(B)) {
+        auto It = llvm::find(ISD->Sections, SS);
----------------
Do you actually have to scan over output sections? I mean, InputSection has getOutputSection function, and I wonder if you can just use to know the output section that an input section is contained.


https://reviews.llvm.org/D37520





More information about the llvm-commits mailing list