[PATCH] D29276: [ELF] - Linkerscript: do not fail on additional semicolons in linkerscript.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 01:01:36 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL293612: [ELF] - Linkerscript: do not fail on additional semicolons in linkerscript. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D29276?vs=86283&id=86392#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29276

Files:
  lld/trunk/ELF/LinkerScript.cpp
  lld/trunk/test/ELF/linkerscript/sections.s


Index: lld/trunk/test/ELF/linkerscript/sections.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/sections.s
+++ lld/trunk/test/ELF/linkerscript/sections.s
@@ -93,6 +93,11 @@
 # SEC-MULTI: 6 .shstrtab     00000035 {{[0-9a-f]*}}
 # SEC-MULTI: 7 .strtab       00000008 {{[0-9a-f]*}}
 
+# Input section pattern contains additional semicolon.
+# Case found in linux kernel script. Check we are able to parse it.
+# RUN: echo "SECTIONS { .text : { ;;*(.text);;S = 0;; } }" > %t.script
+# RUN: ld.lld -o /dev/null --script %t.script %t
+
 .globl _start
 _start:
     mov $60, %rax
Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -1493,7 +1493,10 @@
 
   while (!Error && !consume("}")) {
     StringRef Tok = next();
-    if (SymbolAssignment *Assignment = readProvideOrAssignment(Tok)) {
+    if (Tok == ";") {
+      // Commands may contain excessive additional semicolons around.
+      // We should be able to parse it.
+    } else if (SymbolAssignment *Assignment = readProvideOrAssignment(Tok)) {
       Cmd->Commands.emplace_back(Assignment);
     } else if (BytesDataCommand *Data = readBytesDataCommand(Tok)) {
       Cmd->Commands.emplace_back(Data);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29276.86392.patch
Type: text/x-patch
Size: 1342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170131/b547eb43/attachment.bin>


More information about the llvm-commits mailing list