[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / init_fini_priority.s
blob0e5ba8fe44932f218b02ccae34b7a561d51ee41e
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3 // RUN: llvm-objdump --section-headers %t | FileCheck %s --check-prefix=OBJ
4 // RUN: ld.lld %t -o %t.exe
5 // RUN: llvm-objdump -s %t.exe | FileCheck %s
7 // OBJ: 3 .init_array
8 // OBJ-NEXT: 4 .init_array.100
9 // OBJ-NEXT: 5 .init_array.5
10 // OBJ-NEXT: 6 .init_array
11 // OBJ-NEXT: 7 .init_array
12 // OBJ-NEXT: 8 .fini_array
13 // OBJ-NEXT: 9 .fini_array.100
14 // OBJ-NEXT: 10 .fini_array.5
15 // OBJ-NEXT: 11 .fini_array
16 // OBJ-NEXT: 12 .fini_array
18 .globl _start
19 _start:
20 nop
22 .section .init_array, "aw", @init_array, unique, 0
23 .align 8
24 .byte 1
25 .section .init_array.100, "aw", @init_array
26 .long 2
27 .section .init_array.5, "aw", @init_array
28 .byte 3
29 .section .init_array, "aw", @init_array, unique, 1
30 .byte 4
31 .section .init_array, "aw", @init_array, unique, 2
32 .byte 5
34 .section .fini_array, "aw", @fini_array, unique, 0
35 .align 8
36 .byte 0x11
37 .section .fini_array.100, "aw", @fini_array
38 .long 0x12
39 .section .fini_array.5, "aw", @fini_array
40 .byte 0x13
41 .section .fini_array, "aw", @fini_array, unique, 1
42 .byte 0x14
43 .section .fini_array, "aw", @fini_array, unique, 2
44 .byte 0x15
46 // CHECK: Contents of section .init_array:
47 // CHECK-NEXT: 03020000 00000000 010405
48 // CHECK: Contents of section .fini_array:
49 // CHECK-NEXT: 13120000 00000000 111415