diff options
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 10 | ||||
-rw-r--r-- | lld/test/elf2/linkerscript-outputarch.s | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 4d05e10f7e4..ddd82663eee 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -45,6 +45,7 @@ private: void readGroup(); void readInclude(); void readOutput(); + void readOutputArch(); void readOutputFormat(); void readSearchDir(); @@ -65,6 +66,8 @@ void LinkerScript::run() { readInclude(); } else if (Tok == "OUTPUT") { readOutput(); + } else if (Tok == "OUTPUT_ARCH") { + readOutputArch(); } else if (Tok == "OUTPUT_FORMAT") { readOutputFormat(); } else if (Tok == "SEARCH_DIR") { @@ -208,6 +211,13 @@ void LinkerScript::readOutput() { expect(")"); } +void LinkerScript::readOutputArch() { + // Error checking only for now. + expect("("); + next(); + expect(")"); +} + void LinkerScript::readOutputFormat() { // Error checking only for now. expect("("); diff --git a/lld/test/elf2/linkerscript-outputarch.s b/lld/test/elf2/linkerscript-outputarch.s new file mode 100644 index 00000000000..a25f5119bec --- /dev/null +++ b/lld/test/elf2/linkerscript-outputarch.s @@ -0,0 +1,10 @@ +# REQUIRES: x86 +# RUN: echo "OUTPUT_ARCH(x)" > %t.script +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1 +# RUN: ld.lld2 -shared -o %t2 %t1 %t.script +# RUN: llvm-readobj %t2 > /dev/null + +# RUN: echo "OUTPUT_ARCH(x, y)" > %t.script +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1 +# RUN: not ld.lld2 -shared -o %t2 %t1 %t.script +# RUN: llvm-readobj %t2 > /dev/null |