diff options
author | George Rimar <grimar@accesssoftek.com> | 2018-02-16 10:42:58 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2018-02-16 10:42:58 +0000 |
commit | 1c08e9f5cee04c0164a5f8408e6854ce64fe3d29 (patch) | |
tree | 92492c4afc3c9945c9e461febe70f3200239787b /lld/ELF/ScriptParser.cpp | |
parent | 53270d0fa61eb95a3f948dbcf5d65373abc86648 (diff) | |
download | bcm5719-llvm-1c08e9f5cee04c0164a5f8408e6854ce64fe3d29.tar.gz bcm5719-llvm-1c08e9f5cee04c0164a5f8408e6854ce64fe3d29.zip |
[ELF] - Support COPY, INFO, OVERLAY output sections attributes.
This is PR36298.
(COPY), (INFO), (OVERLAY) all have the same effect:
section should be marked as non-allocatable.
(https://www.eecs.umich.edu/courses/eecs373/readings/Linker.pdf,
3.6.8.1 Output Section Type)
Differential revision: https://reviews.llvm.org/D43071
llvm-svn: 325331
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 9f3eeda8b58..41857227641 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -617,12 +617,14 @@ uint32_t ScriptParser::readFill() { return V; } -// Reads an expression and/or the special directive "(NOLOAD)" for an -// output section definition. +// Reads an expression and/or the special directive for an output +// section definition. Directive is one of following: "(NOLOAD)", +// "(COPY)", "(INFO)" or "(OVERLAY)". // // An output section name can be followed by an address expression -// and/or by "(NOLOAD)". This grammar is not LL(1) because "(" can be -// interpreted as either the beginning of some expression or "(NOLOAD)". +// and/or directive. This grammar is not LL(1) because "(" can be +// interpreted as either the beginning of some expression or begining +// of directive. // // https://sourceware.org/binutils/docs/ld/Output-Section-Address.html // https://sourceware.org/binutils/docs/ld/Output-Section-Type.html @@ -633,6 +635,11 @@ void ScriptParser::readSectionAddressType(OutputSection *Cmd) { Cmd->Noload = true; return; } + if (consume("COPY") || consume("INFO") || consume("OVERLAY")) { + expect(")"); + Cmd->NonAlloc = true; + return; + } Cmd->AddrExpr = readExpr(); expect(")"); } else { |