[PATCH] D24135: [ELF] Linkerscript: support ABSOLUTE keyword in symbol assignment expression

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 02:07:23 PDT 2016

evgeny777 added inline comments.

Comment at: ELF/LinkerScript.cpp:286-287
@@ +285,4 @@
+    if (Cmd->ForceAbsolute) {
+      replaceBody<DefinedRegular<ELFT>>(S, Cmd->Name,
+                                        static_cast<uint8_t>(S->Visibility));
+      Body->Value = Cmd->Expression(Sec->getVA() + Off);
ruiu wrote:
> evgeny777 wrote:
> > ruiu wrote:
> > > Why do you have to replace a symbol here only when it is an absolute symbol?
> > Because it is initially created as synthetic in addSynthetic()
> Why don't you create that as a DefinedRegular symbol from the beginning?
To avoid creating symbol if section is discarded for some reason. Initially all section symbols are created as synthetics with Section pointer set to nullptr. If lld does not create output section those symbols will not be added to symbol table. Not sure, though, if it is right behavior if ABSOLUTE keyword is present



More information about the llvm-commits mailing list