[PATCH] D25441: [ELF] Add Section() getter to expression structure (Expr)

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 13:24:14 PST 2016


ruiu added inline comments.


================
Comment at: ELF/LinkerScript.cpp:78
 template <class ELFT> static void addSynthetic(SymbolAssignment *Cmd) {
+  // If we have SECTIONS block then output sections haven't bee created yet.
+  const OutputSectionBase *Sec =
----------------
bee -> been


================
Comment at: ELF/LinkerScript.cpp:85-88
+  // If we already know section then we can calculate symbol value immediately.
+  if (Sec)
+    cast<DefinedSynthetic<ELFT>>(Cmd->Sym)->Value =
+        Cmd->Expression(0) - Sec->Addr;
----------------
I think I'm missing something, but eventually you'll set `->Value` for all symbols, right? What's the point of doing it earlier for some case?


================
Comment at: ELF/LinkerScript.cpp:869
 
+template <class ELFT>
+const OutputSectionBase *LinkerScript<ELFT>::getSymbolSection(StringRef S) {
----------------
Add a function comment about what this function is for.


================
Comment at: ELF/LinkerScript.cpp:1494
+            [=]() {
+              auto *S = L.Section();
+              return S ? S : R.Section();
----------------
Use a concrete type instead of `auto`.


================
Comment at: ELF/LinkerScript.h:46
   std::function<bool()> IsAbsolute;
+  std::function<const OutputSectionBase *()> Section;
   uint64_t operator()(uint64_t Dot) const { return Val(Dot); }
----------------
Please add a comment what this function is.


https://reviews.llvm.org/D25441





More information about the llvm-commits mailing list