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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 04:11:22 PDT 2017


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

- Updated according to my last comment.


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:      orphan input section '.text' assigned to output section '.text'
+# CHECK-NEXT: orphan input section '.text.2' assigned to output section '.text'
+# CHECK-NEXT: linker generated section '.comment' assigned to output section '.comment'
+# CHECK-NEXT: linker generated section '.bss' assigned to output section '.bss'
+# CHECK-NEXT: linker generated section '.bss.rel.ro' assigned to output section '.bss.rel.ro'
+# CHECK-NEXT: linker generated section '.dynsym' assigned to output section '.dynsym'
+# CHECK-NEXT: linker generated section '.gnu.version' assigned to output section '.gnu.version'
+# CHECK-NEXT: linker generated section '.gnu.version_r' assigned to output section '.gnu.version_r'
+# CHECK-NEXT: linker generated section '.hash' assigned to output section '.hash'
+# CHECK-NEXT: linker generated section '.dynamic' assigned to output section '.dynamic'
+# CHECK-NEXT: linker generated section '.dynstr' assigned to output section '.dynstr'
+# CHECK-NEXT: linker generated section '.rela.dyn' assigned to output section '.rela.dyn'
+# CHECK-NEXT: linker generated section '.got' assigned to output section '.got'
+# CHECK-NEXT: linker generated section '.got.plt' assigned to output section '.got.plt'
+# CHECK-NEXT: linker generated section '.got.plt' assigned to output section '.got.plt'
+# CHECK-NEXT: linker generated section '.rela.plt' assigned to output section '.rela.plt'
+# CHECK-NEXT: linker generated section '.rela.plt' assigned to output section '.rela.plt'
+# CHECK-NEXT: linker generated section '.plt' assigned to output section '.plt'
+# CHECK-NEXT: linker generated section '.plt' assigned to output section '.plt'
+# CHECK-NEXT: linker generated section '.eh_frame' assigned to output section '.eh_frame'
+# CHECK-NEXT: linker generated section '.symtab' assigned to output section '.symtab'
+# CHECK-NEXT: linker generated section '.shstrtab' assigned to output section '.shstrtab'
+# CHECK-NEXT: linker generated section '.strtab' assigned to output section '.strtab'
+
+.section .text.1,"a"
+ nop
+
+.section .text.2,"a"
+ nop
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -469,6 +469,9 @@
         return Sec->Name == Name;
       return false;
     });
+    log((isa<SyntheticSection>(S) ? "linker generated section '"
+                                  : "orphan input section '") +
+        S->Name + "' assigned to output section '" + Name + "'");
     if (I == End) {
       Factory.addInputSec(S, Name);
       assert(S->getOutputSection()->SectionIndex == INT_MAX);


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


More information about the llvm-commits mailing list