3 // Test
.ctors* and .dtors* are sorted by priority.
5 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-unknown-linux
%s
-o
%t1
7 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-unknown-linux \
8 // RUN
: %p
/Inputs
/ctors_dtors_priority1.s
-o
%t/crtbegin.o
9 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-unknown-linux \
10 // RUN
: %p
/Inputs
/ctors_dtors_priority2.s
-o
%t2
11 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-unknown-linux \
12 // RUN
: %p
/Inputs
/ctors_dtors_priority3.s
-o
%t/crtend.o
13 // RUN
: ld.lld
%t1
%t2
%t/crtend.o
%t/crtbegin.o
-o
%t.exe
14 // RUN
: llvm-objdump
-s
%t.exe | FileCheck
%s
16 // RUN
: cp
%t/crtbegin.o
%t/clang_rt.crtbegin.o
17 // RUN
: cp
%t/crtend.o
%t/clang_rt.crtend.o
18 // RUN
: ld.lld
%t1
%t2
%t/clang_rt.crtend.o
%t/clang_rt.crtbegin.o
-o
%t.clang_rt.exe
19 // RUN
: llvm-objdump
-s
%t.clang_rt.exe | FileCheck
%s
21 // RUN
: cp
%t/crtbegin.o
%t/clang_rt.crtbegin-x86_64.o
22 // RUN
: cp
%t/crtend.o
%t/clang_rt.crtend-x86_64.o
23 // RUN
: ld.lld
%t1
%t2
%t/clang_rt.crtend-x86_64.o
%t/clang_rt.crtbegin-x86_64.o
-o
%t.clang_rt-arch.exe
24 // RUN
: llvm-objdump
-s
%t.clang_rt-arch.exe | FileCheck
%s
31 .section .ctors, "aw", @progbits
33 .section .ctors.100, "aw", @progbits
35 .section .ctors.005, "aw", @progbits
37 .section .ctors, "aw", @progbits
39 .section .ctors, "aw", @progbits
42 .section .dtors, "aw", @progbits
44 .section .dtors.100, "aw", @progbits
46 .section .dtors.005, "aw", @progbits
48 .section .dtors, "aw", @progbits
50 .section .dtors, "aw", @progbits
53 // CHECK
: Contents of section
.ctors:
54 // CHECK-NEXT
: a1000000
00000000 01000000 00000000
55 // CHECK-NEXT
: 04000000 00000000 05000000 00000000
56 // CHECK-NEXT
: b1000000
00000000 03000000 00000000
57 // CHECK-NEXT
: 02000000 00000000 c1000000
00000000
59 // CHECK
: Contents of section
.dtors:
60 // CHECK-NEXT
: a2000000
00000000 11000000 00000000
61 // CHECK-NEXT
: 14000000 00000000 15000000 00000000
62 // CHECK-NEXT
: b2000000
00000000 13000000 00000000
63 // CHECK-NEXT
: 12000000 00000000 c2000000
00000000