[PATCH] D22683: [ELF] Symbol assignment within input section list
Eugene Leviant via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 25 03:46:29 PDT 2016
evgeny777 added inline comments.
================
Comment at: ELF/LinkerScript.cpp:551-553
@@ +550,5 @@
+ if (Symtab<ELFT>::X->find(Cmd->Name) == nullptr) {
+ if (OutSec)
+ Symtab<ELFT>::X->addSynthetic(Cmd->Name, OutSec,
+ evalExpr(Cmd->Expr, Cmd->Value));
+ else
----------------
ruiu wrote:
> Why don't you create absolute symbols here? I think it will simplifies the code.
My understanding is that symbols defined inside output section definition should have values relative to section base address, so relocation could be applied for them. However symbols defined inside SECTIONS {} block do not belong to any output section, so they have absolute values.
================
Comment at: ELF/LinkerScript.cpp:842
@@ -802,1 +841,3 @@
+
+ std::unique_ptr<SymbolAssignment> Assignment;
if (Tok == "PROVIDE")
----------------
ruiu wrote:
> I think SymbolAssignment is copy-assignable. You want to create a new instance of Assignment here and copy-assign to eliminate use of std::unique_ptr. (It's inefficient but it's really marginal.)
Not sure what you mean. We store commands in a form of array of smart pointers to values (not values themselves): std::vector<std::unique_ptr<BaseCommand>>
So why do we need copy assignment here?
Repository:
rL LLVM
https://reviews.llvm.org/D22683
More information about the llvm-commits
mailing list