2017-09-25 17:41:32 +08:00
|
|
|
# REQUIRES: x86
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
|
|
|
|
# RUN: echo "SECTIONS { .text : { *(.text.1) } }" > %t.script
|
|
|
|
|
2017-10-25 23:20:30 +08:00
|
|
|
## 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 reports errors about orphans.
|
2020-02-13 13:48:45 +08:00
|
|
|
# RUN: not ld.lld -shared --orphan-handling=error -o /dev/null --script %t.script \
|
2017-10-25 23:20:30 +08:00
|
|
|
# RUN: %t.o 2>&1 -verbose -error-limit=0 | FileCheck %s --check-prefix=REPORT
|
|
|
|
# REPORT: {{.*}}.o:(.text) is being placed in '.text'
|
|
|
|
# REPORT-NEXT: {{.*}}.o:(.text.2) is being placed in '.text'
|
|
|
|
# REPORT-NEXT: <internal>:(.comment) is being placed in '.comment'
|
|
|
|
# REPORT-NEXT: <internal>:(.bss) is being placed in '.bss'
|
|
|
|
# REPORT-NEXT: <internal>:(.bss.rel.ro) is being placed in '.bss.rel.ro'
|
|
|
|
# REPORT-NEXT: <internal>:(.dynsym) is being placed in '.dynsym'
|
|
|
|
# REPORT-NEXT: <internal>:(.gnu.version) is being placed in '.gnu.version'
|
|
|
|
# REPORT-NEXT: <internal>:(.gnu.version_r) is being placed in '.gnu.version_r'
|
|
|
|
# REPORT-NEXT: <internal>:(.gnu.hash) is being placed in '.gnu.hash'
|
|
|
|
# REPORT-NEXT: <internal>:(.hash) is being placed in '.hash'
|
|
|
|
# REPORT-NEXT: <internal>:(.dynamic) is being placed in '.dynamic'
|
|
|
|
# REPORT-NEXT: <internal>:(.dynstr) is being placed in '.dynstr'
|
|
|
|
# REPORT-NEXT: <internal>:(.rela.dyn) is being placed in '.rela.dyn'
|
2019-06-08 01:57:58 +08:00
|
|
|
# REPORT-NEXT: <internal>:(.eh_frame) is being placed in '.eh_frame'
|
2017-10-25 23:20:30 +08:00
|
|
|
# REPORT-NEXT: <internal>:(.got) is being placed in '.got'
|
|
|
|
# REPORT-NEXT: <internal>:(.got.plt) is being placed in '.got.plt'
|
|
|
|
# REPORT-NEXT: <internal>:(.got.plt) is being placed in '.got.plt'
|
|
|
|
# REPORT-NEXT: <internal>:(.rela.plt) is being placed in '.rela.plt'
|
2019-08-03 10:26:52 +08:00
|
|
|
# REPORT-NEXT: <internal>:(.rela.dyn) is being placed in '.rela.dyn'
|
2017-10-25 23:20:30 +08:00
|
|
|
# REPORT-NEXT: <internal>:(.plt) is being placed in '.plt'
|
2019-12-15 08:19:03 +08:00
|
|
|
# REPORT-NEXT: <internal>:(.iplt) is being placed in '.iplt'
|
2017-10-25 23:20:30 +08:00
|
|
|
# REPORT-NEXT: <internal>:(.symtab) is being placed in '.symtab'
|
2019-04-12 10:20:52 +08:00
|
|
|
# REPORT-NEXT: <internal>:(.symtab_shndx) is being placed in '.symtab_shndx'
|
2017-10-25 23:20:30 +08:00
|
|
|
# REPORT-NEXT: <internal>:(.shstrtab) is being placed in '.shstrtab'
|
|
|
|
# REPORT-NEXT: <internal>:(.strtab) is being placed in '.strtab'
|
|
|
|
|
|
|
|
## Check --orphan-handling=warn reports warnings about orphans.
|
|
|
|
# RUN: ld.lld -shared --orphan-handling=warn -o %t.out --script %t.script \
|
|
|
|
# RUN: %t.o 2>&1 -verbose | FileCheck %s --check-prefix=REPORT
|
|
|
|
|
2020-02-13 13:48:45 +08:00
|
|
|
# RUN: not ld.lld --orphan-handling=foo -o /dev/null --script %t.script %t.o 2>&1 \
|
2017-10-25 23:20:30 +08:00
|
|
|
# RUN: | FileCheck %s --check-prefix=UNKNOWN
|
|
|
|
# UNKNOWN: unknown --orphan-handling mode: foo
|
2017-09-25 17:41:32 +08:00
|
|
|
|
|
|
|
.section .text.1,"a"
|
|
|
|
nop
|
|
|
|
|
|
|
|
.section .text.2,"a"
|
|
|
|
nop
|