@@ -123,7 +123,7 @@ class ScriptParser final : ScriptLexer {
123
123
Expr combine (StringRef op, Expr l, Expr r);
124
124
Expr readExpr ();
125
125
Expr readExpr1 (Expr lhs, int minPrec);
126
- StringRef readParenLiteral ();
126
+ StringRef readParenName ();
127
127
Expr readPrimary ();
128
128
Expr readTernary (Expr cond);
129
129
Expr readParenExpr ();
@@ -383,9 +383,9 @@ void ScriptParser::readAsNeeded() {
383
383
void ScriptParser::readEntry () {
384
384
// -e <symbol> takes predecence over ENTRY(<symbol>).
385
385
expect (" (" );
386
- StringRef tok = next ();
386
+ StringRef name = readName ();
387
387
if (config->entry .empty ())
388
- config->entry = unquote (tok) ;
388
+ config->entry = name ;
389
389
expect (" )" );
390
390
}
391
391
@@ -435,9 +435,9 @@ void ScriptParser::readInput() {
435
435
void ScriptParser::readOutput () {
436
436
// -o <file> takes predecence over OUTPUT(<file>).
437
437
expect (" (" );
438
- StringRef tok = next ();
438
+ StringRef name = readName ();
439
439
if (config->outputFile .empty ())
440
- config->outputFile = unquote (tok) ;
440
+ config->outputFile = name ;
441
441
expect (" )" );
442
442
}
443
443
@@ -1300,7 +1300,7 @@ Expr ScriptParser::getPageSize() {
1300
1300
}
1301
1301
1302
1302
Expr ScriptParser::readConstant () {
1303
- StringRef s = readParenLiteral ();
1303
+ StringRef s = readParenName ();
1304
1304
if (s == " COMMONPAGESIZE" )
1305
1305
return getPageSize ();
1306
1306
if (s == " MAXPAGESIZE" )
@@ -1416,11 +1416,11 @@ std::pair<uint64_t, uint64_t> ScriptParser::readInputSectionFlags() {
1416
1416
return std::make_pair (withFlags, withoutFlags);
1417
1417
}
1418
1418
1419
- StringRef ScriptParser::readParenLiteral () {
1419
+ StringRef ScriptParser::readParenName () {
1420
1420
expect (" (" );
1421
1421
bool orig = inExpr;
1422
1422
inExpr = false ;
1423
- StringRef tok = next ();
1423
+ StringRef tok = readName ();
1424
1424
inExpr = orig;
1425
1425
expect (" )" );
1426
1426
return tok;
@@ -1469,7 +1469,7 @@ Expr ScriptParser::readPrimary() {
1469
1469
};
1470
1470
}
1471
1471
if (tok == " ADDR" ) {
1472
- StringRef name = unquote ( readParenLiteral () );
1472
+ StringRef name = readParenName ( );
1473
1473
OutputSection *osec = &script->getOrCreateOutputSection (name)->osec ;
1474
1474
osec->usedInExpression = true ;
1475
1475
return [=]() -> ExprValue {
@@ -1494,7 +1494,7 @@ Expr ScriptParser::readPrimary() {
1494
1494
};
1495
1495
}
1496
1496
if (tok == " ALIGNOF" ) {
1497
- StringRef name = unquote ( readParenLiteral () );
1497
+ StringRef name = readParenName ( );
1498
1498
OutputSection *osec = &script->getOrCreateOutputSection (name)->osec ;
1499
1499
return [=] {
1500
1500
checkIfExists (*osec, location);
@@ -1536,7 +1536,7 @@ Expr ScriptParser::readPrimary() {
1536
1536
return [=] { return alignToPowerOf2 (script->getDot (), config->maxPageSize ); };
1537
1537
}
1538
1538
if (tok == " DEFINED" ) {
1539
- StringRef name = unquote ( readParenLiteral () );
1539
+ StringRef name = readParenName ( );
1540
1540
// Return 1 if s is defined. If the definition is only found in a linker
1541
1541
// script, it must happen before this DEFINED.
1542
1542
auto order = ctx.scriptSymOrderCounter ++;
@@ -1547,15 +1547,15 @@ Expr ScriptParser::readPrimary() {
1547
1547
};
1548
1548
}
1549
1549
if (tok == " LENGTH" ) {
1550
- StringRef name = readParenLiteral ();
1550
+ StringRef name = readParenName ();
1551
1551
if (script->memoryRegions .count (name) == 0 ) {
1552
1552
setError (" memory region not defined: " + name);
1553
1553
return [] { return 0 ; };
1554
1554
}
1555
1555
return script->memoryRegions [name]->length ;
1556
1556
}
1557
1557
if (tok == " LOADADDR" ) {
1558
- StringRef name = unquote ( readParenLiteral () );
1558
+ StringRef name = readParenName ( );
1559
1559
OutputSection *osec = &script->getOrCreateOutputSection (name)->osec ;
1560
1560
osec->usedInExpression = true ;
1561
1561
return [=] {
@@ -1583,7 +1583,7 @@ Expr ScriptParser::readPrimary() {
1583
1583
return [=] { return std::max (a ().getValue (), b ().getValue ()); };
1584
1584
}
1585
1585
if (tok == " ORIGIN" ) {
1586
- StringRef name = readParenLiteral ();
1586
+ StringRef name = readParenName ();
1587
1587
if (script->memoryRegions .count (name) == 0 ) {
1588
1588
setError (" memory region not defined: " + name);
1589
1589
return [] { return 0 ; };
@@ -1599,7 +1599,7 @@ Expr ScriptParser::readPrimary() {
1599
1599
return [=] { return e (); };
1600
1600
}
1601
1601
if (tok == " SIZEOF" ) {
1602
- StringRef name = unquote ( readParenLiteral () );
1602
+ StringRef name = readParenName ( );
1603
1603
OutputSection *cmd = &script->getOrCreateOutputSection (name)->osec ;
1604
1604
// Linker script does not create an output section if its content is empty.
1605
1605
// We want to allow SIZEOF(.foo) where .foo is a section which happened to
0 commit comments