[lld] fdf4899 - [lld][macho] Ignore cstrings in bp orderer (#165757)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 31 09:02:10 PDT 2025
Author: Ellis Hoag
Date: 2025-10-31T09:02:05-07:00
New Revision: fdf4899523f2d4a9e9516ec69d4de59b0935df46
URL: https://github.com/llvm/llvm-project/commit/fdf4899523f2d4a9e9516ec69d4de59b0935df46
DIFF: https://github.com/llvm/llvm-project/commit/fdf4899523f2d4a9e9516ec69d4de59b0935df46.diff
LOG: [lld][macho] Ignore cstrings in bp orderer (#165757)
Added:
Modified:
lld/MachO/BPSectionOrderer.cpp
lld/test/MachO/bp-section-orderer.s
Removed:
################################################################################
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index d50abc22fc6c1..328c33e6cfb65 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -118,6 +118,10 @@ DenseMap<const InputSection *, int> lld::macho::runBalancedPartitioning(
auto *isec = subsec.isec;
if (!isec || isec->data.empty() || !isec->data.data())
continue;
+ // CString section order is handled by
+ // {Deduplicated}CStringSection::finalizeContents()
+ if (isa<CStringInputSection>(isec) || isec->isFinal)
+ continue;
// ConcatInputSections are entirely live or dead, so the offset is
// irrelevant.
if (isa<ConcatInputSection>(isec) && !isec->isLive(0))
diff --git a/lld/test/MachO/bp-section-orderer.s b/lld/test/MachO/bp-section-orderer.s
index 90924e5797b64..d7de90d6cd7b3 100644
--- a/lld/test/MachO/bp-section-orderer.s
+++ b/lld/test/MachO/bp-section-orderer.s
@@ -106,6 +106,11 @@ r3:
r4:
.quad s2
+# cstrings are ignored by runBalancedPartitioning()
+.cstring
+cstr:
+ .asciz "this is cstr"
+
.bss
bss0:
.zero 10
More information about the llvm-commits
mailing list