[PATCH] D24450: [ELF] Linkerscript: improve handling of ASSERT and symbol assignment outside SECTIONS block

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 10:52:10 PDT 2016


evgeny777 added inline comments.

================
Comment at: ELF/Writer.cpp:258
@@ -259,1 +257,3 @@
+    Script<ELFT>::X->processCommands(Factory);
+  }
 
----------------
atanasyan wrote:
> >> Is it important that we call processCommands in the beginning of the LinkerScript::createSections but after the Writer::createSections?
> > Yes. You can now use section size and alignment in expressions, even though you may have no SECTIONS block at all.
> 
> OK. Is it possible to rewrite the code like that? The idea is to make clear that we always call the `processCommands`.
> 
> ```
> if (ScriptConfig->HasSections)
>   Script<ELFT>::X->createSections(Factory);
> else
>   createSections();
> Script<ELFT>::X->processCommands(Factory);
> ```
No, createSections calls processCommands(). It is not possible to create sections in LinkerScript without walking over command list and at the same time processCommands() should be called after Writer<ELFT>::createSections(), because in this case it's possible to use SIZEOF, ALIGNOF in symbol assignments.





https://reviews.llvm.org/D24450





More information about the llvm-commits mailing list