[PATCH] D38582: [ELF] - Get rid of LinkerScript::adjustSectionsBeforeSorting().

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 20:17:02 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/LinkerScript.cpp:424-427
+        // A directive may contain symbol definitions like this:
+        // ".foo : { ...; bar = .; }". Handle them.
+        if (auto *OutCmd = dyn_cast<SymbolAssignment>(Base))
+          addSymbol(OutCmd);
----------------
I don't like to do more things in a single for-loop. Previously, this loop was just three lines. Now it does more things. It is hard to understand now. Please try to split it into smaller pieces.


================
Comment at: ELF/LinkerScript.cpp:432-440
+        // If the output section contains any other commands except input
+        // section descriptions, we create a corresponding output section. The
+        // bfd linker seems to only create them if  '.' is assigned to. But
+        // creating these section should not have any bad consequeces and gives
+        // us a section to put in the content of commands like BYTE() or attach
+        // symbols assigned.
+        Sec->Live = true;
----------------
I really do not understand how this comment explains the following code.


https://reviews.llvm.org/D38582





More information about the llvm-commits mailing list