diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-06-17 13:38:09 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-06-17 13:38:09 +0000 |
commit | f70fb04e4fb6def2ff1aa9ddc764f43636aa396c (patch) | |
tree | 780e4d5c04a2d840366bcf9e76da6167d37d800f /lld/ELF/SymbolListFile.cpp | |
parent | 1d67ac56390adafd0d98cb9d7890e52a2d091158 (diff) | |
download | bcm5719-llvm-f70fb04e4fb6def2ff1aa9ddc764f43636aa396c.tar.gz bcm5719-llvm-f70fb04e4fb6def2ff1aa9ddc764f43636aa396c.zip |
Make local: optional.
Doing that in an anonymous version is a bit silly, but this opens the
way for supporting it in general.
Since we don't support actual versions, for now we just disable the
version script if we detect that it is missing a local.
llvm-svn: 273000
Diffstat (limited to 'lld/ELF/SymbolListFile.cpp')
-rw-r--r-- | lld/ELF/SymbolListFile.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/lld/ELF/SymbolListFile.cpp b/lld/ELF/SymbolListFile.cpp index b8cfdc88f33..3d1377be438 100644 --- a/lld/ELF/SymbolListFile.cpp +++ b/lld/ELF/SymbolListFile.cpp @@ -78,24 +78,41 @@ public: private: void parseVersion(); + void parseLocal(); + void parseVersionSymbols(); }; void VersionScriptParser::parseVersion() { expect("{"); if (peek() == "global:") { next(); - while (!Error) { - Config->VersionScriptGlobals.push_back(next()); - expect(";"); - if (peek() == "local:") - break; - } + parseVersionSymbols(); } + if (peek() == "local:") + parseLocal(); + else + parseVersionSymbols(); + + expect("}"); + expect(";"); +} + +void VersionScriptParser::parseLocal() { expect("local:"); expect("*"); expect(";"); - expect("}"); - expect(";"); + Config->VersionScriptGlobalByDefault = false; +} + +void VersionScriptParser::parseVersionSymbols() { + for (;;) { + StringRef Cur = peek(); + if (Cur == "}" || Cur == "local:") + return; + next(); + Config->VersionScriptGlobals.push_back(Cur); + expect(";"); + } } void VersionScriptParser::run() { |