58 lines · plain
1// Test that __orc_rt_macho_jit_dlopen and __orc_rt_macho_jit_dlclose work as2// expected when dlopen and dlclose are run twice in sequence (i.e. dlopen,3// dlclose, dlopen, dlclose) on a testcase containing simple stateless4// constructors and destructors (in this case they just print "constructor" and5// "destructor" respectively).6//7// RUN: %clang -c -o %t.main.o %p/Inputs/dlopen-dlclose-x2.S8// RUN: %clang -c -o %t.inits.o %s9// 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 %s13 14// CHECK: entering main15// CHECK-NEXT: constructor16// CHECK-NEXT: destructor17// CHECK-NEXT: constructor18// CHECK-NEXT: destructor19// CHECK-NEXT: leaving main20 21 .section __TEXT,__text,regular,pure_instructions22 .build_version macos, 12, 0 sdk_version 12, 0, 123 .globl _deinitializer24 .p2align 4, 0x9025_deinitializer:26 pushq %rbp27 movq %rsp, %rbp28 leaq L_str.2(%rip), %rdi29 popq %rbp30 jmp _puts31 32 .section __TEXT,__StaticInit,regular,pure_instructions33 .p2align 4, 0x9034_initializer:35 pushq %rbp36 movq %rsp, %rbp37 leaq L_str(%rip), %rdi38 callq _puts39 movq _deinitializer@GOTPCREL(%rip), %rdi40 leaq _I(%rip), %rsi41 leaq ___dso_handle(%rip), %rdx42 popq %rbp43 jmp ___cxa_atexit44 45 .globl _I46.zerofill __DATA,__common,_I,1,047 .section __DATA,__mod_init_func,mod_init_funcs48 .p2align 349 .quad _initializer50 .section __TEXT,__cstring,cstring_literals51L_str:52 .asciz "constructor"53 54L_str.2:55 .asciz "destructor"56 57.subsections_via_symbols58