forked from OSchip/llvm-project
Handle the case where 'local' is the name of a global in a version script:
{ global : local; local: *; }; llvm-svn: 294343
This commit is contained in:
parent
3877f397cd
commit
f3965c0246
|
@ -1995,7 +1995,7 @@ std::vector<SymbolVersion> ScriptParser::readSymbols() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (peek() == "}" || peek() == "local" || Error)
|
if (peek() == "}" || (peek() == "local" && peek(1) == ":") || Error)
|
||||||
break;
|
break;
|
||||||
StringRef Tok = next();
|
StringRef Tok = next();
|
||||||
Ret.push_back({unquote(Tok), false, hasWildcard(Tok)});
|
Ret.push_back({unquote(Tok), false, hasWildcard(Tok)});
|
||||||
|
|
|
@ -156,11 +156,14 @@ StringRef ScriptParserBase::next() {
|
||||||
return Tokens[Pos++];
|
return Tokens[Pos++];
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef ScriptParserBase::peek() {
|
StringRef ScriptParserBase::peek(unsigned N) {
|
||||||
StringRef Tok = next();
|
StringRef Tok;
|
||||||
if (Error)
|
for (unsigned I = 0; I <= N; ++I) {
|
||||||
return "";
|
Tok = next();
|
||||||
--Pos;
|
if (Error)
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
Pos = Pos - N - 1;
|
||||||
return Tok;
|
return Tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
static StringRef skipSpace(StringRef S);
|
static StringRef skipSpace(StringRef S);
|
||||||
bool atEOF();
|
bool atEOF();
|
||||||
StringRef next();
|
StringRef next();
|
||||||
StringRef peek();
|
StringRef peek(unsigned N = 0);
|
||||||
void skip();
|
void skip();
|
||||||
bool consume(StringRef Tok);
|
bool consume(StringRef Tok);
|
||||||
void expect(StringRef Expect);
|
void expect(StringRef Expect);
|
||||||
|
|
|
@ -14,6 +14,9 @@ bar1:
|
||||||
.globl zed1
|
.globl zed1
|
||||||
zed1:
|
zed1:
|
||||||
|
|
||||||
|
.globl local
|
||||||
|
local:
|
||||||
|
|
||||||
# CHECK: DynamicSymbols [
|
# CHECK: DynamicSymbols [
|
||||||
# CHECK-NEXT: Symbol {
|
# CHECK-NEXT: Symbol {
|
||||||
# CHECK-NEXT: Name:
|
# CHECK-NEXT: Name:
|
||||||
|
@ -43,3 +46,27 @@ zed1:
|
||||||
# CHECK-NEXT: Section: .text
|
# CHECK-NEXT: Section: .text
|
||||||
# CHECK-NEXT: }
|
# CHECK-NEXT: }
|
||||||
# CHECK-NEXT: ]
|
# CHECK-NEXT: ]
|
||||||
|
|
||||||
|
# RUN: echo "{ global : local; local: *; };" > %t1.script
|
||||||
|
# RUN: ld.lld -shared --version-script %t1.script %t.o -o %t1.so
|
||||||
|
|
||||||
|
# LOCAL: DynamicSymbols [
|
||||||
|
# LOCAL-NEXT: Symbol {
|
||||||
|
# LOCAL-NEXT: Name:
|
||||||
|
# LOCAL-NEXT: Value: 0x0
|
||||||
|
# LOCAL-NEXT: Size: 0
|
||||||
|
# LOCAL-NEXT: Binding: Local
|
||||||
|
# LOCAL-NEXT: Type: None
|
||||||
|
# LOCAL-NEXT: Other: 0
|
||||||
|
# LOCAL-NEXT: Section: Undefined
|
||||||
|
# LOCAL-NEXT: }
|
||||||
|
# LOCAL-NEXT: Symbol {
|
||||||
|
# LOCAL-NEXT: Name: local
|
||||||
|
# LOCAL-NEXT: Value: 0x1000
|
||||||
|
# LOCAL-NEXT: Size: 0
|
||||||
|
# LOCAL-NEXT: Binding: Global
|
||||||
|
# LOCAL-NEXT: Type: None
|
||||||
|
# LOCAL-NEXT: Other: 0
|
||||||
|
# LOCAL-NEXT: Section: .text
|
||||||
|
# LOCAL-NEXT: }
|
||||||
|
# LOCAL-NEXT: ]
|
||||||
|
|
Loading…
Reference in New Issue