diff options
| author | Eugene Leviant <evgeny.leviant@gmail.com> | 2016-07-25 10:59:20 +0000 |
|---|---|---|
| committer | Eugene Leviant <evgeny.leviant@gmail.com> | 2016-07-25 10:59:20 +0000 |
| commit | 1823d6c8af4168c0a89c5bde9fa24166c3085e8a (patch) | |
| tree | 1d80266871f1f9a9173c750fc3dffcfa79220dd4 | |
| parent | d5ca0a65b5075cd7ac46aca89e1b1f905c72922a (diff) | |
| download | bcm5719-llvm-1823d6c8af4168c0a89c5bde9fa24166c3085e8a.tar.gz bcm5719-llvm-1823d6c8af4168c0a89c5bde9fa24166c3085e8a.zip | |
[ELF] Test case for correct input section order, when sections are listed in linker script
llvm-svn: 276630
| -rw-r--r-- | lld/test/ELF/linkerscript/linkerscript-input-order.s | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lld/test/ELF/linkerscript/linkerscript-input-order.s b/lld/test/ELF/linkerscript/linkerscript-input-order.s new file mode 100644 index 00000000000..5e6f1a7c15c --- /dev/null +++ b/lld/test/ELF/linkerscript/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 |

