From 1ade2a79976d0aeb3b3bb73a34454d3e633ea01e Mon Sep 17 00:00:00 2001 From: Jacek Caban 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 534cd47be1051..76b7bee0e77e3 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(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(ctx, 8)); } - for (int i = 0, e = syms.size(); i < e; ++i) - syms[i]->setLocation(addresses[base + i]); auto *mh = make(8, 8); moduleHandles.push_back(mh);