Skip to content

Commit fdf4899

Browse files
authored
[lld][macho] Ignore cstrings in bp orderer (#165757)
1 parent 230e8b6 commit fdf4899

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lld/MachO/BPSectionOrderer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ DenseMap<const InputSection *, int> lld::macho::runBalancedPartitioning(
118118
auto *isec = subsec.isec;
119119
if (!isec || isec->data.empty() || !isec->data.data())
120120
continue;
121+
// CString section order is handled by
122+
// {Deduplicated}CStringSection::finalizeContents()
123+
if (isa<CStringInputSection>(isec) || isec->isFinal)
124+
continue;
121125
// ConcatInputSections are entirely live or dead, so the offset is
122126
// irrelevant.
123127
if (isa<ConcatInputSection>(isec) && !isec->isLive(0))

lld/test/MachO/bp-section-orderer.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ r3:
106106
r4:
107107
.quad s2
108108

109+
# cstrings are ignored by runBalancedPartitioning()
110+
.cstring
111+
cstr:
112+
.asciz "this is cstr"
113+
109114
.bss
110115
bss0:
111116
.zero 10

0 commit comments

Comments
 (0)