[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / orphan-live-only.s
blob500005173a866820f5e53a1314918bce1a3bfd29
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: ro PT_LOAD FLAGS(0x4); \
6 # RUN: } \
7 # RUN: SECTIONS { \
8 # RUN: .pad : { QUAD(0); } :exec \
9 # RUN: .text : { *(.text) } \
10 # RUN: .ro : { *(.ro) } :ro \
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 ## The ".pad" section is not "live" and should be ignored by the
16 ## orphan placement.
18 ## Check that the orphan section is placed correctly and belongs to
19 ## the correct segment.
21 # CHECK: Section Headers
22 # CHECK: .pad
23 # CHECK-NEXT: .text
24 # CHECK-NEXT: .orphan2
25 # CHECK-NEXT: .ro
26 # CHECK-NEXT: .orphan1
28 # CHECK: Segment Sections
29 # CHECK-NEXT: .pad .text .orphan2
30 # CHECK-NEXT: .ro .orphan1
32 .section .text,"ax"
33 ret
35 .section .ro,"a"
36 .byte 0
38 .section .orphan1,"a"
39 .byte 0
41 .section .orphan2,"ax"
42 ret