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

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 02:33:30 PST 2016


evgeny777 added inline comments.


================
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;
----------------
ruiu wrote:
> 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?
If you don't list sections in linker script (HasSections is false), then all sections have already been created by the time addRegular or addSynthetic is called. In this case symbol values should be set immediately, because assignAddresses will not be called. See comment above in addRegular.


https://reviews.llvm.org/D25441





More information about the llvm-commits mailing list