-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lld][InstrProf] Skip BP ordering input sections with null data #137906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lld @llvm/pr-subscribers-lld-macho Author: Ellis Hoag (ellishg) ChangesIn MachO, This code was in the original implementation, but was removed in https://github.com/llvm/llvm-project/pull/124482/files#diff-b2aac8833d29d297ae5ada1b36eb4e88f53691fd91df954c24e0c264f3131d4aL27 Full diff: https://github.com/llvm/llvm-project/pull/137906.diff 2 Files Affected:
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 1295d21cad8a1..ca273f7f798dc 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -115,7 +115,7 @@ DenseMap<const InputSection *, int> lld::macho::runBalancedPartitioning(
for (auto *sec : file->sections) {
for (auto &subsec : sec->subsections) {
auto *isec = subsec.isec;
- if (!isec || isec->data.empty())
+ if (!isec || isec->data.empty() || !isec->data.data())
continue;
// ConcatInputSections are entirely live or dead, so the offset is
// irrelevant.
diff --git a/lld/test/MachO/bp-section-orderer.s b/lld/test/MachO/bp-section-orderer.s
index f3293b54dbcf1..93d0b85731de7 100644
--- a/lld/test/MachO/bp-section-orderer.s
+++ b/lld/test/MachO/bp-section-orderer.s
@@ -106,6 +106,10 @@ r3:
r4:
.quad s2
+.bss
+bss0:
+ .zero 10
+
.subsections_via_symbols
#--- a.proftext
|
…#137906) In MachO, `.bss` `isec`s have a length, but point to null. This causes Balanced Partitioning to crash on these inputs. This code was in the original implementation, but was removed in https://github.com/llvm/llvm-project/pull/124482/files#diff-b2aac8833d29d297ae5ada1b36eb4e88f53691fd91df954c24e0c264f3131d4aL27
…#137906) In MachO, `.bss` `isec`s have a length, but point to null. This causes Balanced Partitioning to crash on these inputs. This code was in the original implementation, but was removed in https://github.com/llvm/llvm-project/pull/124482/files#diff-b2aac8833d29d297ae5ada1b36eb4e88f53691fd91df954c24e0c264f3131d4aL27
…#137906) In MachO, `.bss` `isec`s have a length, but point to null. This causes Balanced Partitioning to crash on these inputs. This code was in the original implementation, but was removed in https://github.com/llvm/llvm-project/pull/124482/files#diff-b2aac8833d29d297ae5ada1b36eb4e88f53691fd91df954c24e0c264f3131d4aL27
…#137906) In MachO, `.bss` `isec`s have a length, but point to null. This causes Balanced Partitioning to crash on these inputs. This code was in the original implementation, but was removed in https://github.com/llvm/llvm-project/pull/124482/files#diff-b2aac8833d29d297ae5ada1b36eb4e88f53691fd91df954c24e0c264f3131d4aL27
…#137906) In MachO, `.bss` `isec`s have a length, but point to null. This causes Balanced Partitioning to crash on these inputs. This code was in the original implementation, but was removed in https://github.com/llvm/llvm-project/pull/124482/files#diff-b2aac8833d29d297ae5ada1b36eb4e88f53691fd91df954c24e0c264f3131d4aL27
In MachO,
.bss
isec
s have a length, but point to null. This causes Balanced Partitioning to crash on these inputs.This code was in the original implementation, but was removed in https://github.com/llvm/llvm-project/pull/124482/files#diff-b2aac8833d29d297ae5ada1b36eb4e88f53691fd91df954c24e0c264f3131d4aL27