diff options
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 44c045ad17c..474801f3b80 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -38,6 +38,7 @@ private: void readAsNeeded(); void readGroup(); + void readOutput(); void readOutputFormat(); std::vector<StringRef> Tokens; @@ -50,6 +51,8 @@ void LinkerScript::run() { StringRef Tok = next(); if (Tok == "GROUP") { readGroup(); + } else if (Tok == "OUTPUT") { + readOutput(); } else if (Tok == "OUTPUT_FORMAT") { readOutputFormat(); } else { @@ -142,6 +145,15 @@ void LinkerScript::readGroup() { } } +void LinkerScript::readOutput() { + // -o <file> takes predecence over OUTPUT(<file>). + expect("("); + StringRef Tok = next(); + if (Config->OutputFile.empty()) + Config->OutputFile = Tok; + expect(")"); +} + void LinkerScript::readOutputFormat() { // Error checking only for now. expect("("); |