[lld] r250106 - [ELF2/LinkerScript] Fix OUTPUT_FORMAT directive parsing
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 14:08:42 PDT 2015
Author: davide
Date: Mon Oct 12 16:08:41 2015
New Revision: 250106
URL: http://llvm.org/viewvc/llvm-project?rev=250106&view=rev
Log:
[ELF2/LinkerScript] Fix OUTPUT_FORMAT directive parsing
Differential Revision: http://reviews.llvm.org/D13668
Added:
lld/trunk/test/elf2/linkerscript-ouputformat.s
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=250106&r1=250105&r2=250106&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Oct 12 16:08:41 2015
@@ -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(")");
}
Added: lld/trunk/test/elf2/linkerscript-ouputformat.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/linkerscript-ouputformat.s?rev=250106&view=auto
==============================================================================
--- lld/trunk/test/elf2/linkerscript-ouputformat.s (added)
+++ lld/trunk/test/elf2/linkerscript-ouputformat.s Mon Oct 12 16:08:41 2015
@@ -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
More information about the llvm-commits
mailing list