[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / excludefile.s
blob48ef151fcbc1b41aa7fc773bdfaba0c10cbbfea8
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
4 # RUN: %p/Inputs/include.s -o %t2
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
6 # RUN: %p/Inputs/notinclude.s -o %t3.notinclude
8 # RUN: echo "SECTIONS {} " > %t.script
9 # RUN: ld.lld -o %t --script %t.script %t1 %t2 %t3.notinclude
10 # RUN: llvm-objdump -d %t | FileCheck %s
12 # CHECK: Disassembly of section .text:
13 # CHECK-EMPTY:
14 # CHECK: <_start>:
15 # CHECK-NEXT: : 48 c7 c0 3c 00 00 00 movq $60, %rax
16 # CHECK-NEXT: : 48 c7 c7 2a 00 00 00 movq $42, %rdi
17 # CHECK-NEXT: : cc int3
18 # CHECK-NEXT: : cc int3
19 # CHECK: <_potato>:
20 # CHECK-NEXT: : 90 nop
21 # CHECK-NEXT: : 90 nop
22 # CHECK-NEXT: : cc int3
23 # CHECK-NEXT: : cc int3
24 # CHECK: <tomato>:
25 # CHECK-NEXT: : b8 01 00 00 00 movl $1, %eax
27 # RUN: echo "SECTIONS { .patatino : \
28 # RUN: { KEEP(*(EXCLUDE_FILE(*notinclude) .text)) } }" \
29 # RUN: > %t.script
30 # RUN: ld.lld -o %t4 --script %t.script %t1 %t2 %t3.notinclude
31 # RUN: llvm-objdump -d %t4 | FileCheck %s --check-prefix=EXCLUDE
33 # EXCLUDE: Disassembly of section .patatino:
34 # EXCLUDE-EMPTY:
35 # EXCLUDE: <_start>:
36 # EXCLUDE-NEXT: : 48 c7 c0 3c 00 00 00 movq $60, %rax
37 # EXCLUDE-NEXT: : 48 c7 c7 2a 00 00 00 movq $42, %rdi
38 # EXCLUDE-NEXT: : cc int3
39 # EXCLUDE-NEXT: : cc int3
40 # EXCLUDE: <_potato>:
41 # EXCLUDE-NEXT: : 90 nop
42 # EXCLUDE-NEXT: : 90 nop
43 # EXCLUDE: Disassembly of section .text:
44 # EXCLUDE-EMPTY:
45 # EXCLUDE: <tomato>:
46 # EXCLUDE-NEXT: : b8 01 00 00 00 movl $1, %eax
48 .section .text
49 .globl _start
50 _start:
51 mov $60, %rax
52 mov $42, %rdi