[lld] r250223 - [ELF2/Linkerscript] Skip semicolon in linker directives parsing.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 13:48:56 PDT 2015


Author: davide
Date: Tue Oct 13 15:48:56 2015
New Revision: 250223

URL: http://llvm.org/viewvc/llvm-project?rev=250223&view=rev
Log:
[ELF2/Linkerscript] Skip semicolon in linker directives parsing.

The documentation says: "You may separate commands using semicolons",
so they seem to be optional.

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

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/test/elf2/linkerscript.s

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=250223&r1=250222&r2=250223&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Oct 13 15:48:56 2015
@@ -59,6 +59,8 @@ private:
 void LinkerScript::run() {
   while (!atEOF()) {
     StringRef Tok = next();
+    if (Tok == ";")
+      continue;
     if (Tok == "ENTRY") {
       readEntry();
     } else if (Tok == "GROUP" || Tok == "INPUT") {

Modified: lld/trunk/test/elf2/linkerscript.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/linkerscript.s?rev=250223&r1=250222&r2=250223&view=diff
==============================================================================
--- lld/trunk/test/elf2/linkerscript.s (original)
+++ lld/trunk/test/elf2/linkerscript.s Tue Oct 13 15:48:56 2015
@@ -76,6 +76,14 @@
 # RUN: ld.lld2 %t.script %t
 # RUN: llvm-readobj %t.out > /dev/null
 
+# RUN: echo ";SEARCH_DIR(x);SEARCH_DIR(y);" > %t.script
+# RUN: ld.lld2 %t.script %t
+# RUN: llvm-readobj %t.out > /dev/null
+
+# RUN: echo ";" > %t.script
+# RUN: ld.lld2 %t.script %t
+# RUN: llvm-readobj %t.out > /dev/null
+
 # RUN: echo "INCLUDE " %t.script2 "OUTPUT(" %t.out ")" > %t.script1
 # RUN: echo "GROUP(" %t ")" > %t.script2
 # RUN: ld.lld2 %t.script1




More information about the llvm-commits mailing list