diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-26 11:03:35 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-26 11:03:35 -0700 |
commit | 09797ba54abf3683ea66eedddf6afbe7653f9cb9 (patch) | |
tree | 8030b2ed79c7463c89d6da294782e9d503c84f50 /binutils-2.24/ld/testsuite/ld-metag | |
parent | 5a2caf34e4995860baf405552163df288000b7bf (diff) | |
download | toolchain_binutils-09797ba54abf3683ea66eedddf6afbe7653f9cb9.zip toolchain_binutils-09797ba54abf3683ea66eedddf6afbe7653f9cb9.tar.gz toolchain_binutils-09797ba54abf3683ea66eedddf6afbe7653f9cb9.tar.bz2 |
Initial checkin of binutils 2.24.
Change-Id: I0dfcbae6608dded6c3586bf5f4ac27e9612e70a2
Diffstat (limited to 'binutils-2.24/ld/testsuite/ld-metag')
17 files changed, 391 insertions, 0 deletions
diff --git a/binutils-2.24/ld/testsuite/ld-metag/external.s b/binutils-2.24/ld/testsuite/ld-metag/external.s new file mode 100644 index 0000000..2907e9e --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/external.s @@ -0,0 +1,5 @@ + .text + .global external +external: + nop +
\ No newline at end of file diff --git a/binutils-2.24/ld/testsuite/ld-metag/metag.exp b/binutils-2.24/ld/testsuite/ld-metag/metag.exp new file mode 100644 index 0000000..b817e10 --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/metag.exp @@ -0,0 +1,61 @@ +# Expect script for ld-metag tests +# +# Copyright (C) 2013 Free Software Foundation, Inc. +# Contributed by Imagination Technologies Ltd. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +if {!([istarget "metag-*-*"]) } { + return +} + +# Set up a list as described in ld-lib.exp + +set metag_tests { + {"Meta pc-relative relocs linker test" "" "" "" + { "pcrel.s" "external.s" } + { {objdump -Dz pcrel.d} } + "pcrel" + } + {"Simple PIC shared library" "-shared" "" "" + {shared.s} + { {objdump -fdw shared.d} {objdump -Rw shared.r} } + "shared.so" + } + {"Long branch stub" "" "" "" + {stub.s} + { {objdump -fdw stub.d} } + "stub" + } + {"Shared library for stub tests" "-shared" "" "" + {stub_shared.s} + { {objdump -fdw stub_shared.d} {objdump -Rw stub_shared.r} } + "stub_shared.so" + } + {"Long branch stub (PIC, app)" "tmpdir/stub_shared.so" "" "" + {stub_pic_app.s} + { {objdump -fdw stub_pic_app.d} {objdump -Rw stub_pic_app.r} } + "stub_pic_app" + } + {"Long branch stub (PIC, shared)" "-shared" "" "" + {stub_pic_shared.s} + { {objdump -fdw stub_pic_shared.d} } + "stub_pic_shared.so" + } +} + +run_ld_link_tests $metag_tests diff --git a/binutils-2.24/ld/testsuite/ld-metag/pcrel.d b/binutils-2.24/ld/testsuite/ld-metag/pcrel.d new file mode 100644 index 0000000..59cd4bc --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/pcrel.d @@ -0,0 +1,18 @@ + +.*: file format elf32-metag + +Disassembly of section .text: + +.* <_start>: +.*: ab0000a8 CALLR D0Re0,10005068 <external> +.*: ab000048 CALLR D0Re0,10005060 <global> +.*: ab000048 CALLR D0Re0,10005064 <local> + +.* <global>: +.*: a0fffffe NOP + +.* <local>: +.*: a0fffffe NOP + +.* <external>: +.*: a0fffffe NOP diff --git a/binutils-2.24/ld/testsuite/ld-metag/pcrel.s b/binutils-2.24/ld/testsuite/ld-metag/pcrel.s new file mode 100644 index 0000000..866eefa --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/pcrel.s @@ -0,0 +1,12 @@ + .text + .global _start +_start: + CALLR D0.0, external + CALLR D0.0, global + CALLR D0.0, local + + .global global +global: + nop +local: + nop diff --git a/binutils-2.24/ld/testsuite/ld-metag/shared.d b/binutils-2.24/ld/testsuite/ld-metag/shared.d new file mode 100644 index 0000000..7662dbc --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/shared.d @@ -0,0 +1,41 @@ + +tmpdir/shared.so: file format elf32-metag +architecture: metag, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +.* <.*>: + .*: 82900001 ADDT A0.2,CPC0,#0 + .*: 82120860 ADD A0.2,A0.2,#0x410c + .*: a3100c20 MOV D0Re0,A0.2 + .*: b70001e3 SETL \[A0StP\+\+\],D0Re0,D1Re0 + .*: c600012a GETD PC,\[D0Re0\+#4\] +.* <app_func2@plt>: + .*: 82900001 ADDT A0.2,CPC0,#0 + .*: 82120780 ADD A0.2,A0.2,#0x40f0 + .*: c600806a GETD PC,\[A0.2\] + .*: 03000004 MOV D1Re0,#0 + .*: a0fffee0 B 184 <app_func2@plt-0x14> +Disassembly of section .text: + +.* <lib_func1>: + .*: 00203205 MOV D0FrT,A0FrP + .*: 86080026 ADD A0FrP,A0StP,#0 + .*: b72001e3 SETL \[A0StP\+\+\],D0FrT,D1RtP + .*: b60802e9 SETD \[A0StP\+#8\+\+\],A1LbP + .*: 82000040 ADD A0StP,A0StP,#0x8 + .*: 83880001 ADDT A1LbP,CPC1,#0 + .*: 830b0660 ADD A1LbP,A1LbP,#0x60cc + .*: abfffe94 CALLR D1RtP,198 <app_func2@plt> + .*: a70c018d GETD D0Ar6,\[A1LbP\+#-8180\] + .*: 00000200 ADD D0Re0,D0Re0,D0Ar6 + .*: 01000205 MOV D1Re0,A1LbP + .*: 0307fff9 ADDT D1Re0,D1Re0,#0xffff + .*: 0306ffc0 ADD D1Re0,D1Re0,#0xdff8 + .*: a70ffe64 GETD A1LbP,\[A0StP\+#-16\] + .*: c72041e3 GETL D0FrT,D1RtP,\[A0FrP\+\+\] + .*: 8e004226 SUB A0StP,A0FrP,#0x8 + .*: 80081805 MOV A0FrP,D0FrT + .*: a32008a0 MOV PC,D1RtP diff --git a/binutils-2.24/ld/testsuite/ld-metag/shared.r b/binutils-2.24/ld/testsuite/ld-metag/shared.r new file mode 100644 index 0000000..b03f1af --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/shared.r @@ -0,0 +1,9 @@ + +tmpdir/shared.so: file format elf32-metag + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +.* R_METAG_GLOB_DAT _var1 +.* R_METAG_JMP_SLOT app_func2 + + diff --git a/binutils-2.24/ld/testsuite/ld-metag/shared.s b/binutils-2.24/ld/testsuite/ld-metag/shared.s new file mode 100644 index 0000000..424ad3b --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/shared.s @@ -0,0 +1,28 @@ + .text + + .global lib_func1 + .type lib_func1,function +lib_func1: + MOV D0FrT,A0FrP + ADD A0FrP,A0StP,#0 + SETL [A0StP+#8++],D0.4,D1RtP + SETD [A0StP+#8++],A1LbP + ADD A0StP,A0StP,#8 + ADDT A1LbP,CPC1,#HI(__GLOBAL_OFFSET_TABLE__) + ADD A1LbP,A1LbP,#LO(__GLOBAL_OFFSET_TABLE__+4) + CALLR D1RtP,app_func2@PLT + GETD D0Ar6,[A1LbP+#(_var1@GOT)] + ADD D0Re0,D0Re0,D0Ar6 + MOV D1Re0,A1LbP + ADDT D1Re0,D1Re0,#HI(_local_var1@GOTOFF) + ADD D1Re0,D1Re0,#LO(_local_var1@GOTOFF) + GETD A1LbP,[A0StP+#(-(8+8))] + GETL D0.4,D1RtP,[A0FrP+#8++] + SUB A0StP,A0FrP,#(8) + MOV A0FrP,D0.4 + MOV PC,D1RtP + .size lib_func1,.-lib_func1 + + .data +_local_var1: + .long 0 diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub.d b/binutils-2.24/ld/testsuite/ld-metag/stub.d new file mode 100644 index 0000000..ade4b5e --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub.d @@ -0,0 +1,14 @@ +tmpdir/stub: file format elf32-metag +architecture: metag, flags 0x00000112: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x.* + +Disassembly of section .text: +.* <__start-0x8>: +.*: 82188105 MOVT A0.3,#0x1020 +.*: ac1a8303 JUMP A0.3,#0x5060 +.* <__start>: +.*: abffffd4 CALLR D1RtP,.* <__start-0x8> + \.\.\. +.* <_far>: +.*: a0fffffe NOP diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub.s b/binutils-2.24/ld/testsuite/ld-metag/stub.s new file mode 100644 index 0000000..9fe8c97 --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub.s @@ -0,0 +1,13 @@ + + .text + .global __start +__start: + CALLR D1RtP,_far + + .section .text.pad,"ax" + .space 0x200000 + + .section .text.far,"ax" + .global _far +_far: + NOP diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub_pic_app.d b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_app.d new file mode 100644 index 0000000..7a763b9 --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_app.d @@ -0,0 +1,34 @@ +tmpdir/stub_pic_app: file format elf32-metag +architecture: metag, flags 0x00000112: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +.* <.*>: +.*: 02008105 MOVT D0Re0,#0x1020 +.*: 02049720 ADD D0Re0,D0Re0,#0x92e4 +.*: b70001e3 SETL \[A0StP\+\+\],D0Re0,D1Re0 +.*: c600012a GETD PC,\[D0Re0\+#4\] +.*: a0fffffe NOP +.* <_lib_func@plt>: +.*: 82108105 MOVT A0.2,#0x1020 +.*: 821496e0 ADD A0.2,A0.2,#0x92dc +.*: c600806a GETD PC,\[A0.2\] +.*: 03000004 MOV D1Re0,#0 +.*: a0fffee0 B .* <_lib_func@plt-0x14> +Disassembly of section .text: +.* <__start-0x10>: +.*: 82188105 MOVT A0.3,#0x1020 +.*: ac1a91a3 JUMP A0.3,#0x5234 +.*: 82188105 MOVT A0.3,#0x1020 +.*: ac1a9183 JUMP A0.3,#0x5230 +.* <__start>: +.*: abffff94 CALLR D1RtP,.* <_lib_func@plt\+0x14> +.*: abfffed4 CALLR D1RtP,.* <_lib_func@plt> +.*: abffff94 CALLR D1RtP,.* <_lib_func@plt\+0x1c> + \.\.\. +.* <_far2>: +.*: a0fffffe NOP +.* <_far>: +.*: abfffff4 CALLR D1RtP,.* <_far2> diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub_pic_app.r b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_app.r new file mode 100644 index 0000000..326f508 --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_app.r @@ -0,0 +1,9 @@ + +tmpdir/stub_pic_app: file format elf32-metag + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +.* R_METAG_ADDR32 _lib_data +.* R_METAG_JMP_SLOT _lib_func + + diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub_pic_app.s b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_app.s new file mode 100644 index 0000000..288334f --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_app.s @@ -0,0 +1,25 @@ + + .text + .global __start +__start: + CALLR D1RtP,_far + CALLR D1RtP,_lib_func + CALLR D1RtP,_far2 + + .section .text.pad,"ax" + .space 0x200000 + .global pad_end +pad_end: + .section .text.far,"ax" + .global _far2 +_far2: + NOP +_far: + CALLR D1RtP,_far2@PLT + + .data + .balign 4 + .type _app_data,@object + .size _app_data,4 +_app_data: + .long _lib_data diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub_pic_shared.d b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_shared.d new file mode 100644 index 0000000..41129c3 --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_shared.d @@ -0,0 +1,35 @@ +tmpdir/stub_pic_shared.so: file format elf32-metag +architecture: metag, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +.* <.*>: + .*: 82900101 ADDT A0.2,CPC0,#0x20 + .*: 82120660 ADD A0.2,A0.2,#0x40cc + .*: a3100c20 MOV D0Re0,A0.2 + .*: b70001e3 SETL \[A0StP\+\+\],D0Re0,D1Re0 + .*: c600012a GETD PC,\[D0Re0\+#4\] +.* <_far2@plt>: + .*: 82900101 ADDT A0.2,CPC0,#0x20 + .*: 82120580 ADD A0.2,A0.2,#0x40b0 + .*: c600806a GETD PC,\[A0.2\] + .*: 03000004 MOV D1Re0,#0 + .*: a0fffee0 B .* <_far2@plt-0x14> +Disassembly of section .text: +.* <__start-0xc>: +.*: 82980101 ADDT A0.3,CPC0,#0x20 +.*: 82180100 ADD A0.3,A0.3,#0x20 +.*: a3180ca0 MOV PC,A0.3 +.* <__start>: +.*: abffffb4 CALLR D1RtP,.* <_far2@plt\+0x14> + \.\.\. +.* <pad_end>: +.*: 829ffef9 ADDT A0.3,CPC0,#0xffdf +.*: 821ffee0 ADD A0.3,A0.3,#0xffdc +.*: a3180ca0 MOV PC,A0.3 +.* <_far2>: +.*: a0fffffe NOP +.* <_far>: +.*: abffff94 CALLR D1RtP,.* <pad_end> diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub_pic_shared.s b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_shared.s new file mode 100644 index 0000000..9bf5643 --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub_pic_shared.s @@ -0,0 +1,17 @@ + + .text + .global __start +__start: + CALLR D1RtP,_far + + .section .text.pad,"ax" + .space 0x200000 + .global pad_end +pad_end: + .section .text.far,"ax" + .global _far2 +_far2: + NOP +_far: + CALLR D1RtP,_far2@PLT +
\ No newline at end of file diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub_shared.d b/binutils-2.24/ld/testsuite/ld-metag/stub_shared.d new file mode 100644 index 0000000..e937f1e --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub_shared.d @@ -0,0 +1,36 @@ + +tmpdir/stub_shared.so: file format elf32-metag +architecture: metag, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +.* <.*>: + .*: 82900001 ADDT A0.2,CPC0,#0 + .*: 82120700 ADD A0.2,A0.2,#0x40e0 + .*: a3100c20 MOV D0Re0,A0.2 + .*: b70001e3 SETL \[A0StP\+\+\],D0Re0,D1Re0 + .*: c600012a GETD PC,\[D0Re0\+#4\] +.* <_far2@plt>: + .*: 82900001 ADDT A0.2,CPC0,#0 + .*: 82120620 ADD A0.2,A0.2,#0x40c4 + .*: c600806a GETD PC,\[A0.2\] + .*: 03000004 MOV D1Re0,#0 + .*: a0fffee0 B .* <_far2@plt-0x14> +Disassembly of section .text: + +.* <_lib_func>: + .*: 00203205 MOV D0FrT,A0FrP + .*: 86080026 ADD A0FrP,A0StP,#0 + .*: b72001e3 SETL \[A0StP\+\+\],D0FrT,D1RtP + .*: b60802e9 SETD \[A0StP\+#8\+\+\],A1LbP + .*: 82000040 ADD A0StP,A0StP,#0x8 + .*: 83880001 ADDT A1LbP,CPC1,#0 + .*: 830b0500 ADD A1LbP,A1LbP,#0x60a0 + .*: abfffe94 CALLR D1RtP,.* <_far2@plt> + .*: a70ffe64 GETD A1LbP,\[A0StP\+#-16\] + .*: c72041e3 GETL D0FrT,D1RtP,\[A0FrP\+\+\] + .*: 8e004226 SUB A0StP,A0FrP,#0x8 + .*: 80081805 MOV A0FrP,D0FrT + .*: a32008a0 MOV PC,D1RtP diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub_shared.r b/binutils-2.24/ld/testsuite/ld-metag/stub_shared.r new file mode 100644 index 0000000..8930c63 --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub_shared.r @@ -0,0 +1,8 @@ + +tmpdir/stub_shared.so: file format elf32-metag + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +.* R_METAG_JMP_SLOT _far2 + + diff --git a/binutils-2.24/ld/testsuite/ld-metag/stub_shared.s b/binutils-2.24/ld/testsuite/ld-metag/stub_shared.s new file mode 100644 index 0000000..1bd72ee --- /dev/null +++ b/binutils-2.24/ld/testsuite/ld-metag/stub_shared.s @@ -0,0 +1,26 @@ + .text + .global _lib_func + .type _lib_func,function +_lib_func: + MOV D0FrT,A0FrP + ADD A0FrP,A0StP,#0 + SETL [A0StP+#8++],D0.4,D1RtP + SETD [A0StP+#8++],A1LbP + ADD A0StP,A0StP,#8 + ADDT A1LbP,CPC1,#HI(__GLOBAL_OFFSET_TABLE__) + ADD A1LbP,A1LbP,#LO(__GLOBAL_OFFSET_TABLE__+4) + CALLR D1RtP,_far2@PLT + GETD A1LbP,[A0StP+#(-(8+8))] + GETL D0.4,D1RtP,[A0FrP+#8++] + SUB A0StP,A0FrP,#(8) + MOV A0FrP,D0.4 + MOV PC,D1RtP + .size _lib_func,.-_lib_func + + .data + .balign 4 + .type _lib_data,@object + .size _lib_data,4 + .global _lib_data +_lib_data: + .long 0 |