Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / orc / TestCases / Linux / x86-64 / priority-static-initializer.S
blob13a52f32cef2ad883ffb78233375f96f40f06a2e
1 // Test that ELF static initializers with different constructor priorities work
2 // and are executed in the proper order.
3 //
4 // RUN: %clang -c -o %t %s
5 // RUN: %llvm_jitlink %t | FileCheck %s
7 // CHECK: constructor 100
8 // CHECK-NEXT: constructor 200
9 // CHECK-NEXT: constructor 65535
10 // CHECK-NEXT: main
11 // CHECK-NEXT: destructor
13         .text
15         .globl  destructor
16         .p2align        4, 0x90
17         .type   destructor,@function
18 destructor:
19 .Ldestructor$local:
21         leaq    .L.str.d(%rip), %rdi
22         jmp     puts@PLT
24         .globl  main
25         .p2align        4, 0x90
26         .type   main,@function
27 main:
28 .Lmain$local:
30         pushq   %rax
31         leaq    .L.str(%rip), %rdi
32         callq   puts@PLT
33         xorl    %eax, %eax
34         popq    %rcx
35         retq
37         .p2align        4, 0x90
38         .type   constructor.65535,@function
39 constructor.65535:
41         pushq   %rax
42         leaq    .L.str.65535(%rip), %rdi
43         callq   puts@PLT
44         leaq    .Ldestructor$local(%rip), %rdi
45         leaq    __dso_handle(%rip), %rdx
46         xorl    %esi, %esi
47         popq    %rax
48         jmp     __cxa_atexit@PLT
50         .p2align        4, 0x90
51         .type   constructor.200,@function
52 constructor.200:
54         leaq    .L.str.200(%rip), %rdi
55         jmp     puts@PLT
57         .p2align        4, 0x90
58         .type   constructor.100,@function
59 constructor.100:
61         leaq    .L.str.100(%rip), %rdi
62         jmp     puts@PLT
64         .hidden __dso_handle
65         .type   .L.str,@object
66         .section        .rodata.str1.1,"aMS",@progbits,1
67 .L.str:
68         .asciz  "main"
69         .size   .L.str, 5
71         .type   .L.str.100,@object
72 .L.str.100:
73         .asciz  "constructor 100"
74         .size   .L.str.100, 16
76         .type   .L.str.200,@object
77 .L.str.200:
78         .asciz  "constructor 200"
79         .size   .L.str.200, 16
81         .type   .L.str.65535,@object
82 .L.str.65535:
83         .asciz  "constructor 65535"
84         .size   .L.str.65535, 18
86         .type   .L.str.d,@object
87 .L.str.d:
88         .asciz  "destructor"
89         .size   .L.str.d, 11
91         .section        .init_array.100,"aw",@init_array
92         .p2align        3
93         .quad   constructor.100
94         .section        .init_array.200,"aw",@init_array
95         .p2align        3
96         .quad   constructor.200
97         .section        .init_array,"aw",@init_array
98         .p2align        3
99         .quad   constructor.65535