[Clang] Fix crash due to invalid source location in __is_trivially_equality_comparabl...
[llvm-project.git] / lld / test / ELF / linkerscript / orphan-report.s
blobeedcc4eff816831ab8ee6c1b4e67a72ee83529b6
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 or =warn do not report errors if no linker
15 ## script is used.
16 # RUN: ld.lld -shared -orphan-handling=error -o /dev/null %t.o 2>&1 | count 0
17 # RUN: ld.lld -shared -orphan-handling=warn -o /dev/null %t.o 2>&1 | count 0
18 # RUN: ld.lld -r -orphan-handling=error -o /dev/null %t.o 2>&1 | count 0
19 # RUN: ld.lld -r -orphan-handling=warn -o /dev/null %t.o 2>&1 | count 0
21 ## Check --orphan-handling=error reports errors about orphans.
22 # RUN: not ld.lld --orphan-handling=error -o /dev/null -T %t.script \
23 # RUN: %t.o 2>&1 | FileCheck %s --check-prefixes=COMMON,SYMTAB
25 ## --strip-all discards .strtab and .symtab sections. Don't error about them.
26 # RUN: not ld.lld --orphan-handling=error --strip-all -o /dev/null -T %t.script \
27 # RUN: %t.o 2>&1 | FileCheck %s --check-prefix=COMMON
29 ## -shared enables some .dynsym related sections.
30 # RUN: not ld.lld -shared --orphan-handling=error -o /dev/null -T %t.script \
31 # RUN: %t.o 2>&1 | FileCheck %s --check-prefixes=COMMON,DYNSYM,SYMTAB
33 # COMMON: {{.*}}.o:(.text) is being placed in '.text'
34 # COMMON-NEXT: {{.*}}.o:(.text.2) is being placed in '.text.2'
35 # COMMON-NEXT: <internal>:(.comment) is being placed in '.comment'
36 # DYNSYM-NEXT: <internal>:(.dynsym) is being placed in '.dynsym'
37 # DYNSYM-NEXT: <internal>:(.gnu.hash) is being placed in '.gnu.hash'
38 # DYNSYM-NEXT: <internal>:(.hash) is being placed in '.hash'
39 # DYNSYM-NEXT: <internal>:(.dynamic) is being placed in '.dynamic'
40 # DYNSYM-NEXT: <internal>:(.dynstr) is being placed in '.dynstr'
41 # SYMTAB-NEXT: <internal>:(.symtab) is being placed in '.symtab'
42 # COMMON-NEXT: <internal>:(.shstrtab) is being placed in '.shstrtab'
43 # SYMTAB-NEXT: <internal>:(.strtab) is being placed in '.strtab'
44 # COMMON-NOT: <internal>
46 ## Check --orphan-handling=warn reports warnings about orphans.
47 # RUN: ld.lld --orphan-handling=warn -o /dev/null -T %t.script \
48 # RUN: %t.o 2>&1 | FileCheck %s --check-prefixes=COMMON,SYMTAB
50 # RUN: not ld.lld --orphan-handling=foo -o /dev/null --script %t.script %t.o 2>&1 \
51 # RUN: | FileCheck %s --check-prefix=UNKNOWN
52 # UNKNOWN: unknown --orphan-handling mode: foo
54 .section .text.1,"a"
55 nop
57 .section .text.2,"a"
58 nop