[PATCH] D38239: [ELF] - Define linkerscript symbols early.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 23:07:34 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/LinkerScript.cpp:122
+//    finalize symbols values which are known at that point.
+SymbolBody *LinkerScript::addSymbol(SymbolAssignment *Cmd, bool DefineOnly) {
   if (Cmd->Name == ".")
----------------
I'm still not impressed by this change because it looks like this patch is making this function unnecessarily complicated.

If you add a boolean flag to an existing function and execute some pieces of code of the function only when the flag is true, you are effectively defining two separate functions sharing some amount of code. As a reader of this code, I need to think if the pieces of code that are not guarded by flag work correctly with and without that flag. It is hard to do.


https://reviews.llvm.org/D38239





More information about the llvm-commits mailing list