File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1001,6 +1001,7 @@ SymbolAssignment *ScriptParser::readAssignment(StringRef tok) {
1001
1001
}
1002
1002
1003
1003
SymbolAssignment *ScriptParser::readSymbolAssignment (StringRef name) {
1004
+ name = unquote (name);
1004
1005
StringRef op = next ();
1005
1006
assert (op == " =" || op == " +=" );
1006
1007
Expr e = readExpr ();
@@ -1350,7 +1351,7 @@ Expr ScriptParser::readPrimary() {
1350
1351
return [=] { return alignTo (script->getDot (), e ().getValue ()); };
1351
1352
}
1352
1353
if (tok == " DEFINED" ) {
1353
- StringRef name = readParenLiteral ();
1354
+ StringRef name = unquote ( readParenLiteral () );
1354
1355
return [=] {
1355
1356
Symbol *b = symtab->find (name);
1356
1357
return (b && b->isDefined ()) ? 1 : 0 ;
@@ -1428,6 +1429,7 @@ Expr ScriptParser::readPrimary() {
1428
1429
return [=] { return *val; };
1429
1430
1430
1431
// Tok is a symbol name.
1432
+ tok = unquote (tok);
1431
1433
if (!isValidSymbolName (tok))
1432
1434
setError (" malformed number: " + tok);
1433
1435
script->referencedSymbols .push_back (tok);
Original file line number Diff line number Diff line change 1
1
# REQUIRES: x86
2
- ## Test that . and $ can be used by symbol names in expressions.
2
+ ## Test that ., $ and " can be used by symbol names in expressions.
3
3
4
4
# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o %t.o
5
- # RUN: ld.lld -T %s %t.o -o /dev/null
5
+ # RUN: ld.lld -T %s %t.o -o %t
6
+ # RUN: llvm-readelf -s %t | FileCheck %s
7
+
8
+ # CHECK: Value Size Type Bind Vis Ndx Name
9
+ # CHECK-DAG: 0000000000000000 0 NOTYPE GLOBAL DEFAULT ABS a1
10
+ # CHECK-DAG: 0000000000000000 0 NOTYPE GLOBAL DEFAULT ABS a0
11
+ # CHECK-DAG: 0000000000000003 0 NOTYPE GLOBAL DEFAULT ABS a2
6
12
7
13
a0 = DEFINED(.TOC.) ? .TOC. : 0;
8
- a1 = DEFINED(__global_pointer$) ? __global_pointer$ : 0;
14
+ "a1" = DEFINED(__global_pointer$) ? __global_pointer$ : 0;
15
+ "a2" = DEFINED("a1") ? "a1" + 3 : 0;
Original file line number Diff line number Diff line change 13
13
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN1 %s
14
14
# HIDDEN1: 0000000000000001 l *ABS* 0000000000000000 .hidden newsym
15
15
16
+ # RUN: echo 'SECTIONS { PROVIDE_HIDDEN("newsym" = 1);}' > %t.script
17
+ # RUN: ld.lld -o %t1 --script %t.script %t
18
+ # RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN1 %s
19
+
16
20
.global _start
17
21
_start:
18
22
nop
You can’t perform that action at this time.
0 commit comments