[LLD][COFF] Pull _load_config_used symbol from both symbol tables on ARM64X (#122837)

This commit is contained in:
Jacek Caban 2025-01-15 17:43:33 +01:00 committed by GitHub
parent 3bb969f3eb
commit 80084e9cb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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: