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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 05:52:41 PDT 2017


grimar added inline comments.


================
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);
----------------
ruiu wrote:
> 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.
Here we scan not over output sections, but over commands it contains. `OS` is an `OutputSection*`.

It would be possible to avoid scanning if we would have pointer to `InputSectionDescription` command in each section (and `InputSectionDescription` can probably have poiner to `OutputSection` then), but we do not have it currently and I doubt we really need it.


https://reviews.llvm.org/D37520





More information about the llvm-commits mailing list