aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2017-06-07 16:31:08 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2017-06-07 16:31:08 +0000
commitfbb0463f3988da305c2993569a7723d573d430ce (patch)
treedf92ee7f918ea9adfcc0b4e9d5f5687b737e75d5 /lld/ELF/ScriptParser.cpp
parent92f6677159172fcab9daf5a0e761fd6b450a3f52 (diff)
downloadllvm-fbb0463f3988da305c2993569a7723d573d430ce.zip
llvm-fbb0463f3988da305c2993569a7723d573d430ce.tar.gz
llvm-fbb0463f3988da305c2993569a7723d573d430ce.tar.bz2
[ELF] - Linkerscript: implement NOLOAD section type.
This is PR32351 Each output section may have a type. The type is a keyword in parentheses. (https://sourceware.org/binutils/docs/ld/Output-Section-Type.html#Output-Section-Type) This patch support only one type, it is NOLOAD. If output section has such type, we force it to be SHT_NOBITS. More details are available on a review page. Differential revision: https://reviews.llvm.org/D33647 llvm-svn: 304925
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index fc6b8e3..61e682c 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -568,10 +568,20 @@ ScriptParser::readOutputSectionDescription(StringRef OutSec) {
OutputSectionCommand *Cmd =
Script->createOutputSectionCommand(OutSec, getCurrentLocation());
- // Read an address expression.
- // https://sourceware.org/binutils/docs/ld/Output-Section-Address.html
- if (peek() != ":")
- Cmd->AddrExpr = readExpr();
+ if (peek() != ":") {
+ // Read an address expression.
+ // https://sourceware.org/binutils/docs/ld/Output-Section-Address.html
+ if (peek() != "(")
+ Cmd->AddrExpr = readExpr();
+
+ // Read a section type. Currently, only NOLOAD is supported.
+ // https://sourceware.org/binutils/docs/ld/Output-Section-Type.html
+ if (consume("(")) {
+ expect("NOLOAD");
+ expect(")");
+ Cmd->Noload = true;
+ }
+ }
expect(":");