[lld] 80084e9 - [LLD][COFF] Pull _load_config_used symbol from both symbol tables on ARM64X (#122837)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 08:43:37 PST 2025
Author: Jacek Caban
Date: 2025-01-15T17:43:33+01:00
New Revision: 80084e9cb6d215db88ef890ea5cb8a88fb5aa0b5
URL: https://github.com/llvm/llvm-project/commit/80084e9cb6d215db88ef890ea5cb8a88fb5aa0b5
DIFF: https://github.com/llvm/llvm-project/commit/80084e9cb6d215db88ef890ea5cb8a88fb5aa0b5.diff
LOG: [LLD][COFF] Pull _load_config_used symbol from both symbol tables on ARM64X (#122837)
Added:
Modified:
lld/COFF/Driver.cpp
lld/test/COFF/arm64x-loadconfig.s
Removed:
################################################################################
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 6af6b4f7307664..fd88b042184e1c 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -2571,9 +2571,12 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
ctx.symtab.addLibcall(s);
}
- // Windows specific -- if __load_config_used can be resolved, resolve it.
- if (ctx.symtab.findUnderscore("_load_config_used"))
- ctx.symtab.addGCRoot(ctx.symtab.mangle("_load_config_used"));
+ ctx.forEachSymtab([&](SymbolTable &symtab) {
+ // Windows specific -- if __load_config_used can be resolved, resolve
+ // it.
+ if (symtab.findUnderscore("_load_config_used"))
+ symtab.addGCRoot(symtab.mangle("_load_config_used"));
+ });
if (args.hasArg(OPT_include_optional)) {
// Handle /includeoptional
diff --git a/lld/test/COFF/arm64x-loadconfig.s b/lld/test/COFF/arm64x-loadconfig.s
index f413adff2868c1..12f7387d9ecdcf 100644
--- a/lld/test/COFF/arm64x-loadconfig.s
+++ b/lld/test/COFF/arm64x-loadconfig.s
@@ -7,6 +7,7 @@
// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows loadconfig-ec.s -o loadconfig-ec.obj
// RUN: llvm-mc -filetype=obj -triple=aarch64-windows loadconfig-short.s -o loadconfig-short.obj
// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows loadconfig-short.s -o loadconfig-short-arm64ec.obj
+// RUN: llvm-lib -machine:arm64x -out:loadconfig.lib loadconfig.obj loadconfig-ec.obj
// RUN: lld-link -machine:arm64x -out:out-warn.dll -dll -noentry test.obj \
// RUN: 2>&1 | FileCheck --check-prefixes=WARN-LOADCFG,WARN-EC-LOADCFG %s
@@ -158,6 +159,10 @@
// BASERELOC-NEXT: Address: 0x2074
// BASERELOC-NEXT: }
+// RUN: lld-link -machine:arm64x -out:out-hyb-lib.dll -dll -noentry loadconfig.lib chpe.obj test.obj
+// RUN: llvm-readobj --coff-load-config out-hyb-lib.dll | FileCheck --check-prefix=LOADCFG %s
+// RUN: llvm-readobj --coff-basereloc out-hyb-lib.dll | FileCheck --check-prefix=BASERELOC %s
+
#--- test.s
.data
sym:
More information about the llvm-commits
mailing list