File: orphan-report.s

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (58 lines) | stat: -rw-r--r-- 2,763 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: echo "SECTIONS { .text : { *(.text.1) } }" > %t.script

## Check we do not report orphans by default even with -verbose.
# RUN: ld.lld -shared -o %t.out --script %t.script %t.o 2>&1 -verbose \
# RUN:   | FileCheck %s --check-prefix=DEFAULT
# DEFAULT-NOT: placed

## Check --orphan-handling=place has the same behavior as default.
# RUN: ld.lld -shared --orphan-handling=place -o %t.out --script %t.script \
# RUN:   %t.o 2>&1 -verbose  -error-limit=0 | FileCheck %s --check-prefix=DEFAULT

## Check --orphan-handling=error or =warn do not report errors if no linker
## script is used.
# RUN: ld.lld -shared -orphan-handling=error -o /dev/null %t.o 2>&1 | count 0
# RUN: ld.lld -shared -orphan-handling=warn -o /dev/null %t.o 2>&1 | count 0
# RUN: ld.lld -r -orphan-handling=error -o /dev/null %t.o 2>&1 | count 0
# RUN: ld.lld -r -orphan-handling=warn -o /dev/null %t.o 2>&1 | count 0

## Check --orphan-handling=error reports errors about orphans.
# RUN: not ld.lld --orphan-handling=error -o /dev/null -T %t.script \
# RUN:   %t.o 2>&1 | FileCheck %s --check-prefixes=COMMON,SYMTAB

## --strip-all discards .strtab and .symtab sections. Don't error about them.
# RUN: not ld.lld --orphan-handling=error --strip-all -o /dev/null -T %t.script \
# RUN:   %t.o 2>&1 | FileCheck %s --check-prefix=COMMON

## -shared enables some .dynsym related sections.
# RUN: not ld.lld -shared --orphan-handling=error -o /dev/null -T %t.script \
# RUN:   %t.o 2>&1 | FileCheck %s --check-prefixes=COMMON,DYNSYM,SYMTAB

# COMMON:      {{.*}}.o:(.text) is being placed in '.text'
# COMMON-NEXT: {{.*}}.o:(.text.2) is being placed in '.text.2'
# COMMON-NEXT: <internal>:(.comment) is being placed in '.comment'
# DYNSYM-NEXT: <internal>:(.dynsym) is being placed in '.dynsym'
# DYNSYM-NEXT: <internal>:(.gnu.hash) is being placed in '.gnu.hash'
# DYNSYM-NEXT: <internal>:(.hash) is being placed in '.hash'
# DYNSYM-NEXT: <internal>:(.dynamic) is being placed in '.dynamic'
# DYNSYM-NEXT: <internal>:(.dynstr) is being placed in '.dynstr'
# SYMTAB-NEXT: <internal>:(.symtab) is being placed in '.symtab'
# COMMON-NEXT: <internal>:(.shstrtab) is being placed in '.shstrtab'
# SYMTAB-NEXT: <internal>:(.strtab) is being placed in '.strtab'
# COMMON-NOT: <internal>

## Check --orphan-handling=warn reports warnings about orphans.
# RUN: ld.lld --orphan-handling=warn -o /dev/null -T %t.script \
# RUN:   %t.o 2>&1 | FileCheck %s --check-prefixes=COMMON,SYMTAB

# RUN: not ld.lld --orphan-handling=foo -o /dev/null --script %t.script %t.o 2>&1 \
# RUN:   | FileCheck %s --check-prefix=UNKNOWN
# UNKNOWN: unknown --orphan-handling mode: foo

.section .text.1,"a"
 nop

.section .text.2,"a"
 nop