[lld] r278408 - Add comments.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 11 14:00:02 PDT 2016
Author: ruiu
Date: Thu Aug 11 16:00:02 2016
New Revision: 278408
URL: http://llvm.org/viewvc/llvm-project?rev=278408&view=rev
Log:
Add comments.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=278408&r1=278407&r2=278408&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Aug 11 16:00:02 2016
@@ -137,6 +137,16 @@ LinkerScript<ELFT>::getInputSections(con
}
namespace {
+
+// You can define new symbols using linker scripts. For example,
+// ".text { abc.o(.text); foo = .; def.o(.text); }" defines symbol
+// foo just after abc.o's text section contents. This class is to
+// handle such symbol definitions.
+//
+// In order to handle scripts like the above one, we want to
+// keep symbol definitions in output sections. Because output sections
+// can contain only input sections, we wrap symbol definitions
+// with dummy input sections. This class serves that purpose.
template <class ELFT> class LayoutInputSection : public InputSection<ELFT> {
public:
LayoutInputSection(SymbolAssignment *Cmd);
@@ -174,7 +184,8 @@ private:
template <class ELFT>
std::vector<std::unique_ptr<LayoutInputSection<ELFT>>>
OutputSectionBuilder<ELFT>::OwningSections;
-}
+
+} // anonymous namespace
template <class T> static T *zero(T *Val) {
memset(Val, 0, sizeof(*Val));
More information about the llvm-commits
mailing list