Sort. NFC.

llvm-svn: 298447
This commit is contained in:
Rui Ueyama 2017-03-21 21:49:16 +00:00
parent ea4b78fcb3
commit fc16173ceb

View File

@ -1796,12 +1796,6 @@ Expr ScriptParser::readPrimary() {
return {Script->getOutputSection(Location, Name), 0}; return {Script->getOutputSection(Location, Name), 0};
}; };
} }
if (Tok == "LOADADDR") {
StringRef Name = readParenLiteral();
return [=] { return Script->getOutputSection(Location, Name)->getLMA(); };
}
if (Tok == "ASSERT")
return readAssert();
if (Tok == "ALIGN") { if (Tok == "ALIGN") {
expect("("); expect("(");
Expr E = readExpr(); Expr E = readExpr();
@ -1813,22 +1807,16 @@ Expr ScriptParser::readPrimary() {
expect(")"); expect(")");
return [=] { return alignTo(Script->getDot(), E().getValue()); }; return [=] { return alignTo(Script->getDot(), E().getValue()); };
} }
if (Tok == "ALIGNOF") {
StringRef Name = readParenLiteral();
return [=] { return Script->getOutputSection(Location, Name)->Alignment; };
}
if (Tok == "ASSERT")
return readAssert();
if (Tok == "CONSTANT") { if (Tok == "CONSTANT") {
StringRef Name = readParenLiteral(); StringRef Name = readParenLiteral();
return [=] { return getConstant(Name); }; return [=] { return getConstant(Name); };
} }
if (Tok == "DEFINED") {
StringRef Name = readParenLiteral();
return [=] { return Script->isDefined(Name) ? 1 : 0; };
}
if (Tok == "SEGMENT_START") {
expect("(");
skip();
expect(",");
Expr E = readExpr();
expect(")");
return [=] { return E(); };
}
if (Tok == "DATA_SEGMENT_ALIGN") { if (Tok == "DATA_SEGMENT_ALIGN") {
expect("("); expect("(");
Expr E = readExpr(); Expr E = readExpr();
@ -1843,10 +1831,10 @@ Expr ScriptParser::readPrimary() {
expect(")"); expect(")");
return [] { return Script->getDot(); }; return [] { return Script->getDot(); };
} }
// GNU linkers implements more complicated logic to handle
// DATA_SEGMENT_RELRO_END. We instead ignore the arguments and just align to
// the next page boundary for simplicity.
if (Tok == "DATA_SEGMENT_RELRO_END") { if (Tok == "DATA_SEGMENT_RELRO_END") {
// GNU linkers implements more complicated logic to handle
// DATA_SEGMENT_RELRO_END. We instead ignore the arguments and
// just align to the next page boundary for simplicity.
expect("("); expect("(");
readExpr(); readExpr();
expect(","); expect(",");
@ -1854,14 +1842,26 @@ Expr ScriptParser::readPrimary() {
expect(")"); expect(")");
return [] { return alignTo(Script->getDot(), Target->PageSize); }; return [] { return alignTo(Script->getDot(), Target->PageSize); };
} }
if (Tok == "DEFINED") {
StringRef Name = readParenLiteral();
return [=] { return Script->isDefined(Name) ? 1 : 0; };
}
if (Tok == "LOADADDR") {
StringRef Name = readParenLiteral();
return [=] { return Script->getOutputSection(Location, Name)->getLMA(); };
}
if (Tok == "SEGMENT_START") {
expect("(");
skip();
expect(",");
Expr E = readExpr();
expect(")");
return [=] { return E(); };
}
if (Tok == "SIZEOF") { if (Tok == "SIZEOF") {
StringRef Name = readParenLiteral(); StringRef Name = readParenLiteral();
return [=] { return Script->getOutputSectionSize(Name); }; return [=] { return Script->getOutputSectionSize(Name); };
} }
if (Tok == "ALIGNOF") {
StringRef Name = readParenLiteral();
return [=] { return Script->getOutputSection(Location, Name)->Alignment; };
}
if (Tok == "SIZEOF_HEADERS") if (Tok == "SIZEOF_HEADERS")
return [=] { return elf::getHeaderSize(); }; return [=] { return elf::getHeaderSize(); };