[ELF2/LinkerScript] Fix OUTPUT_FORMAT directive parsing

Differential Revision:	 http://reviews.llvm.org/D13668

llvm-svn: 250106
This commit is contained in:
Davide Italiano 2015-10-12 21:08:41 +00:00
parent 2c072af95e
commit 6836c6182d
2 changed files with 18 additions and 0 deletions

View File

@ -212,6 +212,14 @@ void LinkerScript::readOutputFormat() {
// Error checking only for now.
expect("(");
next();
StringRef Tok = next();
if (Tok == ")")
return;
if (Tok != ",")
error("unexpected token: " + Tok);
next();
expect(",");
next();
expect(")");
}

View File

@ -0,0 +1,10 @@
# REQUIRES: x86
# RUN: echo "OUTPUT_FORMAT(x, y, z)" > %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_FORMAT(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