Debian Codegraph @

compiler-rt/test/orc/TestCases/Darwin/x86-64/jit-re-dlopen-trivial.S

raw
1 // Test that __orc_rt_macho_jit_dlopen and __orc_rt_macho_jit_dlclose work as
2 // expected when dlopen and dlclose are run twice in sequence (i.e. dlopen,
3 // dlclose, dlopen, dlclose) on a testcase containing simple stateless
4 // constructors and destructors (in this case they just print "constructor" and
5 // "destructor" respectively).
6 //
7 // RUN: %clang -c -o %t.main.o %p/Inputs/dlopen-dlclose-x2.S
8 // RUN: %clang -c -o %t.inits.o %s
9 // RUN: %llvm_jitlink \
10 // RUN: -alias Platform:_dlopen=___orc_rt_macho_jit_dlopen \
11 // RUN: -alias Platform:_dlclose=___orc_rt_macho_jit_dlclose \
12 // RUN: %t.main.o -jd inits %t.inits.o -lmain | FileCheck %s
13
14 // CHECK: entering main
15 // CHECK-NEXT: constructor
16 // CHECK-NEXT: destructor
17 // CHECK-NEXT: constructor
18 // CHECK-NEXT: destructor
19 // CHECK-NEXT: leaving main
20
21 .section __TEXT,__text,regular,pure_instructions
22 .build_version macos, 12, 0 sdk_version 12, 0, 1
23 .globl _deinitializer
24 .p2align 4, 0x90
25 _deinitializer:
26 pushq %rbp
27 movq %rsp, %rbp
28 leaq L_str.2(%rip), %rdi
29 popq %rbp
30 jmp _puts
31
32 .section __TEXT,__StaticInit,regular,pure_instructions
33 .p2align 4, 0x90
34 _initializer:
35 pushq %rbp
36 movq %rsp, %rbp
37 leaq L_str(%rip), %rdi
38 callq _puts
39 movq _deinitializer@GOTPCREL(%rip), %rdi
40 leaq _I(%rip), %rsi
41 leaq ___dso_handle(%rip), %rdx
42 popq %rbp
43 jmp ___cxa_atexit
44
45 .globl _I
46 .zerofill __DATA,__common,_I,1,0
47 .section __DATA,__mod_init_func,mod_init_funcs
48 .p2align 3
49 .quad _initializer
50 .section __TEXT,__cstring,cstring_literals
51 L_str:
52 .asciz "constructor"
53
54 L_str.2:
55 .asciz "destructor"
56
57 .subsections_via_symbols