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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 13:55:21 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:214-215
@@ -213,1 +213,4 @@
   expect("(");
+  StringRef Tok = next();
+  Tok = next();
+  if (Tok == ")")
----------------
  next();
  StringRef Tok = next();

================
Comment at: test/elf2/linkerscript-ouputformat.s:2-3
@@ +1,4 @@
+# REQUIRES: x86
+# RUN: echo "OUTPUT_FORMAT(\"elf64-x86-64-default\", \"elf64-x86-64-big\", \
+# RUN: \"elf64-x86-64-big\")" > %t.script
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1
----------------
I'd write OUTPUT_FORMAT(x, y, z) as we don't actually care about the values.

================
Comment at: test/elf2/linkerscript-ouputformat.s:8
@@ +7,3 @@
+
+# RUN: echo "OUTPUT_FORMAT(\"elf64-x86-64-default\", \"elf64-x86-64-big\")" \
+# RUN:  > %t.script
----------------
So is this.

================
Comment at: test/elf2/linkerscript-ouputformat.s:12
@@ +11,2 @@
+# RUN: not ld.lld2 -shared -o %t2 %t1 %t.script
+# RUN: llvm-readobj %t2 > /dev/null
----------------
You also need a test to check OUTPUT_FOMAT(x) is considered valid.


http://reviews.llvm.org/D13668





More information about the llvm-commits mailing list