1# REQUIRES: x86
2# RUN: llvm-mc -triple x86_64-pc-win32 %s -filetype=obj -o %t.obj
3# RUN: lld-link %t.obj -guard:cf -dll -out:%t.dll -noentry
4# RUN: llvm-readobj --coff-load-config %t.dll | FileCheck %s --check-prefix=CHECK
5
6# There should be a single entry in the table for the exported symbol.
7#
8# CHECK: GuardFidTable [
9# CHECK-NEXT: 0x180001000
10# CHECK-NEXT: ]
11
12        .def    func_export; .scl    2; .type   32; .endef
13        .globl func_export
14        .section       .text,"xr",one_only,func_export
15        .p2align 4
16func_export:
17        movl $1, %eax
18        .globl label_export
19label_export:
20        movl $2, %eax
21        ret
22
23        .data
24        .globl data_export
25data_export:
26        .long 42
27
28        .section .drectve,"dr"
29        .ascii " /EXPORT:func_export"
30        .ascii " /EXPORT:label_export"
31        .ascii " /EXPORT:data_export"
32
33
34# Load configuration directory entry (winnt.h _IMAGE_LOAD_CONFIG_DIRECTORY64).
35# The linker will define the __guard_* symbols.
36        .section .rdata,"dr"
37.globl _load_config_used
38_load_config_used:
39        .long 256
40        .fill 124, 1, 0
41        .quad __guard_fids_table
42        .quad __guard_fids_count
43        .long __guard_flags
44        .fill 128, 1, 0
45