[lld] dc6f8ef - [ELF] Reword symMap/symVector comment. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 10:50:48 PST 2023


Author: Fangrui Song
Date: 2023-02-08T10:50:44-08:00
New Revision: dc6f8ef57c8202fab4fcd6de875fbec17865f247

URL: https://github.com/llvm/llvm-project/commit/dc6f8ef57c8202fab4fcd6de875fbec17865f247
DIFF: https://github.com/llvm/llvm-project/commit/dc6f8ef57c8202fab4fcd6de875fbec17865f247.diff

LOG: [ELF] Reword symMap/symVector comment. NFC

Having symVector makes iteration efficient and is actually more
efficient than using llvm::DenseMap<llvm::CachedHashStringRef, Symbol
*>, so the FIXME comment can be removed. Using an alternative
implementation ankerl/unordered_dense.h decreases link time for chromium
by 0.x% but I am unsure it justifies the extra header file.

Added: 
    

Modified: 
    lld/ELF/SymbolTable.h

Removed: 
    


################################################################################
diff  --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h
index 5255e8bfad66d..9c93ae1876af0 100644
--- a/lld/ELF/SymbolTable.h
+++ b/lld/ELF/SymbolTable.h
@@ -71,13 +71,9 @@ class SymbolTable {
   void assignWildcardVersion(SymbolVersion ver, uint16_t versionId,
                              bool includeNonDefault);
 
-  // The order the global symbols are in is not defined. We can use an arbitrary
-  // order, but it has to be reproducible. That is true even when cross linking.
-  // The default hashing of StringRef produces 
diff erent results on 32 and 64
-  // bit systems so we use a map to a vector. That is arbitrary, deterministic
-  // but a bit inefficient.
-  // FIXME: Experiment with passing in a custom hashing or sorting the symbols
-  // once symbol resolution is finished.
+  // Global symbols and a map from symbol name to the index. The order is not
+  // defined. We can use an arbitrary order, but it has to be deterministic even
+  // when cross linking.
   llvm::DenseMap<llvm::CachedHashStringRef, int> symMap;
   SmallVector<Symbol *, 0> symVector;
 


        


More information about the llvm-commits mailing list