[lld] [ELF] Detect convergence of output section addresses (PR #93888)

Daniel Thornburgh via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 16:45:41 PDT 2024


================
@@ -1479,16 +1479,22 @@ template <class ELFT> void Writer<ELFT>::finalizeAddressDependentContent() {
         changed |= part.memtagGlobalDescriptors->updateAllocSize();
     }
 
-    const Defined *changedSym = script->assignAddresses();
+    std::pair<const OutputSection *, const Defined *> changes =
+        script->assignAddresses();
     if (!changed) {
       // Some symbols may be dependent on section addresses. When we break the
       // loop, the symbol values are finalized because a previous
       // assignAddresses() finalized section addresses.
-      if (!changedSym)
+      if (!changes.first && !changes.second)
         break;
       if (++assignPasses == 5) {
-        errorOrWarn("assignment to symbol " + toString(*changedSym) +
-                    " does not converge");
+        if (changes.first)
+          errorOrWarn("address (0x" + Twine::utohexstr(changes.first->addr) +
+                      ") of section '" + changes.first->name +
+                      "' does not converge");
+        if (changes.second)
+          errorOrWarn("assignment to symbol " + toString(*changes.second) +
----------------
mysterymath wrote:

Would it be worth printing the last value of non-converging symbols as well? The difference between section and symbol error messages is surprising; I'd prima facie expect both or neither to include the address, sans an essential difference between them.

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


More information about the llvm-commits mailing list