[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / ctors_dtors_priority.s
blobf68657fa350994bf9173fbd5381a6dcb4a02090a
1 // REQUIRES: x86
3 // Test .ctors* and .dtors* are sorted by priority.
5 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
6 // RUN: mkdir -p %t
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
27 .globl _start
28 _start:
29 nop
31 .section .ctors, "aw", @progbits
32 .quad 1
33 .section .ctors.100, "aw", @progbits
34 .quad 2
35 .section .ctors.005, "aw", @progbits
36 .quad 3
37 .section .ctors, "aw", @progbits
38 .quad 4
39 .section .ctors, "aw", @progbits
40 .quad 5
42 .section .dtors, "aw", @progbits
43 .quad 0x11
44 .section .dtors.100, "aw", @progbits
45 .quad 0x12
46 .section .dtors.005, "aw", @progbits
47 .quad 0x13
48 .section .dtors, "aw", @progbits
49 .quad 0x14
50 .section .dtors, "aw", @progbits
51 .quad 0x15
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