[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / segment-none.s
blob85739747ac9c584621db4d9686addb2ce16cb415
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
4 ## Test that section .foo is not placed in any segment when assigned to segment
5 ## NONE in the linker script and segment NONE is not defined.
6 # RUN: echo "PHDRS {text PT_LOAD;} \
7 # RUN: SECTIONS { \
8 # RUN: .text : {*(.text .text*)} :text \
9 # RUN: .foo : {*(.foo)} :NONE \
10 # RUN: }" > %t.script
11 # RUN: ld.lld -o %t --script %t.script %t.o
12 # RUN: llvm-readelf -S -l %t | FileCheck %s
14 ## Test that section .foo is placed in segment NONE when assigned to segment
15 ## NONE in the linker script and segment NONE is defined.
16 # RUN: echo "PHDRS {text PT_LOAD; NONE PT_LOAD;} \
17 # RUN: SECTIONS { \
18 # RUN: .text : {*(.text .text*)} :text \
19 # RUN: .foo : {*(.foo)} :NONE \
20 # RUN: }" > %t.script
21 # RUN: ld.lld -o %t --script %t.script %t.o
22 # RUN: llvm-readelf -S -l %t | FileCheck --check-prefix=DEFINED %s
24 # CHECK: Section to Segment mapping:
25 # CHECK-NEXT: Segment Sections...
26 # CHECK: None {{.*}}.foo
28 # DEFINED: Section to Segment mapping:
29 # DEFINED-NEXT: Segment Sections...
30 # DEFINED-NEXT: 00 .text
31 # DEFINED-NEXT: 01 .foo
33 .global _start
34 _start:
35 nop
37 .section .foo,"a"
38 foo:
39 .long 0