Skip to content

[lld][BP] Fix duplicate section size measurment #145384

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

Merged
merged 1 commit into from
Jun 24, 2025

Conversation

ellishg
Copy link
Contributor

@ellishg ellishg commented Jun 23, 2025

Fix size measurements for duplicate sections that was added in #145106.

@llvmbot llvmbot added the lld label Jun 23, 2025
@ellishg ellishg requested a review from MaskRay June 23, 2025 18:46
@llvmbot
Copy link
Member

llvmbot commented Jun 23, 2025

@llvm/pr-subscribers-lld

Author: Ellis Hoag (ellishg)

Changes

Fix size measurements for duplicate sections that was added in #145106.


Full diff: https://github.com/llvm/llvm-project/pull/145384.diff

1 Files Affected:

  • (modified) lld/include/lld/Common/BPSectionOrdererBase.inc (+2-2)
diff --git a/lld/include/lld/Common/BPSectionOrdererBase.inc b/lld/include/lld/Common/BPSectionOrdererBase.inc
index fbeca187aa76f..00c9dc7159ddd 100644
--- a/lld/include/lld/Common/BPSectionOrdererBase.inc
+++ b/lld/include/lld/Common/BPSectionOrdererBase.inc
@@ -319,7 +319,7 @@ auto BPOrderer<D>::computeOrder(
     for (auto dupSecIdx : It->getSecond()) {
       const auto *dupIsec = sections[dupSecIdx];
       if (orderedSections.insert(dupIsec)) {
-        duplicateCodeSize += D::getSize(*isec);
+        duplicateCodeSize += D::getSize(*dupIsec);
         ++numDuplicateCodeSections;
       }
     }
@@ -337,7 +337,7 @@ auto BPOrderer<D>::computeOrder(
     for (auto dupSecIdx : It->getSecond()) {
       const auto *dupIsec = sections[dupSecIdx];
       if (orderedSections.insert(dupIsec)) {
-        duplicateDataSize += D::getSize(*isec);
+        duplicateDataSize += D::getSize(*dupIsec);
         ++numDuplicateDataSections;
       }
     }

@ellishg ellishg requested a review from SharonXSharon June 23, 2025 20:35
@ellishg ellishg merged commit b77c713 into llvm:main Jun 24, 2025
9 checks passed
DrSergei pushed a commit to DrSergei/llvm-project that referenced this pull request Jun 24, 2025
anthonyhatran pushed a commit to anthonyhatran/llvm-project that referenced this pull request Jun 26, 2025
rlavaee pushed a commit to rlavaee/llvm-project that referenced this pull request Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants