brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · becd4a9 Raw
45 lines · plain
1; REQUIRES: x862; 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.def4; RUN: lld-link -def:%t.def -out:%t.lib -machine:x645 6; Generate an object that will have the load configuration normally provided by7; the CRT.8; RUN: llvm-mc -triple x86_64-windows-msvc -filetype=obj %S/Inputs/loadconfig-cfg-x64.s -o %t.ldcfg.obj9 10; RUN: llvm-as %s -o %t.bc11; RUN: lld-link -entry:main -guard:cf -dll %t.bc %t.lib %t.ldcfg.obj -out:%t2.dll12; RUN: llvm-readobj --coff-load-config %t2.dll | FileCheck %s13 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: 219; CHECK-NEXT:   GuardFlags [ (0x10500)20; CHECK-NEXT:     CF_FUNCTION_TABLE_PRESENT (0x400)21; CHECK-NEXT:     CF_INSTRUMENTED (0x100)22; CHECK-NEXT:     CF_LONGJUMP_TABLE_PRESENT (0x10000)23; CHECK-NEXT:   ]24; CHECK:      ]25; CHECK:      GuardFidTable [26; CHECK-NEXT:   0x180{{.*}}27; CHECK-NEXT:   0x180{{.*}}28; CHECK-NEXT: ]29 30target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"31target triple = "x86_64-pc-windows-msvc19.12.25835"32 33declare dllimport void @do_indirect_call(ptr)34 35define dso_local i32 @main() local_unnamed_addr {36entry:37  tail call void @do_indirect_call(ptr nonnull @my_handler)38  ret i32 039}40 41define dso_local void @my_handler() {42entry:43  ret void44}45