[lld] r287132 - [ELF] - Separate locals list from versions.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 16 10:46:23 PST 2016
Author: grimar
Date: Wed Nov 16 12:46:23 2016
New Revision: 287132
URL: http://llvm.org/viewvc/llvm-project?rev=287132&view=rev
Log:
[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
Modified:
lld/trunk/ELF/Config.h
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/SymbolTable.cpp
Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=287132&r1=287131&r2=287132&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Wed Nov 16 12:46:23 2016
@@ -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;
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=287132&r1=287131&r2=287132&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Nov 16 12:46:23 2016
@@ -1844,7 +1844,7 @@ void ScriptParser::readLocal(StringRef V
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) {
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=287132&r1=287131&r2=287132&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Nov 16 12:46:23 2016
@@ -716,24 +716,21 @@ template <class ELFT> void SymbolTable<E
// 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>;
More information about the llvm-commits
mailing list