Index: lld/trunk/ELF/LinkerScript.cpp =================================================================== --- lld/trunk/ELF/LinkerScript.cpp +++ lld/trunk/ELF/LinkerScript.cpp @@ -460,6 +460,7 @@ 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); Index: lld/trunk/test/ELF/linkerscript/orphan-report.s =================================================================== --- lld/trunk/test/ELF/linkerscript/orphan-report.s +++ lld/trunk/test/ELF/linkerscript/orphan-report.s @@ -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: :(.comment) is being placed in '.comment' +# CHECK-NEXT: :(.bss) is being placed in '.bss' +# CHECK-NEXT: :(.bss.rel.ro) is being placed in '.bss.rel.ro' +# CHECK-NEXT: :(.dynsym) is being placed in '.dynsym' +# CHECK-NEXT: :(.gnu.version) is being placed in '.gnu.version' +# CHECK-NEXT: :(.gnu.version_r) is being placed in '.gnu.version_r' +# CHECK-NEXT: :(.hash) is being placed in '.hash' +# CHECK-NEXT: :(.dynamic) is being placed in '.dynamic' +# CHECK-NEXT: :(.dynstr) is being placed in '.dynstr' +# CHECK-NEXT: :(.rela.dyn) is being placed in '.rela.dyn' +# CHECK-NEXT: :(.got) is being placed in '.got' +# CHECK-NEXT: :(.got.plt) is being placed in '.got.plt' +# CHECK-NEXT: :(.got.plt) is being placed in '.got.plt' +# CHECK-NEXT: :(.rela.plt) is being placed in '.rela.plt' +# CHECK-NEXT: :(.rela.plt) is being placed in '.rela.plt' +# CHECK-NEXT: :(.plt) is being placed in '.plt' +# CHECK-NEXT: :(.plt) is being placed in '.plt' +# CHECK-NEXT: :(.eh_frame) is being placed in '.eh_frame' +# CHECK-NEXT: :(.symtab) is being placed in '.symtab' +# CHECK-NEXT: :(.shstrtab) is being placed in '.shstrtab' +# CHECK-NEXT: :(.strtab) is being placed in '.strtab' + +.section .text.1,"a" + nop + +.section .text.2,"a" + nop