summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-08-17 18:59:16 +0000
committerRui Ueyama <ruiu@google.com>2016-08-17 18:59:16 +0000
commit6ad7dfcc1e69f9b7e95af3bf7a7f414dad97a124 (patch)
tree7be585f5194dccb2088daf87cbc15043bcb17809
parent26cb1d266081d85d6fe410b1f7fa741ba2a37dda (diff)
downloadbcm5719-llvm-6ad7dfcc1e69f9b7e95af3bf7a7f414dad97a124.tar.gz
bcm5719-llvm-6ad7dfcc1e69f9b7e95af3bf7a7f414dad97a124.zip
Merge readAt and readAlign.
Now that they are identical. llvm-svn: 278953
-rw-r--r--lld/ELF/LinkerScript.cpp42
1 files changed, 14 insertions, 28 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index fd2dfa232d4..4d8cec0fb8b 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -621,8 +621,6 @@ private:
SortKind readSortKind();
SymbolAssignment *readProvideHidden(bool Provide, bool Hidden);
SymbolAssignment *readProvideOrAssignment(StringRef Tok);
- Expr readAt();
- Expr readAlign();
void readSort();
Expr readAssert();
@@ -630,6 +628,7 @@ private:
Expr readExpr1(Expr Lhs, int MinPrec);
Expr readPrimary();
Expr readTernary(Expr Cond);
+ Expr readParenExpr();
const static StringMap<Handler> Cmd;
ScriptConfiguration &Opt = *ScriptConfig;
@@ -900,13 +899,6 @@ InputSectionDescription *ScriptParser::readInputSectionDescription() {
return readInputSectionRules();
}
-Expr ScriptParser::readAlign() {
- expect("(");
- Expr E = readExpr();
- expect(")");
- return E;
-}
-
void ScriptParser::readSort() {
expect("(");
expect("CONSTRUCTORS");
@@ -927,13 +919,6 @@ Expr ScriptParser::readAssert() {
};
}
-Expr ScriptParser::readAt() {
- expect("(");
- Expr E = readExpr();
- expect(")");
- return E;
-}
-
OutputSectionCommand *
ScriptParser::readOutputSectionDescription(StringRef OutSec) {
OutputSectionCommand *Cmd = new OutputSectionCommand(OutSec);
@@ -946,10 +931,9 @@ ScriptParser::readOutputSectionDescription(StringRef OutSec) {
expect(":");
if (skip("AT"))
- Cmd->LmaExpr = readAt();
-
+ Cmd->LmaExpr = readParenExpr();
if (skip("ALIGN"))
- Cmd->AlignExpr = readAlign();
+ Cmd->AlignExpr = readParenExpr();
// Parse constraints.
if (skip("ONLY_IF_RO"))
@@ -1166,22 +1150,17 @@ uint64_t static getConstant(StringRef S) {
}
Expr ScriptParser::readPrimary() {
- StringRef Tok = next();
+ if (peek() == "(")
+ return readParenExpr();
- if (Tok == "(") {
- Expr E = readExpr();
- expect(")");
- return E;
- }
+ StringRef Tok = next();
// Built-in functions are parsed here.
// https://sourceware.org/binutils/docs/ld/Builtin-Functions.html.
if (Tok == "ASSERT")
return readAssert();
if (Tok == "ALIGN") {
- expect("(");
- Expr E = readExpr();
- expect(")");
+ Expr E = readParenExpr();
return [=](uint64_t Dot) { return alignTo(Dot, E(Dot)); };
}
if (Tok == "CONSTANT") {
@@ -1251,6 +1230,13 @@ Expr ScriptParser::readTernary(Expr Cond) {
return [=](uint64_t Dot) { return Cond(Dot) ? L(Dot) : R(Dot); };
}
+Expr ScriptParser::readParenExpr() {
+ expect("(");
+ Expr E = readExpr();
+ expect(")");
+ return E;
+}
+
std::vector<StringRef> ScriptParser::readOutputSectionPhdrs() {
std::vector<StringRef> Phdrs;
while (!Error && peek().startswith(":")) {
OpenPOWER on IntegriCloud