[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / orphan-report.s
blob3dca23267ec648508383c41f1ace9e5a56c407c7
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 # RUN: echo "SECTIONS { .text : { *(.text.1) } }" > %t.script
5 ## Check we do not report orphans by default even with -verbose.
6 # RUN: ld.lld -shared -o %t.out --script %t.script %t.o 2>&1 -verbose \
7 # RUN: | FileCheck %s --check-prefix=DEFAULT
8 # DEFAULT-NOT: placed
10 ## Check --orphan-handling=place has the same behavior as default.
11 # RUN: ld.lld -shared --orphan-handling=place -o %t.out --script %t.script \
12 # RUN: %t.o 2>&1 -verbose -error-limit=0 | FileCheck %s --check-prefix=DEFAULT
14 ## Check --orphan-handling=error reports errors about orphans.
15 # RUN: not ld.lld --orphan-handling=error -o /dev/null -T %t.script \
16 # RUN: %t.o 2>&1 | FileCheck %s --check-prefixes=COMMON,SYMTAB
18 ## --strip-all discards .strtab and .symtab sections. Don't error about them.
19 # RUN: not ld.lld --orphan-handling=error --strip-all -o /dev/null -T %t.script \
20 # RUN: %t.o 2>&1 | FileCheck %s --check-prefix=COMMON
22 ## -shared enables some .dynsym related sections.
23 # RUN: not ld.lld -shared --orphan-handling=error -o /dev/null -T %t.script \
24 # RUN: %t.o 2>&1 | FileCheck %s --check-prefixes=COMMON,DYNSYM,SYMTAB
26 # COMMON: {{.*}}.o:(.text) is being placed in '.text'
27 # COMMON-NEXT: {{.*}}.o:(.text.2) is being placed in '.text.2'
28 # COMMON-NEXT: <internal>:(.comment) is being placed in '.comment'
29 # DYNSYM-NEXT: <internal>:(.dynsym) is being placed in '.dynsym'
30 # DYNSYM-NEXT: <internal>:(.gnu.hash) is being placed in '.gnu.hash'
31 # DYNSYM-NEXT: <internal>:(.hash) is being placed in '.hash'
32 # DYNSYM-NEXT: <internal>:(.dynamic) is being placed in '.dynamic'
33 # DYNSYM-NEXT: <internal>:(.dynstr) is being placed in '.dynstr'
34 # SYMTAB-NEXT: <internal>:(.symtab) is being placed in '.symtab'
35 # COMMON-NEXT: <internal>:(.shstrtab) is being placed in '.shstrtab'
36 # SYMTAB-NEXT: <internal>:(.strtab) is being placed in '.strtab'
37 # COMMON-NOT: <internal>
39 ## Check --orphan-handling=warn reports warnings about orphans.
40 # RUN: ld.lld --orphan-handling=warn -o /dev/null -T %t.script \
41 # RUN: %t.o 2>&1 | FileCheck %s --check-prefixes=COMMON,SYMTAB
43 # RUN: not ld.lld --orphan-handling=foo -o /dev/null --script %t.script %t.o 2>&1 \
44 # RUN: | FileCheck %s --check-prefix=UNKNOWN
45 # UNKNOWN: unknown --orphan-handling mode: foo
47 .section .text.1,"a"
48 nop
50 .section .text.2,"a"
51 nop