Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lld/COFF/SymbolTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,15 @@ void SymbolTable::initializeLoadConfig() {
auto sym =
dyn_cast_or_null<DefinedRegular>(findUnderscore("_load_config_used"));
if (!sym) {
if (isEC()) {
Warn(ctx) << "EC version of '_load_config_used' is missing";
return;
}
if (ctx.hybridSymtab) {
Warn(ctx) << "native version of '_load_config_used' is missing for "
"ARM64X target";
return;
}
if (ctx.config.guardCF != GuardCFLevel::Off)
Warn(ctx)
<< "Control Flow Guard is enabled but '_load_config_used' is missing";
Expand Down
14 changes: 13 additions & 1 deletion lld/test/COFF/arm64x-loadconfig.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@
// 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: lld-link -machine:arm64x -out:out.dll -dll -noentry loadconfig.obj test.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
// WARN-LOADCFG: lld-link: warning: native version of '_load_config_used' is missing for ARM64X target
// WARN-EC-LOADCFG: lld-link: warning: EC version of '_load_config_used' is missing

// RUN: lld-link -machine:arm64x -out:out-nonative.dll -dll -noentry loadconfig-ec.obj chpe.obj \
// RUN: 2>&1 | FileCheck --check-prefixes=WARN-LOADCFG --implicit-check-not EC %s

// RUN: lld-link -machine:arm64ec -out:out-ec.dll -dll -noentry chpe.obj \
// RUN: 2>&1 | FileCheck --check-prefixes=WARN-EC-LOADCFG --implicit-check-not native %s

// RUN: lld-link -machine:arm64x -out:out.dll -dll -noentry loadconfig.obj test.obj \
// RUN: 2>&1 | FileCheck --check-prefixes=WARN-EC-LOADCFG --implicit-check-not native %s

// RUN: llvm-readobj --coff-load-config out.dll | FileCheck --check-prefix=DYNRELOCS %s
// DYNRELOCS: DynamicValueRelocTableOffset: 0xC
Expand Down
Loading