[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / orphan-phdrs.s
blob105a5ea012a9b94ce1ea9d8890ebfa26425fe96a
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 # RUN: echo "PHDRS { \
4 # RUN: exec PT_LOAD FLAGS(0x4 | 0x1); \
5 # RUN: rw PT_LOAD FLAGS(0x4 | 0x2); \
6 # RUN: } \
7 # RUN: SECTIONS { \
8 # RUN: .text : { *(.text) } :exec \
9 # RUN: .empty : { *(.empty) } :rw \
10 # RUN: .rw : { *(.rw) } \
11 # RUN: }" > %t.script
12 # RUN: ld.lld -o %t --script %t.script %t.o
13 # RUN: llvm-readelf -S -l %t | FileCheck %s
15 ## Check that the orphan section is placed correctly and belongs to
16 ## the correct segment.
18 # CHECK: Section Headers
19 # CHECK: .text
20 # CHECK-NEXT: .orphan
21 # CHECK-NEXT: .rw
23 # CHECK: Segment Sections
24 # CHECK-NEXT: .text .orphan
25 # CHECK-NEXT: .rw
27 .section .text,"ax"
28 ret
30 .section .rw,"aw"
31 .quad 0
33 .section .orphan,"ax"
34 ret