[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / dynamic.s
blobc69e752f9ad67fc6515474d5f3b3fab1938db175
1 # REQUIRES: x86
3 ## Test that DT_INIT_ARRAYSZ/DT_FINI_ARRAYSZ/DT_PREINIT_ARRAYSZ are computed
4 ## correctly, no matter their associated sections are orphans or not.
6 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
7 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
8 # RUN: ld.lld -shared %t2.o -soname=so -o %t2.so
10 # RUN: echo "SECTIONS { .init_array : { *(.init_array) } }" > %t.script
11 # RUN: ld.lld -T %t.script %t1.o %t2.so -o %t
12 # RUN: llvm-readobj --dynamic-table %t | FileCheck %s
14 # CHECK: DynamicSection [
15 # CHECK-NEXT: Tag Type Name/Value
16 # CHECK: 0x0000000000000021 PREINIT_ARRAYSZ 9 (bytes)
17 # CHECK: 0x000000000000001B INIT_ARRAYSZ 8 (bytes)
18 # CHECK: 0x000000000000001C FINI_ARRAYSZ 10 (bytes)
20 .globl _start
21 _start:
23 .section .init_array,"aw",@init_array
24 .quad 0
26 .section .preinit_array,"aw",@preinit_array
27 .quad 0
28 .byte 0
30 .section .fini_array,"aw",@fini_array
31 .quad 0
32 .short 0