diff options
| author | George Rimar <grimar@accesssoftek.com> | 2017-01-17 15:32:12 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2017-01-17 15:32:12 +0000 |
| commit | 7185a1acec989d537f9523389516ca233822192b (patch) | |
| tree | c02fbbcab95586f879bf6244db7c8aa3a715d204 | |
| parent | 9dffada98bdf2af532c4371ac6ba89262bb8beb8 (diff) | |
| download | bcm5719-llvm-7185a1acec989d537f9523389516ca233822192b.tar.gz bcm5719-llvm-7185a1acec989d537f9523389516ca233822192b.zip | |
[ELF] - Support optional comma after output section command.
I found this when tried to link linux kernel with LLD:
https://github.com/torvalds/linux/blob/master/arch/x86/entry/vdso/vdso-layout.lds.S#L86
Output section command can have optional comma at the end:
.text : { *(.text*) } :text =0x90909090,
It was documented about 3 years ago for binutils:
https://sourceware.org/ml/binutils/2014-04/msg00045.html
Differential revision: https://reviews.llvm.org/D28803
llvm-svn: 292225
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 3 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/sections-padding.s | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 887ca12537a..d6d4c746a7e 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -1471,6 +1471,9 @@ ScriptParser::readOutputSectionDescription(StringRef OutSec) { else if (peek().startswith("=")) Cmd->Filler = readOutputSectionFiller(next().drop_front()); + // Consume optional comma following output section command. + consume(","); + return Cmd; } diff --git a/lld/test/ELF/linkerscript/sections-padding.s b/lld/test/ELF/linkerscript/sections-padding.s index 51d3a88fadf..af6483ae0a2 100644 --- a/lld/test/ELF/linkerscript/sections-padding.s +++ b/lld/test/ELF/linkerscript/sections-padding.s @@ -36,6 +36,11 @@ # RUN: ld.lld -o %t.out --script %t.script %t # RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s +## Check case with optional comma following output section command: +# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x1122, .a : { *(.a*) } }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s + .section .mysec.1,"a" .align 16 .byte 0x66 |

