[lld] [LLD][COFF] Call setLocation on DelayAddressChunk when inserting into the addresses vector (NFC) (PR #124736)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 03:50:01 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld

Author: Jacek Caban (cjacek)

<details>
<summary>Changes</summary>

This change prepares for ARM64X delay-load imports support (#<!-- -->124600). Delaying the `setLocation` call is problematic on ARM64X because the order of addresses may not align with the order of symbols.

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


1 Files Affected:

- (modified) lld/COFF/DLL.cpp (+1-2) 


``````````diff
diff --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp
index 534cd47be1051f..76b7bee0e77e32 100644
--- a/lld/COFF/DLL.cpp
+++ b/lld/COFF/DLL.cpp
@@ -927,6 +927,7 @@ void DelayLoadContents::create() {
       Chunk *t = newThunkChunk(s, tm);
       auto *a = make<DelayAddressChunk>(ctx, t);
       addresses.push_back(a);
+      s->setLocation(a);
       thunks.push_back(t);
       StringRef extName = s->getExternalName();
       if (extName.empty()) {
@@ -967,8 +968,6 @@ void DelayLoadContents::create() {
       auxIatCopy.push_back(make<NullChunk>(ctx, 8));
     }
 
-    for (int i = 0, e = syms.size(); i < e; ++i)
-      syms[i]->setLocation(addresses[base + i]);
     auto *mh = make<NullChunk>(8, 8);
     moduleHandles.push_back(mh);
 

``````````

</details>


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


More information about the llvm-commits mailing list