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

Jacek Caban via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 03:49:30 PST 2025


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

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.

>From 1ade2a79976d0aeb3b3bb73a34454d3e633ea01e Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek at codeweavers.com>
Date: Tue, 28 Jan 2025 12:37:13 +0100
Subject: [PATCH] [LLD][COFF] Call setLocation on DelayAddressChunk when
 inserting into the addresses vector

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.
---
 lld/COFF/DLL.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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);
 



More information about the llvm-commits mailing list