diff options
| author | Meador Inge <meadori@codesourcery.com> | 2017-07-26 21:51:09 +0000 |
|---|---|---|
| committer | Meador Inge <meadori@codesourcery.com> | 2017-07-26 21:51:09 +0000 |
| commit | b0e62297427a6d4725cdffbd82d96f1ff7ef310e (patch) | |
| tree | 675f2b1217febb975dfcbae2168b030efe167bde | |
| parent | cb98c14f894c2d50834281588d036383eacc5748 (diff) | |
| download | bcm5719-llvm-b0e62297427a6d4725cdffbd82d96f1ff7ef310e.tar.gz bcm5719-llvm-b0e62297427a6d4725cdffbd82d96f1ff7ef310e.zip | |
[ELF, LinkerScript] Memory region name parsing fix
This patch fixes a small issue with respect to how memory region names
are parsed on output section descriptions. For example, consider:
.text : { *(.text) } > rom
That can also be written like:
.text : { *(.text) } >rom
The latter form is accepted by GNU LD and is fairly common.
Differential Revision: https://reviews.llvm.org/D35920
llvm-svn: 309191
| -rw-r--r-- | lld/ELF/ScriptParser.cpp | 2 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/memory.s | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 29570c80d2f..b5fd76bef9e 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -652,6 +652,8 @@ ScriptParser::readOutputSectionDescription(StringRef OutSec) { if (consume(">")) Cmd->MemoryRegionName = next(); + else if (peek().startswith(">")) + Cmd->MemoryRegionName = next().drop_front(); Cmd->Phdrs = readOutputSectionPhdrs(); diff --git a/lld/test/ELF/linkerscript/memory.s b/lld/test/ELF/linkerscript/memory.s index 774a6f92ab1..172768394d3 100644 --- a/lld/test/ELF/linkerscript/memory.s +++ b/lld/test/ELF/linkerscript/memory.s @@ -21,8 +21,8 @@ # RUN: rom (rx) : org = (0x80 * 0x1000 * 0x1000), len = 64M \ # RUN: } \ # RUN: SECTIONS { \ -# RUN: .text : { *(.text) } > rom \ -# RUN: .data : { *(.data) } > ram \ +# RUN: .text : { *(.text) } >rom \ +# RUN: .data : { *(.data) } >ram \ # RUN: }" > %t.script # RUN: ld.lld -o %t1 --script %t.script %t # RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix=RAMROM %s |

