Skip to content

Commit 5cf0b4d

Browse files
committed
[lld-macho] Stabilize iteration order of config->exportedSymbols.literals
Otherwise lto-explicit-exports.ll might fail due to #96282.
1 parent ecd67e5 commit 5cf0b4d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lld/MachO/Config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "llvm/ADT/DenseMap.h"
1414
#include "llvm/ADT/DenseSet.h"
1515
#include "llvm/ADT/MapVector.h"
16+
#include "llvm/ADT/SetVector.h"
1617
#include "llvm/ADT/SmallVector.h"
1718
#include "llvm/ADT/StringRef.h"
1819
#include "llvm/ADT/StringSet.h"
@@ -92,7 +93,7 @@ class SymbolPatterns {
9293
public:
9394
// GlobPattern can also match literals,
9495
// but we prefer the O(1) lookup of DenseSet.
95-
llvm::DenseSet<llvm::CachedHashStringRef> literals;
96+
llvm::SetVector<llvm::CachedHashStringRef> literals;
9697
std::vector<llvm::GlobPattern> globs;
9798

9899
bool empty() const { return literals.empty() && globs.empty(); }

lld/test/MachO/lto-explicit-exports.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
;; from the final symbol table.
2424

2525
; FULLLTO-SYMS: SYMBOL TABLE:
26-
; FULLLTO-SYMS: g F __TEXT,__text _same_module_caller
2726
; FULLLTO-SYMS: g F __TEXT,__text _refs_foo
27+
; FULLLTO-SYMS: g F __TEXT,__text _same_module_caller
2828
; FULLLTO-SYMS: *UND* dyld_stub_binder
2929
; FULLLTO-SYMS-EMPTY:
3030

@@ -47,8 +47,8 @@
4747
; THINLTO-REFS-FOO: define dso_local void @refs_foo()
4848

4949
; THINLTO-SYMS: l F __TEXT,__text .hidden _foo
50-
; THINLTO-SYMS: g F __TEXT,__text _same_module_caller
5150
; THINLTO-SYMS: g F __TEXT,__text _refs_foo
51+
; THINLTO-SYMS: g F __TEXT,__text _same_module_caller
5252

5353
;--- foo.ll
5454

0 commit comments

Comments
 (0)