Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -45,6 +45,7 @@ void readGroup(); void readInclude(); void readOutput(); + void readOutputArch(); void readOutputFormat(); void readSearchDir(); @@ -65,6 +66,8 @@ 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 @@ expect(")"); } +void LinkerScript::readOutputArch() { + // Error checking only for now. + expect("("); + next(); + expect(")"); +} + void LinkerScript::readOutputFormat() { // Error checking only for now. expect("("); Index: test/elf2/linkerscript-outputarch.s =================================================================== --- test/elf2/linkerscript-outputarch.s +++ 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