[PATCH] D13668: [ELF2/LinkerScript] Fix OUTPUT_FORMAT directive parsing

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 14:10:42 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL250106: [ELF2/LinkerScript] Fix OUTPUT_FORMAT directive parsing (authored by davide).

Changed prior to commit:
  http://reviews.llvm.org/D13668?vs=37166&id=37170#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13668

Files:
  lld/trunk/ELF/LinkerScript.cpp
  lld/trunk/test/elf2/linkerscript-ouputformat.s

Index: lld/trunk/test/elf2/linkerscript-ouputformat.s
===================================================================
--- lld/trunk/test/elf2/linkerscript-ouputformat.s
+++ lld/trunk/test/elf2/linkerscript-ouputformat.s
@@ -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
Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -212,6 +212,14 @@
   // Error checking only for now.
   expect("(");
   next();
+  StringRef Tok = next();
+  if (Tok == ")")
+   return;
+  if (Tok != ",")
+    error("unexpected token: " + Tok);
+  next();
+  expect(",");
+  next();
   expect(")");
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13668.37170.patch
Type: text/x-patch
Size: 1102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151012/2cd35f73/attachment.bin>


More information about the llvm-commits mailing list