summaryrefslogtreecommitdiffstats
path: root/lld/ELF/SymbolListFile.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2016-07-13 07:46:00 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2016-07-13 07:46:00 +0000
commite05103ea11f797a6f210fe11dfaf46289cceba24 (patch)
treebf7fb241fce04f6631e5c84327aa470d5add434e /lld/ELF/SymbolListFile.cpp
parent14ef11c110e574ecc575fff3e43a95b88452a8fb (diff)
downloadbcm5719-llvm-e05103ea11f797a6f210fe11dfaf46289cceba24.tar.gz
bcm5719-llvm-e05103ea11f797a6f210fe11dfaf46289cceba24.zip
[ELF] - Implement extern "c++" version script tag
Patch implements 'extern' version script tag. Currently only values in quotes(") are supported. Matching of externs is performed in the same pass as exact match of globals. Differential revision: http://reviews.llvm.org/D21930 llvm-svn: 275257
Diffstat (limited to 'lld/ELF/SymbolListFile.cpp')
-rw-r--r--lld/ELF/SymbolListFile.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/lld/ELF/SymbolListFile.cpp b/lld/ELF/SymbolListFile.cpp
index 68867cf8ae6..1525540e259 100644
--- a/lld/ELF/SymbolListFile.cpp
+++ b/lld/ELF/SymbolListFile.cpp
@@ -77,6 +77,7 @@ public:
void run();
private:
+ void parseExtern(std::vector<SymbolVersion> *Globals);
void parseVersion(StringRef Version);
void parseLocal();
void parseVersionSymbols(StringRef Version);
@@ -120,21 +121,38 @@ void VersionScriptParser::parseLocal() {
Config->VersionScriptGlobalByDefault = false;
}
+void VersionScriptParser::parseExtern(std::vector<SymbolVersion> *Globals) {
+ expect("extern");
+ expect("C++");
+ expect("{");
+
+ for (;;) {
+ if (peek() == "}" || Error)
+ break;
+ Globals->push_back({next(), true});
+ expect(";");
+ }
+
+ expect("}");
+ expect(";");
+}
+
void VersionScriptParser::parseVersionSymbols(StringRef Version) {
- std::vector<StringRef> *Globals;
+ std::vector<SymbolVersion> *Globals;
if (Version.empty())
Globals = &Config->VersionScriptGlobals;
else
Globals = &Config->SymbolVersions.back().Globals;
for (;;) {
+ if (peek() == "extern")
+ parseExtern(Globals);
+
StringRef Cur = peek();
- if (Cur == "extern")
- setError("extern keyword is not supported");
if (Cur == "}" || Cur == "local:" || Error)
return;
next();
- Globals->push_back(Cur);
+ Globals->push_back({Cur, false});
expect(";");
}
}
OpenPOWER on IntegriCloud