[lld] r314707 - Rewrite a comment.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 11:54:59 PDT 2017


Author: ruiu
Date: Mon Oct  2 11:54:59 2017
New Revision: 314707

URL: http://llvm.org/viewvc/llvm-project?rev=314707&view=rev
Log:
Rewrite a comment.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=314707&r1=314706&r2=314707&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Oct  2 11:54:59 2017
@@ -1164,10 +1164,18 @@ static void applySynthetic(const std::ve
       Fn(SS);
 }
 
-// We need to add input synthetic sections early in createSyntheticSections()
-// to make them visible from linkescript side. But not all sections are always
-// required to be in output. For example we don't need dynamic section content
-// sometimes. This function filters out such unused sections from the output.
+// In order to allow users to manipulate linker-synthesized sections,
+// we had to add synthetic sections to the input section list early,
+// even before we make decisions whether they are needed. This allows
+// users to write scripts like this: ".mygot : { .got }".
+//
+// Doing it has an unintended side effects. If it turns out that we
+// don't need a .got (for example) at all because there's no
+// relocation that needs a .got, we don't want to emit .got.
+//
+// To deal with the above problem, this function is called after
+// scanRelocations is called to remove synthetic sections that turn
+// out to be empty.
 static void removeUnusedSyntheticSections() {
   // All input synthetic sections that can be empty are placed after
   // all regular ones. We iterate over them all and exit at first




More information about the llvm-commits mailing list