[PATCH] D37517: [ELF] - Report orphan sections if -verbose given.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 01:56:36 PDT 2017


grimar updated this revision to Diff 115610.
grimar added a comment.

- Addressed review comments.


https://reviews.llvm.org/D37517

Files:
  ELF/LinkerScript.cpp
  test/ELF/linkerscript/orphan-report.s


Index: test/ELF/linkerscript/orphan-report.s
===================================================================
--- test/ELF/linkerscript/orphan-report.s
+++ 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: <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
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -469,6 +469,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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37517.115610.patch
Type: text/x-patch
Size: 2439 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170918/ea391e34/attachment.bin>


More information about the llvm-commits mailing list