[PATCH] D43632: [ELF] - Add testcase documenting flags assigned when empty synthetic section is removed.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 23 01:59:36 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL325873: [ELF] - Add testcase documenting flags assigned when empty synthetic section is… (authored by grimar, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43632?vs=135447&id=135601#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43632

Files:
  lld/trunk/test/ELF/linkerscript/empty-synthetic-removed-flags.s


Index: lld/trunk/test/ELF/linkerscript/empty-synthetic-removed-flags.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/empty-synthetic-removed-flags.s
+++ lld/trunk/test/ELF/linkerscript/empty-synthetic-removed-flags.s
@@ -0,0 +1,28 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: echo "SECTIONS { .foo : { *(.foo) } .bar : { *(.got.plt) BYTE(0x11) }}" > %t.script
+# RUN: ld.lld -o %t --script %t.script %t.o
+# RUN: llvm-readobj -s %t | FileCheck %s
+
+## We have ".got.plt" synthetic section with SHF_ALLOC|SHF_WRITE flags.
+## It is empty, so linker removes it, but it have to keep ".got.plt" output
+## section because of BYTE command. Here we check that result output section
+## gets the same flags as previous allocatable section and does not get
+## SHF_WRITE flag from removed syntethic input section.
+
+# CHECK:     Section {
+# CHECK:       Index: 2
+# CHECK:       Name: .bar
+# CHECK-NEXT:  Type: SHT_PROGBITS
+# CHECK-NEXT:  Flags [
+# CHECK-NEXT:    SHF_ALLOC
+# CHECK-NEXT:    SHF_EXECINSTR
+# CHECK-NEXT:  ]
+
+## Check flags are the same if we omit empty synthetic section in script.
+# RUN: echo "SECTIONS { .foo : { *(.foo) } .bar : { BYTE(0x11) }}" > %t.script
+# RUN: ld.lld -o %t --script %t.script %t.o
+# RUN: llvm-readobj -s %t | FileCheck %s
+
+.section .foo,"ax"
+.quad 0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43632.135601.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180223/71cf538a/attachment.bin>


More information about the llvm-commits mailing list