diff options
author | Rui Ueyama <ruiu@google.com> | 2015-10-07 00:25:09 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-10-07 00:25:09 +0000 |
commit | ee59282bfd2dfc0175591176c3e45c8ecf0931cf (patch) | |
tree | e9c5fa6e44b17c3c3cbf84edd668568be6ce9b93 /lld/ELF/LinkerScript.cpp | |
parent | f1f36517b7c6c17a132532db331461797892012c (diff) | |
download | bcm5719-llvm-ee59282bfd2dfc0175591176c3e45c8ecf0931cf.tar.gz bcm5719-llvm-ee59282bfd2dfc0175591176c3e45c8ecf0931cf.zip |
ELF2: Implement OUTPUT() linker script directive.
llvm-svn: 249491
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("("); |