[PATCH] D24725: [ELF] - Linkerscript: report orphans if --verbose used.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 08:39:16 PDT 2016


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

- Updated patch to let it report linker generated orphan sections just like ld do.


https://reviews.llvm.org/D24725

Files:
  ELF/LinkerScript.cpp
  test/ELF/orphan-handling.s

Index: test/ELF/orphan-handling.s
===================================================================
--- test/ELF/orphan-handling.s
+++ test/ELF/orphan-handling.s
@@ -0,0 +1,24 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: echo "SECTIONS { .foo.1 : { *(.foo.1) } }" > %t.script
+
+# RUN: ld.lld -shared -o %t.out --script %t.script %t.o --verbose | FileCheck %s
+# CHECK: unplaced orphan section .foo.2
+# CHECK: unplaced orphan section .dynsym
+# CHECK: unplaced orphan section .hash
+# CHECK: unplaced orphan section .dynstr
+# CHECK: unplaced orphan section .text
+# CHECK: unplaced orphan section .dynamic
+# CHECK: unplaced orphan section .symtab
+# CHECK: unplaced orphan section .shstrtab
+# CHECK: unplaced orphan section .strtab
+
+.text
+.globl _start
+_start:
+
+.section .foo.1,"a"
+ .quad 1
+
+.section .foo.2,"a"
+ .quad 2
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -566,6 +566,7 @@
     if (Pos == E) {
       Opt.Commands.insert(CmdIter,
                           llvm::make_unique<OutputSectionCommand>(Name));
+      elf::log("unplaced orphan section " + Name);
       ++CmdIndex;
       continue;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24725.72495.patch
Type: text/x-patch
Size: 1283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160926/5dd4c230/attachment.bin>


More information about the llvm-commits mailing list