forked from OSchip/llvm-project
[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
This commit is contained in:
parent
61e29aafa7
commit
2fe079233b
|
@ -1493,7 +1493,10 @@ ScriptParser::readOutputSectionDescription(StringRef OutSec) {
|
|||
|
||||
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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue