[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / orphan-discard.s
blob2f1c427dda54ae9766984099fc135e9aad460f66
1 # REQUIRES: x86
2 # RUN: llvm-mc -position-independent -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 # RUN: echo "SECTIONS { \
4 # RUN: . = 0xffffffff80000000; \
5 # RUN: .text : ALIGN(4096) { *(.text) } \
6 # RUN: .data : ALIGN(4096) { *(.data) } \
7 # RUN: .bss : ALIGN(4096) { *(.bss); } \
8 # RUN: . = ALIGN(4096); \
9 # RUN: _end = .; \
10 # RUN: /DISCARD/ : { *(.comment) } \
11 # RUN: }" > %t.script
12 # RUN: ld.lld -o %t --script %t.script %t.o
13 # RUN: llvm-readelf -S -s %t | FileCheck %s
15 # CHECK: .bss NOBITS ffffffff80002000 002008 000002 00 WA 0 0 4096
16 # CHECK: ffffffff80003000 0 NOTYPE GLOBAL DEFAULT 3 _end
18 .section .text, "ax"
19 ret
21 .section .data, "aw"
22 .quad 0
24 .section .bss, "", @nobits
25 .short 0