[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
This commit is contained in:
@@ -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(":");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user