[ELF] relocateNonAlloc: clean up workaround code
[llvm-project.git] / lld / test / COFF / gfids-corrupt.s
bloba3e06a840bf78dc4b4b7210c8a3933870b355d27
1 # REQUIRES: x86
2 # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj
3 # RUN: lld-link %t.obj -opt:noref -guard:cf,nolongjmp -out:%t.exe -entry:main 2>&1 | FileCheck %s --check-prefix=ERRS
4 # RUN: llvm-readobj --file-headers --coff-load-config %t.exe | FileCheck %s
6 # ERRS: warning: ignoring .gfids$y symbol table index section in object {{.*}}gfids-corrupt{{.*}}
7 # ERRS: warning: ignoring invalid symbol table index in section .gfids$y in object {{.*}}gfids-corrupt{{.*}}
9 # The table is arbitrary, really.
10 # CHECK: ImageBase: 0x140000000
11 # CHECK: LoadConfig [
12 # CHECK: SEHandlerTable: 0x0
13 # CHECK: SEHandlerCount: 0
14 # CHECK: GuardCFCheckFunction: 0x0
15 # CHECK: GuardCFCheckDispatch: 0x0
16 # CHECK: GuardCFFunctionTable: 0x14000{{.*}}
17 # CHECK: GuardCFFunctionCount: 2
18 # CHECK: GuardFlags [ (0x500)
19 # CHECK: CF_FUNCTION_TABLE_PRESENT (0x400)
20 # CHECK: CF_INSTRUMENTED (0x100)
21 # CHECK: ]
22 # CHECK: GuardAddressTakenIatEntryTable: 0x0
23 # CHECK: GuardAddressTakenIatEntryCount: 0
24 # CHECK: GuardLongJumpTargetTable: 0x0
25 # CHECK: GuardLongJumpTargetCount: 0
26 # CHECK: ]
27 # CHECK: GuardFidTable [
28 # CHECK-NEXT: 0x14000{{.*}}
29 # CHECK-NEXT: 0x14000{{.*}}
30 # CHECK-NEXT: ]
33 # Indicate that gfids are present.
34 .def @feat.00; .scl 3; .type 0; .endef
35 .globl @feat.00
36 @feat.00 = 0x800
38 .def f1; .scl 2; .type 32; .endef
39 .section .text,"xr",one_only,f1
40 .global f1
41 f1:
42 movl $42, %eax
43 retq
45 .def f2; .scl 2; .type 32; .endef
46 .section .text,"xr",one_only,f2
47 .global f2
48 f2:
49 movl $13, %eax
50 retq
52 .section .data,"dw",one_only,fp1
53 .globl fp1
54 fp1:
55 .quad f1
57 .section .data,"dw",one_only,fp2
58 .globl fp2
59 fp2:
60 .quad f2
62 .section .gfids$y,"dr",associative,fp1
63 .symidx f1
64 .byte 0
66 .section .gfids$y,"dr",associative,fp2
67 .symidx f2
68 .long 0x400
70 .def main; .scl 2; .type 32; .endef
71 .section .text,"xr",one_only,main
72 .globl main
73 main:
74 callq *fp1(%rip)
75 callq *fp2(%rip)
76 xor %eax, %eax
77 retq
79 .section .rdata,"dr"
80 .globl _load_config_used
81 _load_config_used:
82 .long 256
83 .fill 124, 1, 0
84 .quad __guard_fids_table
85 .quad __guard_fids_count
86 .long __guard_flags
87 .fill 128, 1, 0