[lld] [LLD][ELF] Generically report "address assignment did not converge" (PR #128774)

Daniel Thornburgh via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 13:13:16 PST 2025


https://github.com/mysterymath created https://github.com/llvm/llvm-project/pull/128774

There are considerable number of changes done in the address assignment fixed point loop, and errors in any of them could cause address assignment not to converge. However, this is reported to the user as either "thunk creation not converged" or "relaxation not converged".

We saw a confused bug about this in the wild when spilling failed to converge. (I'm working on a fix for that.)

We may eventually want a complete reason system when reporting address assignment taking too many passes, but in the interim it seems prudent to generalize the error message to "address assignment did not converge".

>From fae4f9f3b748e0090c19da69e4cc02469969b5fd Mon Sep 17 00:00:00 2001
From: Daniel Thornburgh <dthorn at google.com>
Date: Tue, 25 Feb 2025 13:07:04 -0800
Subject: [PATCH] [LLD][ELF] Generically report "address assignment did not
 converge"

There are considerable number of changes done in the address assignment
fixed point loop, and errors in any of them could cause address
assignment not to converge. However, this is reported to the user as
either "thunk creation not converged" or "relaxation not converged".

We saw a confused bug about this in the wild when spilling failed to
converge. (I'm working on a fix for that.)

In lieu of a complete reason system for address assignment reaching 30
passes, in the interim it seems prudent to generalize the error message
to "address assignment did not converge".
---
 lld/ELF/Writer.cpp                                        | 3 +--
 lld/test/ELF/linkerscript/symbol-assign-many-passes2.test | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index a2c49343e5c8d..0d61e8d8d91a4 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1531,8 +1531,7 @@ template <class ELFT> void Writer<ELFT>::finalizeAddressDependentContent() {
     // With Thunk Size much smaller than branch range we expect to
     // converge quickly; if we get to 30 something has gone wrong.
     if (changed && pass >= 30) {
-      Err(ctx) << (ctx.target->needsThunks ? "thunk creation not converged"
-                                           : "relaxation not converged");
+      Err(ctx) << "address assignment did not converge";
       break;
     }
 
diff --git a/lld/test/ELF/linkerscript/symbol-assign-many-passes2.test b/lld/test/ELF/linkerscript/symbol-assign-many-passes2.test
index 18dc5019ee1eb..b41467d6168c6 100644
--- a/lld/test/ELF/linkerscript/symbol-assign-many-passes2.test
+++ b/lld/test/ELF/linkerscript/symbol-assign-many-passes2.test
@@ -6,7 +6,7 @@
 ## arm-thunk-many-passes.s is worst case case of thunk generation that takes 9
 ## passes to converge. It takes a few more passes to make symbol assignment
 ## converge. Test that
-## 1. we don't error that "thunk creation not converged".
+## 1. we don't error that "address assignment not converged".
 ## 2. we check convergence of symbols defined in an output section descriptor.
 
 # CHECK: 01011050 T a



More information about the llvm-commits mailing list