[lld] [lld][ELF] Sort thunks by their destination to allow quicker convergence (PR #209962)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 21:51:51 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- lld/ELF/Relocations.cpp lld/ELF/SyntheticSections.cpp lld/ELF/SyntheticSections.h lld/ELF/Thunks.cpp lld/ELF/Thunks.h --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 99213fc63..1dc96a483 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1968,12 +1968,12 @@ bool ThunkCreator::createThunks(uint32_t pass,
           }
 
         for (auto &p : isd->thunkSections) {
-          // Ordering thunks by their destination allows for quicker convergence.
-          // Bulk of thunks are created in pass 0. So sorting them then has
-          // most impact and should be sufficient in most cases.
+          // Ordering thunks by their destination allows for quicker
+          // convergence. Bulk of thunks are created in pass 0. So sorting them
+          // then has most impact and should be sufficient in most cases.
           addressesChanged |= p.first->assignOffsets(pass == 0);
         }
-        });
+      });
 
   for (auto &p : thunkedSections)
     addressesChanged |= p.second->assignOffsets();
diff --git a/lld/ELF/Thunks.cpp b/lld/ELF/Thunks.cpp
index 5b1d01301..c8f01b0e0 100644
--- a/lld/ELF/Thunks.cpp
+++ b/lld/ELF/Thunks.cpp
@@ -630,7 +630,8 @@ void Thunk::setOffset(uint64_t newOffset) {
 }
 
 uint64_t Thunk::getDestVA() const {
-  return destination.isInPlt(ctx) ? destination.getPltVA(ctx) : destination.getVA(ctx, addend);
+  return destination.isInPlt(ctx) ? destination.getPltVA(ctx)
+                                  : destination.getVA(ctx, addend);
 }
 
 // AArch64 Thunk base class.

``````````

</details>


https://github.com/llvm/llvm-project/pull/209962


More information about the llvm-commits mailing list