| 1 | // Contains a static initializer and deinitializer registered with |
| 2 | // ___cxa_atexit. dlopen-ing/dlclose-ing will print "constructor" and |
| 3 | // "destructor" respectively. |
| 4 | |
| 5 | .section __TEXT,__text,regular,pure_instructions |
| 6 | .build_version macos, 12, 0 sdk_version 12, 0, 1 |
| 7 | .globl _deinitializer |
| 8 | .p2align 4, 0x90 |
| 9 | _deinitializer: |
| 10 | pushq %rbp |
| 11 | movq %rsp, %rbp |
| 12 | leaq L_str.2(%rip), %rdi |
| 13 | popq %rbp |
| 14 | jmp _puts |
| 15 | |
| 16 | .section __TEXT,__StaticInit,regular,pure_instructions |
| 17 | .p2align 4, 0x90 |
| 18 | _initializer: |
| 19 | pushq %rbp |
| 20 | movq %rsp, %rbp |
| 21 | leaq L_str(%rip), %rdi |
| 22 | callq _puts |
| 23 | movq _deinitializer@GOTPCREL(%rip), %rdi |
| 24 | leaq _I(%rip), %rsi |
| 25 | leaq ___dso_handle(%rip), %rdx |
| 26 | popq %rbp |
| 27 | jmp ___cxa_atexit |
| 28 | |
| 29 | .globl _I |
| 30 | .zerofill __DATA,__common,_I,1,0 |
| 31 | .section __DATA,__mod_init_func,mod_init_funcs |
| 32 | .p2align 3 |
| 33 | .quad _initializer |
| 34 | .section __TEXT,__cstring,cstring_literals |
| 35 | L_str: |
| 36 | .asciz "constructor" |
| 37 | |
| 38 | L_str.2: |
| 39 | .asciz "destructor" |
| 40 | |
| 41 | .subsections_via_symbols |
| 42 | |