1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
// Test that basic COFF static initializers work. The main function in this
// test returns the expression a + b + c + 1. a is initialzed as -1 and c is
// initialized as -2 by static initializers. b is initialized as 2 by constant
// value. The test will succeeds only if static initializers are ran successfully.
//
// RUN: %clang -c -o %t %s
// RUN: %llvm_jitlink %t
.text
.def @feat.00;
.scl 3;
.type 0;
.endef
.globl @feat.00
.set @feat.00, 0
.file "static-initializer.cpp"
.def init;
.scl 2;
.type 32;
.endef
.globl init # -- Begin function init
.p2align 4, 0x90
init: # @init
# %bb.0:
movl $4294967295, %eax # imm = 0xFFFFFFFF
retq
# -- End function
.def init2;
.scl 2;
.type 32;
.endef
.globl init2 # -- Begin function init2
.p2align 4, 0x90
init2: # @init2
# %bb.0:
movl $4294967294, %eax # imm = 0xFFFFFFFE
retq
# -- End function
.def "??__Ea@@YAXXZ";
.scl 3;
.type 32;
.endef
.p2align 4, 0x90 # -- Begin function ??__Ea@@YAXXZ
"??__Ea@@YAXXZ": # @"??__Ea@@YAXXZ"
.seh_proc "??__Ea@@YAXXZ"
# %bb.0:
subq $40, %rsp
.seh_stackalloc 40
.seh_endprologue
callq init
movl %eax, a(%rip)
addq $40, %rsp
retq
.seh_endproc
# -- End function
.def "??__Ec@@YAXXZ";
.scl 3;
.type 32;
.endef
.p2align 4, 0x90 # -- Begin function ??__Ec@@YAXXZ
"??__Ec@@YAXXZ": # @"??__Ec@@YAXXZ"
.seh_proc "??__Ec@@YAXXZ"
# %bb.0:
subq $40, %rsp
.seh_stackalloc 40
.seh_endprologue
callq init2
movl %eax, c(%rip)
addq $40, %rsp
retq
.seh_endproc
# -- End function
.def main;
.scl 2;
.type 32;
.endef
.globl main # -- Begin function main
.p2align 4, 0x90
main: # @main
.seh_proc main
# %bb.0:
subq $56, %rsp
.seh_stackalloc 56
.seh_endprologue
movl $0, 52(%rsp)
movq %rdx, 40(%rsp)
movl %ecx, 36(%rsp)
movl a(%rip), %ecx
addl b(%rip), %ecx
addl c(%rip), %ecx
addl $1, %ecx
callq *__imp_llvm_jitlink_setTestResultOverride(%rip)
xorl %eax, %eax
addq $56, %rsp
retq
.seh_endproc
# -- End function
.def _GLOBAL__sub_I_static_initializer.cpp;
.scl 3;
.type 32;
.endef
.p2align 4, 0x90 # -- Begin function _GLOBAL__sub_I_static_initializer.cpp
_GLOBAL__sub_I_static_initializer.cpp: # @_GLOBAL__sub_I_static_initializer.cpp
.seh_proc _GLOBAL__sub_I_static_initializer.cpp
# %bb.0:
subq $40, %rsp
.seh_stackalloc 40
.seh_endprologue
callq "??__Ea@@YAXXZ"
callq "??__Ec@@YAXXZ"
nop
addq $40, %rsp
retq
.seh_endproc
# -- End function
.bss
.globl a # @a
.p2align 2
a:
.long 0 # 0x0
.data
.globl b # @b
.p2align 2
b:
.long 2 # 0x2
.bss
.globl c # @c
.p2align 2
c:
.long 0 # 0x0
.section .CRT$XCU,"dr"
.p2align 3
.quad _GLOBAL__sub_I_static_initializer.cpp
|