[PATCH] D26754: [ELF] - Separate locals list from versions.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 10:56:11 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL287132: [ELF] - Separate locals list from versions. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D26754?vs=78215&id=78223#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26754

Files:
  lld/trunk/ELF/Config.h
  lld/trunk/ELF/LinkerScript.cpp
  lld/trunk/ELF/SymbolTable.cpp


Index: lld/trunk/ELF/Config.h
===================================================================
--- lld/trunk/ELF/Config.h
+++ lld/trunk/ELF/Config.h
@@ -62,7 +62,6 @@
   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 @@
   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;
Index: lld/trunk/ELF/SymbolTable.cpp
===================================================================
--- lld/trunk/ELF/SymbolTable.cpp
+++ lld/trunk/ELF/SymbolTable.cpp
@@ -716,24 +716,21 @@
 
   // 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>;
Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -1844,7 +1844,7 @@
   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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26754.78223.patch
Type: text/x-patch
Size: 2804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161116/c76f004b/attachment.bin>


More information about the llvm-commits mailing list