xref: /llvm-project/lld/test/ELF/pre_init_fini_array_missing.s (revision fdd319655359b005889abf40d1d8a54fbd56059e)
1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3// RUN: ld.lld %t.o -o %t
4// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
5// RUN: ld.lld -pie %t.o -o %t2
6// RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck --check-prefix=PIE %s
7
8.globl _start
9_start:
10  call __preinit_array_start
11  call __preinit_array_end
12  call __init_array_start
13  call __init_array_end
14  call __fini_array_start
15  call __fini_array_end
16
17/// Due to __init_array_start/__init_array_end, .init_array is retained.
18
19// CHECK: Disassembly of section .text:
20// CHECK-EMPTY:
21// CHECK-NEXT:  <_start>:
22// CHECK-NEXT:   201120:       callq    0x200000
23// CHECK-NEXT:                 callq    0x200000
24// CHECK-NEXT:                 callq    0x200000
25// CHECK-NEXT:                 callq    0x200000
26// CHECK-NEXT:                 callq    0x200000
27// CHECK-NEXT:                 callq    0x200000
28
29// In position-independent binaries, they resolve to .text too.
30
31// PIE:      Disassembly of section .text:
32// PIE-EMPTY:
33// PIE-NEXT: <_start>:
34// PIE-NEXT:     1210:       callq   0x0
35// PIE-NEXT:                 callq   0x0
36// PIE-NEXT:                 callq   0x0
37// PIE-NEXT:                 callq   0x0
38// PIE-NEXT:                 callq   0x0
39// PIE-NEXT:                 callq   0x0
40