1# REQUIRES: x86
2
3# Make a DLL that exports exportfn1.
4# RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj
5# RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1 /implib:%t.lib
6
7# Make an obj that takes the address of that exported function.
8# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc %s -o %t2.obj
9# RUN: lld-link -entry:main -guard:cf %t2.obj %t.lib -nodefaultlib -out:%t.exe
10# RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s
11
12# Check that the gfids table contains *exactly* two entries, one for exportfn1
13# and one for main.
14# CHECK: GuardFidTable [
15# CHECK-NEXT: 0x{{[0-9A-Fa-f]+0$}}
16# CHECK-NEXT: 0x{{[0-9A-Fa-f]+0$}}
17# CHECK-NEXT: ]
18
19
20        .def     @feat.00;
21        .scl    3;
22        .type   0;
23        .endef
24        .globl  @feat.00
25@feat.00 = 0x001
26
27        .section .text,"rx"
28        .def     main; .scl    2; .type   32; .endef
29        .global main
30main:
31        leaq exportfn1(%rip), %rax
32        retq
33
34        .section .rdata,"dr"
35.globl _load_config_used
36_load_config_used:
37        .long 256
38        .fill 124, 1, 0
39        .quad __guard_fids_table
40        .quad __guard_fids_count
41        .long __guard_flags
42        .fill 128, 1, 0
43
44