diff options
author | Rui Ueyama <ruiu@google.com> | 2016-10-13 23:08:33 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-10-13 23:08:33 +0000 |
commit | b04af133f561223c516b500a8cd2ecbf5b20849b (patch) | |
tree | dd728e5de1f4d62473d6bf5bd9e0cf8471a30861 | |
parent | b50df911788541fb5e17fe7cf3ce25330101a53a (diff) | |
download | bcm5719-llvm-b04af133f561223c516b500a8cd2ecbf5b20849b.tar.gz bcm5719-llvm-b04af133f561223c516b500a8cd2ecbf5b20849b.zip |
Improve comments.
llvm-svn: 284177
-rw-r--r-- | lld/ELF/LinkerScript.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h index db9a7792cb8..1241fb0f9eb 100644 --- a/lld/ELF/LinkerScript.h +++ b/lld/ELF/LinkerScript.h @@ -33,12 +33,17 @@ template <class ELFT> class OutputSectionBase; template <class ELFT> class OutputSectionFactory; class InputSectionData; +// This represents an expression in the linker script. +// ScriptParser::readExpr reads an expression and returns an Expr. +// Later, we evaluate the expression by calling the function +// with the value of special context variable ".". typedef std::function<uint64_t(uint64_t)> Expr; // Parses a linker script. Calling this function updates // Config and ScriptConfig. void readLinkerScript(MemoryBufferRef MB); +// Parses a version script. void readVersionScript(MemoryBufferRef MB); // This enum is used to implement linker script SECTIONS command. @@ -57,6 +62,7 @@ struct BaseCommand { int Kind; }; +// This represents ". = <expr>" or "<symbol> = <expr>". struct SymbolAssignment : BaseCommand { SymbolAssignment(StringRef Name, Expr E, bool IsAbsolute) : BaseCommand(AssignmentKind), Name(Name), Expression(E), @@ -77,10 +83,9 @@ struct SymbolAssignment : BaseCommand { }; // Linker scripts allow additional constraints to be put on ouput sections. -// An output section will only be created if all of its input sections are -// read-only -// or all of its input sections are read-write by using the keyword ONLY_IF_RO -// and ONLY_IF_RW respectively. +// If an output section is marked as ONLY_IF_RO, the section is created +// only if its input sections are read-only. Likewise, an output section +// with ONLY_IF_RW is created if all input sections are RW. enum class ConstraintKind { NoConstraint, ReadOnly, ReadWrite }; struct OutputSectionCommand : BaseCommand { @@ -133,12 +138,14 @@ struct InputSectionDescription : BaseCommand { std::vector<InputSectionData *> Sections; }; +// Represents an ASSERT(). struct AssertCommand : BaseCommand { AssertCommand(Expr E) : BaseCommand(AssertKind), Expression(E) {} static bool classof(const BaseCommand *C); Expr Expression; }; +// Represents BYTE(), SHORT(), LONG(), or QUAD(). struct BytesDataCommand : BaseCommand { BytesDataCommand(uint64_t Data, unsigned Size) : BaseCommand(BytesDataKind), Data(Data), Size(Size) {} |