summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2016-09-23 13:29:20 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2016-09-23 13:29:20 +0000
commit4ebc562052d82bd51179703a4f9e557ced817973 (patch)
treea2da8eb3b84a0edd9b16178b11cb9eec9faa9de5
parentdaf4cb8b6a71ea2f548f3862fa7248409503defb (diff)
downloadbcm5719-llvm-4ebc562052d82bd51179703a4f9e557ced817973.tar.gz
bcm5719-llvm-4ebc562052d82bd51179703a4f9e557ced817973.zip
[ELF] - Linkerscript: accept space between '=' and expression in section filler.
Previously we failed to parse next scripts because disallowed a space between filler value and '=': .text : { ... } :text = 0x9090 Differential revision: https://reviews.llvm.org/D24831 llvm-svn: 282248
-rw-r--r--lld/ELF/LinkerScript.cpp6
-rw-r--r--lld/test/ELF/linkerscript/sections-padding.s5
2 files changed, 10 insertions, 1 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 0febb253149..646dbbd9500 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -1275,8 +1275,12 @@ ScriptParser::readOutputSectionDescription(StringRef OutSec) {
setError("unknown command " + Tok);
}
Cmd->Phdrs = readOutputSectionPhdrs();
- if (peek().startswith("="))
+
+ if (skip("="))
+ Cmd->Filler = readOutputSectionFiller(next());
+ else if (peek().startswith("="))
Cmd->Filler = readOutputSectionFiller(next().drop_front());
+
return Cmd;
}
diff --git a/lld/test/ELF/linkerscript/sections-padding.s b/lld/test/ELF/linkerscript/sections-padding.s
index e9efc75bd7f..51d3a88fadf 100644
--- a/lld/test/ELF/linkerscript/sections-padding.s
+++ b/lld/test/ELF/linkerscript/sections-padding.s
@@ -31,6 +31,11 @@
# RUN: | FileCheck --check-prefix=ERR2 %s
# ERR2: invalid filler expression: 0x99XX
+## Check case with space between '=' and expression:
+# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } = 0x1122 }" > %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
OpenPOWER on IntegriCloud