[lld] [LLD][AArch64] Detach Landing Pad creation from Thunk creation (PR #116402)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 15 09:16:26 PST 2024
================
@@ -2293,6 +2293,31 @@ bool ThunkCreator::normalizeExistingThunk(Relocation &rel, uint64_t src) {
return false;
}
+// When indirect branches are restricted, such as AArch64 BTI Thunks may need
+// to target a linker generated landing pad instead of the target. This needs
+// to be done once per pass as the need for a BTI thunk is dependent whether
+// a thunk is short or long. We iterate over all the thunks to make sure we
+// catch thunks that have been created but are no longer live. Non-live thunks
+// are not reachable via normalizeExistingThunk() but are still written.
+bool ThunkCreator::addSyntheticLandingPads() {
+ bool addressesChanged = false;
+ for (Thunk *t : allThunks) {
+ if (t->needsSyntheticLandingPad()) {
----------------
MaskRay wrote:
this can early return
https://github.com/llvm/llvm-project/pull/116402
More information about the llvm-commits
mailing list