[ELF] - Report orphan sections if -verbose given.

When -verbose is specified, patch outputs names of each input orphan section
assigned to output.

Differential revision: https://reviews.llvm.org/D37517

llvm-svn: 314098
This commit is contained in:
George Rimar 2017-09-25 09:41:32 +00:00
parent d28c26bbdd
commit 347c70d782
2 changed files with 35 additions and 0 deletions

View File

@ -460,6 +460,7 @@ void LinkerScript::addOrphanSections(OutputSectionFactory &Factory) {
return Sec->Name == Name;
return false;
});
log(toString(S) + " is being placed in '" + Name + "'");
if (I == End) {
Factory.addInputSec(S, Name);
assert(S->getOutputSection()->SectionIndex == INT_MAX);

View File

@ -0,0 +1,34 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: echo "SECTIONS { .text : { *(.text.1) } }" > %t.script
# RUN: ld.lld -shared -o %t.out --script %t.script %t.o --verbose | FileCheck %s
# CHECK: {{.*}}.o:(.text) is being placed in '.text'
# CHECK-NEXT: {{.*}}.o:(.text.2) is being placed in '.text'
# CHECK-NEXT: <internal>:(.comment) is being placed in '.comment'
# CHECK-NEXT: <internal>:(.bss) is being placed in '.bss'
# CHECK-NEXT: <internal>:(.bss.rel.ro) is being placed in '.bss.rel.ro'
# CHECK-NEXT: <internal>:(.dynsym) is being placed in '.dynsym'
# CHECK-NEXT: <internal>:(.gnu.version) is being placed in '.gnu.version'
# CHECK-NEXT: <internal>:(.gnu.version_r) is being placed in '.gnu.version_r'
# CHECK-NEXT: <internal>:(.hash) is being placed in '.hash'
# CHECK-NEXT: <internal>:(.dynamic) is being placed in '.dynamic'
# CHECK-NEXT: <internal>:(.dynstr) is being placed in '.dynstr'
# CHECK-NEXT: <internal>:(.rela.dyn) is being placed in '.rela.dyn'
# CHECK-NEXT: <internal>:(.got) is being placed in '.got'
# CHECK-NEXT: <internal>:(.got.plt) is being placed in '.got.plt'
# CHECK-NEXT: <internal>:(.got.plt) is being placed in '.got.plt'
# CHECK-NEXT: <internal>:(.rela.plt) is being placed in '.rela.plt'
# CHECK-NEXT: <internal>:(.rela.plt) is being placed in '.rela.plt'
# CHECK-NEXT: <internal>:(.plt) is being placed in '.plt'
# CHECK-NEXT: <internal>:(.plt) is being placed in '.plt'
# CHECK-NEXT: <internal>:(.eh_frame) is being placed in '.eh_frame'
# CHECK-NEXT: <internal>:(.symtab) is being placed in '.symtab'
# CHECK-NEXT: <internal>:(.shstrtab) is being placed in '.shstrtab'
# CHECK-NEXT: <internal>:(.strtab) is being placed in '.strtab'
.section .text.1,"a"
nop
.section .text.2,"a"
nop