[PATCH] D105054: [lld/mac] Make lld/test/MachO/tlv.s, tlv-dylib.s pass with expensive tests
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 28 13:59:11 PDT 2021
thakis updated this revision to Diff 355030.
thakis retitled this revision from "[lld/mac] Make lld/test/MachO/tlv.s pass with expensive tests" to "[lld/mac] Make lld/test/MachO/tlv.s,tlv-dylib.s pass with expensive tests".
thakis edited the summary of this revision.
thakis added a comment.
comments, tlv-dylib.s
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105054/new/
https://reviews.llvm.org/D105054
Files:
lld/MachO/OutputSegment.cpp
lld/MachO/Writer.cpp
lld/test/MachO/tlv-dylib.s
Index: lld/test/MachO/tlv-dylib.s
===================================================================
--- lld/test/MachO/tlv-dylib.s
+++ lld/test/MachO/tlv-dylib.s
@@ -74,21 +74,21 @@
# FLAGS-NEXT: reloff 0
# FLAGS-NEXT: nreloc 0
# FLAGS-NEXT: type S_THREAD_LOCAL_ZEROFILL
-# FLAGS: sectname __bss
+# FLAGS: sectname __common
# FLAGS-NEXT: segname __DATA
# FLAGS-NEXT: addr
-# FLAGS-NEXT: size 0x0000000000002000
+# FLAGS-NEXT: size 0x0000000000004000
# FLAGS-NEXT: offset 0
-# FLAGS-NEXT: align 2^0 (1)
+# FLAGS-NEXT: align 2^14 (16384)
# FLAGS-NEXT: reloff 0
# FLAGS-NEXT: nreloc 0
# FLAGS-NEXT: type S_ZEROFILL
-# FLAGS: sectname __common
+# FLAGS: sectname __bss
# FLAGS-NEXT: segname __DATA
# FLAGS-NEXT: addr
-# FLAGS-NEXT: size 0x0000000000004000
+# FLAGS-NEXT: size 0x0000000000002000
# FLAGS-NEXT: offset 0
-# FLAGS-NEXT: align 2^14 (16384)
+# FLAGS-NEXT: align 2^0 (1)
# FLAGS-NEXT: reloff 0
# FLAGS-NEXT: nreloc 0
# FLAGS-NEXT: type S_ZEROFILL
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -78,7 +78,10 @@
LCUuid *uuidCommand = nullptr;
OutputSegment *linkEditSegment = nullptr;
- DenseMap<NamePair, ConcatOutputSection *> concatOutputSections;
+
+ // Output sections are added to output segments in iteration order
+ // of ConcatOutputSection, so must have deterministic iteration order.
+ MapVector<NamePair, ConcatOutputSection *> concatOutputSections;
};
// LC_DYLD_INFO_ONLY stores the offsets of symbol import/export information.
Index: lld/MachO/OutputSegment.cpp
===================================================================
--- lld/MachO/OutputSegment.cpp
+++ lld/MachO/OutputSegment.cpp
@@ -140,10 +140,15 @@
}
void OutputSegment::sortOutputSections() {
- llvm::sort(sections, compareByOrder<OutputSection *>(sectionOrder));
+ // Must be stable_sort() to keep special sections such as
+ // S_THREAD_LOCAL_REGULAR in input order.
+ llvm::stable_sort(sections, compareByOrder<OutputSection *>(sectionOrder));
}
void macho::sortOutputSegments() {
+ // sort() instead of stable_sort() is fine because segmentOrder() is
+ // name-based and getOrCreateOutputSegment() makes there's only a single
+ // segment for every name.
llvm::sort(outputSegments, compareByOrder<OutputSegment *>(segmentOrder));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105054.355030.patch
Type: text/x-patch
Size: 2491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210628/bf6f0e55/attachment.bin>
More information about the llvm-commits
mailing list