diff options
author | Denis Protivensky <dprotivensky@accesssoftek.com> | 2015-10-08 06:48:38 +0000 |
---|---|---|
committer | Denis Protivensky <dprotivensky@accesssoftek.com> | 2015-10-08 06:48:38 +0000 |
commit | 90c5099e8a6e78aa29575bfdc83dfbf1543af7fc (patch) | |
tree | 1ba11ae0541d25b4fcf88e4d0b56dd8ce54efefd /lld/ELF/LinkerScript.cpp | |
parent | c10b8381f761ad7ff9a8c34b687b9320e07f9726 (diff) | |
download | bcm5719-llvm-90c5099e8a6e78aa29575bfdc83dfbf1543af7fc.tar.gz bcm5719-llvm-90c5099e8a6e78aa29575bfdc83dfbf1543af7fc.zip |
[ELF2] Add ENTRY command to the linker script
Set ENTRY as an entry point if -e is not specified.
Differential Revision: http://reviews.llvm.org/D13509
llvm-svn: 249661
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 14 |
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 (;;) { |