1; REQUIRES: x86 2; Set up an import library for a DLL that will do the indirect call. 3; RUN: echo -e 'LIBRARY library\nEXPORTS\n do_indirect_call\n' > %t.def 4; RUN: lld-link -lib -def:%t.def -out:%t.lib -machine:x64 5 6; Generate an object that will have the load configuration normally provided by 7; the CRT. 8; RUN: llvm-mc -triple x86_64-windows-msvc -filetype=obj %S/Inputs/loadconfig-cfg-x64.s -o %t.ldcfg.obj 9 10; RUN: llvm-as %s -o %t.bc 11; RUN: lld-link -entry:main -guard:cf -dll %t.bc %t.lib %t.ldcfg.obj -out:%t2.dll 12; RUN: llvm-readobj --coff-load-config %t2.dll | FileCheck %s 13 14; There must be *two* entries in the table: DLL entry point, and my_handler. 15 16; CHECK: LoadConfig [ 17; CHECK: GuardCFFunctionTable: 0x{{[^0].*}} 18; CHECK-NEXT: GuardCFFunctionCount: 2 19; CHECK-NEXT: GuardFlags: 0x10500 20; CHECK: ] 21; CHECK: GuardFidTable [ 22; CHECK-NEXT: 0x180{{.*}} 23; CHECK-NEXT: 0x180{{.*}} 24; CHECK-NEXT: ] 25 26target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 27target triple = "x86_64-pc-windows-msvc19.12.25835" 28 29declare dllimport void @do_indirect_call(void ()*) 30 31define dso_local i32 @main() local_unnamed_addr { 32entry: 33 tail call void @do_indirect_call(void ()* nonnull @my_handler) 34 ret i32 0 35} 36 37define dso_local void @my_handler() { 38entry: 39 ret void 40} 41