[lld] 5cf0b4d - [lld-macho] Stabilize iteration order of config->exportedSymbols.literals

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 16:48:04 PDT 2024


Author: Fangrui Song
Date: 2024-06-28T16:47:59-07:00
New Revision: 5cf0b4d94ee0d202211cd79c9fb204cb97bc6d67

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

LOG: [lld-macho] Stabilize iteration order of config->exportedSymbols.literals

Otherwise lto-explicit-exports.ll might fail due to #96282.

Added: 
    

Modified: 
    lld/MachO/Config.h
    lld/test/MachO/lto-explicit-exports.ll

Removed: 
    


################################################################################
diff  --git a/lld/MachO/Config.h b/lld/MachO/Config.h
index 96253e15f7eea..56351b66189d8 100644
--- a/lld/MachO/Config.h
+++ b/lld/MachO/Config.h
@@ -13,6 +13,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
@@ -92,7 +93,7 @@ class SymbolPatterns {
 public:
   // GlobPattern can also match literals,
   // but we prefer the O(1) lookup of DenseSet.
-  llvm::DenseSet<llvm::CachedHashStringRef> literals;
+  llvm::SetVector<llvm::CachedHashStringRef> literals;
   std::vector<llvm::GlobPattern> globs;
 
   bool empty() const { return literals.empty() && globs.empty(); }

diff  --git a/lld/test/MachO/lto-explicit-exports.ll b/lld/test/MachO/lto-explicit-exports.ll
index 7ea0061481581..ce250c1e87f1f 100644
--- a/lld/test/MachO/lto-explicit-exports.ll
+++ b/lld/test/MachO/lto-explicit-exports.ll
@@ -23,8 +23,8 @@
 ;; from the final symbol table.
 
 ; FULLLTO-SYMS:       SYMBOL TABLE:
-; FULLLTO-SYMS:       g     F __TEXT,__text _same_module_caller
 ; FULLLTO-SYMS:       g     F __TEXT,__text _refs_foo
+; FULLLTO-SYMS:       g     F __TEXT,__text _same_module_caller
 ; FULLLTO-SYMS:       *UND* dyld_stub_binder
 ; FULLLTO-SYMS-EMPTY:
 
@@ -47,8 +47,8 @@
 ; THINLTO-REFS-FOO: define dso_local void @refs_foo()
 
 ; THINLTO-SYMS: l     F __TEXT,__text .hidden _foo
-; THINLTO-SYMS: g     F __TEXT,__text _same_module_caller
 ; THINLTO-SYMS: g     F __TEXT,__text _refs_foo
+; THINLTO-SYMS: g     F __TEXT,__text _same_module_caller
 
 ;--- foo.ll
 


        


More information about the llvm-commits mailing list