[PATCH] D22215: [ELF] Test case correct input section ordering, when sections are listed in linker script

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 03:15:16 PDT 2016


evgeny777 retitled this revision from "[ELF] Implement correct input section ordering, when sections are listed in linker script" to "[ELF] Test case correct input section ordering, when sections are listed in linker script".
evgeny777 edited subscribers, added: llvm-commits; removed: ruiu.
evgeny777 removed rL LLVM as the repository for this revision.
evgeny777 updated this revision to Diff 65044.
evgeny777 added a comment.

Input section order problem was fixed by 
https://reviews.llvm.org/D22455
and
https://reviews.llvm.org/D22617

This patch adds test case, so it won't be broken occasionally


https://reviews.llvm.org/D22215

Files:
  test/ELF/linkerscript-input-order.s

Index: test/ELF/linkerscript-input-order.s
===================================================================
--- test/ELF/linkerscript-input-order.s
+++ test/ELF/linkerscript-input-order.s
@@ -0,0 +1,38 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+
+# This test case should place input sections in script order: 
+# .foo.1 .foo.2 .bar.1 .bar.2
+# RUN: echo "SECTIONS { . = 0x1000; .foo : {*(.foo.*) *(.bar.*)  } }" > %t.script
+# RUN: ld.lld -o %t1 --script %t.script %t
+# RUN: llvm-objdump -section=.foo -s %t1 | FileCheck --check-prefix=SCRIPT_ORDER %s
+# SCRIPT_ORDER: Contents of section .foo:
+# SCRIPT_ORDER-NEXT: 1000 00000000 00000000 ffffffff eeeeeeee
+
+# This test case should place input sections in native order:
+# .bar.1 .foo.1 .bar.2 .foo.2
+# RUN: echo "SECTIONS { . = 0x1000; .foo : {*(.foo.* .bar.*)} }" > %t.script
+# RUN: ld.lld -o %t1 --script %t.script %t
+# RUN: llvm-objdump -section=.foo -s %t1 | FileCheck --check-prefix=FILE_ORDER %s
+# FILE_ORDER: Contents of section .foo:
+# FILE_ORDER-NEXT: 1000 ffffffff 00000000 eeeeeeee 00000000
+
+.global _start
+_start:
+ nop
+
+.section .bar.1,"a"
+bar1:
+ .long 0xFFFFFFFF
+
+.section .foo.1,"a"
+foo1:
+ .long 0
+
+.section .bar.2,"a"
+bar2:
+ .long 0xEEEEEEEE
+
+.section .foo.2,"a"
+foo2:
+ .long 0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22215.65044.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160722/ce1875fb/attachment.bin>


More information about the llvm-commits mailing list