diff options
author | George Rimar <grimar@accesssoftek.com> | 2016-11-16 18:46:23 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2016-11-16 18:46:23 +0000 |
commit | 17c65af82f84a05f359617ca11b18f0ce32ea7a7 (patch) | |
tree | a14aa654f3eb7ce01e54fe89d8df62aaa2af74f1 | |
parent | 0d162b1c4f274a21ad9d3e92239245db56704c24 (diff) | |
download | llvm-17c65af82f84a05f359617ca11b18f0ce32ea7a7.zip llvm-17c65af82f84a05f359617ca11b18f0ce32ea7a7.tar.gz llvm-17c65af82f84a05f359617ca11b18f0ce32ea7a7.tar.bz2 |
[ELF] - Separate locals list from versions.
This change separates all versioned locals to be a separate list in config,
that was suggested by Rafael and simplifies the logic a bit.
Differential revision: https://reviews.llvm.org/D26754
llvm-svn: 287132
-rw-r--r-- | lld/ELF/Config.h | 2 | ||||
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/SymbolTable.cpp | 19 |
3 files changed, 10 insertions, 13 deletions
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index a46a8a8..b6883a4 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -62,7 +62,6 @@ struct VersionDefinition { llvm::StringRef Name; size_t Id; std::vector<SymbolVersion> Globals; - std::vector<SymbolVersion> Locals; size_t NameOff; // Offset in string table. }; @@ -92,6 +91,7 @@ struct Configuration { std::vector<llvm::StringRef> SearchPaths; std::vector<llvm::StringRef> Undefined; std::vector<SymbolVersion> VersionScriptGlobals; + std::vector<SymbolVersion> VersionScriptLocals; std::vector<uint8_t> BuildIdVector; bool AllowMultipleDefinition; bool AsNeeded = false; diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index eae491d..778165c 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -1844,7 +1844,7 @@ void ScriptParser::readLocal(StringRef VerStr) { if (VerStr.empty()) setError("locals list for anonymous version is not supported"); - readSymbols(Config->VersionDefinitions.back().Locals); + readSymbols(Config->VersionScriptLocals); } void ScriptParser::readVersionExtern(std::vector<SymbolVersion> *V) { diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index 8e0c4f9..a003fcd 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -716,24 +716,21 @@ template <class ELFT> void SymbolTable<ELFT>::scanVersionScript() { // First, we assign versions to exact matching symbols, // i.e. version definitions not containing any glob meta-characters. - for (VersionDefinition &V : Config->VersionDefinitions) { + for (SymbolVersion Sym : Config->VersionScriptLocals) + assignVersion(Sym, VER_NDX_LOCAL, "local"); + for (VersionDefinition &V : Config->VersionDefinitions) for (SymbolVersion Sym : V.Globals) assignVersion(Sym, V.Id, V.Name); - for (SymbolVersion Sym : V.Locals) - assignVersion(Sym, VER_NDX_LOCAL, "local"); - } // Next, we assign versions to fuzzy matching symbols, // i.e. version definitions containing glob meta-characters. // Note that because the last match takes precedence over previous matches, // we iterate over the definitions in the reverse order. - for (size_t I = Config->VersionDefinitions.size() - 1; I != (size_t)-1; --I) { - VersionDefinition &V = Config->VersionDefinitions[I]; - for (SymbolVersion &Ver : V.Locals) - assignWildcardVersion(Ver, VER_NDX_LOCAL); - for (SymbolVersion &Ver : V.Globals) - assignWildcardVersion(Ver, V.Id); - } + for (SymbolVersion &Ver : Config->VersionScriptLocals) + assignWildcardVersion(Ver, VER_NDX_LOCAL); + for (size_t I = Config->VersionDefinitions.size() - 1; I != (size_t)-1; --I) + for (SymbolVersion &Ver : Config->VersionDefinitions[I].Globals) + assignWildcardVersion(Ver, Config->VersionDefinitions[I].Id); } template class elf::SymbolTable<ELF32LE>; |