Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

cjacek
Copy link
Contributor

@cjacek cjacek commented Jan 28, 2025

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.

… the addresses vector

This change prepares for ARM64X delay-load imports support (llvm#124600). Delaying the setLocation
call is problematic on ARM64X because the order of addresses may not align with the order of symbols.
@llvmbot
Copy link
Member

llvmbot commented Jan 28, 2025

@llvm/pr-subscribers-lld-coff
@llvm/pr-subscribers-platform-windows

@llvm/pr-subscribers-lld

Author: Jacek Caban (cjacek)

Changes

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

Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cjacek cjacek merged commit 1b551e7 into llvm:main Jan 28, 2025
9 of 11 checks passed
@cjacek cjacek deleted the set-location branch January 28, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants