summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r--lld/ELF/LinkerScript.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 474801f3b80..a2b4fa5687f 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -37,6 +37,7 @@ private:
void expect(StringRef Expect);
void readAsNeeded();
+ void readEntry();
void readGroup();
void readOutput();
void readOutputFormat();
@@ -49,7 +50,9 @@ private:
void LinkerScript::run() {
while (!atEOF()) {
StringRef Tok = next();
- if (Tok == "GROUP") {
+ if (Tok == "ENTRY") {
+ readEntry();
+ } else if (Tok == "GROUP") {
readGroup();
} else if (Tok == "OUTPUT") {
readOutput();
@@ -131,6 +134,15 @@ void LinkerScript::readAsNeeded() {
}
}
+void LinkerScript::readEntry() {
+ // -e <symbol> takes predecence over ENTRY(<symbol>).
+ expect("(");
+ StringRef Tok = next();
+ if (Config->Entry.empty())
+ Config->Entry = Tok;
+ expect(")");
+}
+
void LinkerScript::readGroup() {
expect("(");
for (;;) {
OpenPOWER on IntegriCloud