100 lines · plain
1// Test that ELF static initializers with different constructor priorities work2// and are executed in the proper order.3//4// RUN: %clang -c -o %t %s5// RUN: %llvm_jitlink %t | FileCheck %s6 7// CHECK: constructor 1008// CHECK-NEXT: constructor 2009// CHECK-NEXT: constructor 6553510// CHECK-NEXT: main11// CHECK-NEXT: destructor12 13 .text14 15 .globl destructor16 .p2align 4, 0x9017 .type destructor,@function18destructor:19.Ldestructor$local:20 21 leaq .L.str.d(%rip), %rdi22 jmp puts@PLT23 24 .globl main25 .p2align 4, 0x9026 .type main,@function27main:28.Lmain$local:29 30 pushq %rax31 leaq .L.str(%rip), %rdi32 callq puts@PLT33 xorl %eax, %eax34 popq %rcx35 retq36 37 .p2align 4, 0x9038 .type constructor.65535,@function39constructor.65535:40 41 pushq %rax42 leaq .L.str.65535(%rip), %rdi43 callq puts@PLT44 leaq .Ldestructor$local(%rip), %rdi45 leaq __dso_handle(%rip), %rdx46 xorl %esi, %esi47 popq %rax48 jmp __cxa_atexit@PLT49 50 .p2align 4, 0x9051 .type constructor.200,@function52constructor.200:53 54 leaq .L.str.200(%rip), %rdi55 jmp puts@PLT56 57 .p2align 4, 0x9058 .type constructor.100,@function59constructor.100:60 61 leaq .L.str.100(%rip), %rdi62 jmp puts@PLT63 64 .hidden __dso_handle65 .type .L.str,@object66 .section .rodata.str1.1,"aMS",@progbits,167.L.str:68 .asciz "main"69 .size .L.str, 570 71 .type .L.str.100,@object72.L.str.100:73 .asciz "constructor 100"74 .size .L.str.100, 1675 76 .type .L.str.200,@object77.L.str.200:78 .asciz "constructor 200"79 .size .L.str.200, 1680 81 .type .L.str.65535,@object82.L.str.65535:83 .asciz "constructor 65535"84 .size .L.str.65535, 1885 86 .type .L.str.d,@object87.L.str.d:88 .asciz "destructor"89 .size .L.str.d, 1190 91 .section .init_array.100,"aw",@init_array92 .p2align 393 .quad constructor.10094 .section .init_array.200,"aw",@init_array95 .p2align 396 .quad constructor.20097 .section .init_array,"aw",@init_array98 .p2align 399 .quad constructor.65535100