[ELF] - Linkerscript: do not fail on additional semicolons in linkerscript.
Linux kernel linkerscript contains additional semicolon (last line):
.apicdrivers : AT(ADDR(.apicdrivers) - LOAD_OFFSET) {
__apicdrivers = .;
*(.apicdrivers);
I checked that both gold and bfd are able to parse something like:
.text : { ;;*(.text);;S = 0;; } }
Patch do the same.
Differential revision: https://reviews.llvm.org/D29276
llvm-svn: 293612
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 0357357..f1a17b3 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/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);