[PATCH] D23768: [ELF] Linkerscript: eliminate LayoutInputSection

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 07:57:28 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:290
@@ +289,3 @@
+          // Update to location counter means update to section size.
+          Sec->setSize(Off = Value);
+        } else if (DefinedSynthetic<ELFT> *Sym =
----------------
Asignment in argument ? May be better separate it ?
```
Off = Value;
Sec->setSize(Value);
```

================
Comment at: ELF/LinkerScript.cpp:301
@@ -339,1 +300,3 @@
     }
+  };
+
----------------
I would reorder conditions to avoid nesting and ++ItCmd in multiple places:

```
  auto AddSuccessors = [&](InputSectionData *D) {
    for (; I != Cmd->Commands.end(); ++I) {
      auto *AssignCmd = dyn_cast<SymbolAssignment>(I->get());
      if (!AssignCmd)
        continue;
      if (D != AssignCmd->GoesAfter)
        break;

      uintX_t Value = AssignCmd->Expression(Sec->getVA() + Off) - Sec->getVA();
      if (AssignCmd->Name == ".") {
        // Update to location counter means update to section size.
        Off = Value;
        Sec->setSize(Off);
        continue;
      }

      if (DefinedSynthetic<ELFT> *Sym =
              cast_or_null<DefinedSynthetic<ELFT>>(AssignCmd->Sym)) {
        Sym->Section = OutSec;
        Sym->Value = Value;
      }
    }
  };
```


Repository:
  rL LLVM

https://reviews.llvm.org/D23768





More information about the llvm-commits mailing list