aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-01-11 09:53:22 +0000
committerNick Clifton <nickc@redhat.com>2013-01-11 09:53:22 +0000
commit2624489484a04ee8f1af5bbcf2a61bdb9134e5ad (patch)
treeb644121dc3e8aa096c1944ed757c7d3975540aa6 /ld
parent5817ffd1f81cf2d2ae173071775e6e620aa41283 (diff)
downloadgdb-2624489484a04ee8f1af5bbcf2a61bdb9134e5ad.zip
gdb-2624489484a04ee8f1af5bbcf2a61bdb9134e5ad.tar.gz
gdb-2624489484a04ee8f1af5bbcf2a61bdb9134e5ad.tar.bz2
oops - omitted from previous delta
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ld-metag/external.s5
-rw-r--r--ld/testsuite/ld-metag/metag.exp61
-rw-r--r--ld/testsuite/ld-metag/pcrel.d18
-rw-r--r--ld/testsuite/ld-metag/pcrel.s12
-rw-r--r--ld/testsuite/ld-metag/shared.d41
-rw-r--r--ld/testsuite/ld-metag/shared.r9
-rw-r--r--ld/testsuite/ld-metag/shared.s28
-rw-r--r--ld/testsuite/ld-metag/stub.d14
-rw-r--r--ld/testsuite/ld-metag/stub.s13
-rw-r--r--ld/testsuite/ld-metag/stub_pic_app.d34
-rw-r--r--ld/testsuite/ld-metag/stub_pic_app.r9
-rw-r--r--ld/testsuite/ld-metag/stub_pic_app.s25
-rw-r--r--ld/testsuite/ld-metag/stub_pic_shared.d35
-rw-r--r--ld/testsuite/ld-metag/stub_pic_shared.s17
-rw-r--r--ld/testsuite/ld-metag/stub_shared.d36
-rw-r--r--ld/testsuite/ld-metag/stub_shared.r8
-rw-r--r--ld/testsuite/ld-metag/stub_shared.s26
17 files changed, 391 insertions, 0 deletions
diff --git a/ld/testsuite/ld-metag/external.s b/ld/testsuite/ld-metag/external.s
new file mode 100644
index 0000000..2907e9e
--- /dev/null
+++ b/ld/testsuite/ld-metag/external.s
@@ -0,0 +1,5 @@
+ .text
+ .global external
+external:
+ nop
+ \ No newline at end of file
diff --git a/ld/testsuite/ld-metag/metag.exp b/ld/testsuite/ld-metag/metag.exp
new file mode 100644
index 0000000..928703d
--- /dev/null
+++ b/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/ld/testsuite/ld-metag/pcrel.d b/ld/testsuite/ld-metag/pcrel.d
new file mode 100644
index 0000000..dd2fda2
--- /dev/null
+++ b/ld/testsuite/ld-metag/pcrel.d
@@ -0,0 +1,18 @@
+
+.*: file format elf32-metag
+
+Disassembly of section .text:
+
+.* <_start>:
+.*: a8 00 00 ab CALLR D0Re0,10005068 <external>
+.*: 48 00 00 ab CALLR D0Re0,10005060 <global>
+.*: 48 00 00 ab CALLR D0Re0,10005064 <local>
+
+.* <global>:
+.*: fe ff ff a0 NOP
+
+.* <local>:
+.*: fe ff ff a0 NOP
+
+.* <external>:
+.*: fe ff ff a0 NOP
diff --git a/ld/testsuite/ld-metag/pcrel.s b/ld/testsuite/ld-metag/pcrel.s
new file mode 100644
index 0000000..866eefa
--- /dev/null
+++ b/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/ld/testsuite/ld-metag/shared.d b/ld/testsuite/ld-metag/shared.d
new file mode 100644
index 0000000..a01b5a5
--- /dev/null
+++ b/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:
+
+.* <.*>:
+ .*: 01 00 90 82 ADDT A0.2,CPC0,#0
+ .*: 60 08 12 82 ADD A0.2,A0.2,#0x410c
+ .*: 20 0c 10 a3 MOV D0Re0,A0.2
+ .*: e3 01 00 b7 SETL \[A0StP\+\+\],D0Re0,D1Re0
+ .*: 2a 01 00 c6 GETD PC,\[D0Re0\+#4\]
+.* <app_func2@plt>:
+ .*: 01 00 90 82 ADDT A0.2,CPC0,#0
+ .*: 80 07 12 82 ADD A0.2,A0.2,#0x40f0
+ .*: 6a 80 00 c6 GETD PC,\[A0.2\]
+ .*: 04 00 00 03 MOV D1Re0,#0
+ .*: e0 fe ff a0 B 184 <app_func2@plt-0x14>
+Disassembly of section .text:
+
+.* <lib_func1>:
+ .*: 05 32 20 00 MOV D0FrT,A0FrP
+ .*: 26 00 08 86 ADD A0FrP,A0StP,#0
+ .*: e3 01 20 b7 SETL \[A0StP\+\+\],D0FrT,D1RtP
+ .*: e9 02 08 b6 SETD \[A0StP\+#8\+\+\],A1LbP
+ .*: 40 00 00 82 ADD A0StP,A0StP,#0x8
+ .*: 01 00 88 83 ADDT A1LbP,CPC1,#0
+ .*: 60 06 0b 83 ADD A1LbP,A1LbP,#0x60cc
+ .*: 94 fe ff ab CALLR D1RtP,198 <app_func2@plt>
+ .*: 8d 01 0c a7 GETD D0Ar6,\[A1LbP\+#-8180\]
+ .*: 00 02 00 00 ADD D0Re0,D0Re0,D0Ar6
+ .*: 05 02 00 01 MOV D1Re0,A1LbP
+ .*: f9 ff 07 03 ADDT D1Re0,D1Re0,#0xffff
+ .*: c0 ff 06 03 ADD D1Re0,D1Re0,#0xdff8
+ .*: 64 fe 0f a7 GETD A1LbP,\[A0StP\+#-16\]
+ .*: e3 41 20 c7 GETL D0FrT,D1RtP,\[A0FrP\+\+\]
+ .*: 26 42 00 8e SUB A0StP,A0FrP,#0x8
+ .*: 05 18 08 80 MOV A0FrP,D0FrT
+ .*: a0 08 20 a3 MOV PC,D1RtP
diff --git a/ld/testsuite/ld-metag/shared.r b/ld/testsuite/ld-metag/shared.r
new file mode 100644
index 0000000..b03f1af
--- /dev/null
+++ b/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/ld/testsuite/ld-metag/shared.s b/ld/testsuite/ld-metag/shared.s
new file mode 100644
index 0000000..424ad3b
--- /dev/null
+++ b/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/ld/testsuite/ld-metag/stub.d b/ld/testsuite/ld-metag/stub.d
new file mode 100644
index 0000000..c9abb2a
--- /dev/null
+++ b/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>:
+.*: 05 81 18 82 MOVT A0.3,#0x1020
+.*: 03 83 1a ac JUMP A0.3,#0x5060
+.* <__start>:
+.*: d4 ff ff ab CALLR D1RtP,.* <__start-0x8>
+ \.\.\.
+.* <_far>:
+.*: fe ff ff a0 NOP
diff --git a/ld/testsuite/ld-metag/stub.s b/ld/testsuite/ld-metag/stub.s
new file mode 100644
index 0000000..9fe8c97
--- /dev/null
+++ b/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/ld/testsuite/ld-metag/stub_pic_app.d b/ld/testsuite/ld-metag/stub_pic_app.d
new file mode 100644
index 0000000..3242fb2
--- /dev/null
+++ b/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:
+
+.* <.*>:
+.*: 05 81 00 02 MOVT D0Re0,#0x1020
+.*: 20 97 04 02 ADD D0Re0,D0Re0,#0x92e4
+.*: e3 01 00 b7 SETL \[A0StP\+\+\],D0Re0,D1Re0
+.*: 2a 01 00 c6 GETD PC,\[D0Re0\+#4\]
+.*: fe ff ff a0 NOP
+.* <_lib_func@plt>:
+.*: 05 81 10 82 MOVT A0.2,#0x1020
+.*: e0 96 14 82 ADD A0.2,A0.2,#0x92dc
+.*: 6a 80 00 c6 GETD PC,\[A0.2\]
+.*: 04 00 00 03 MOV D1Re0,#0
+.*: e0 fe ff a0 B .* <_lib_func@plt-0x14>
+Disassembly of section .text:
+.* <__start-0x10>:
+.*: 05 81 18 82 MOVT A0.3,#0x1020
+.*: a3 91 1a ac JUMP A0.3,#0x5234
+.*: 05 81 18 82 MOVT A0.3,#0x1020
+.*: 83 91 1a ac JUMP A0.3,#0x5230
+.* <__start>:
+.*: 94 ff ff ab CALLR D1RtP,.* <_lib_func@plt\+0x14>
+.*: d4 fe ff ab CALLR D1RtP,.* <_lib_func@plt>
+.*: 94 ff ff ab CALLR D1RtP,.* <_lib_func@plt\+0x1c>
+ \.\.\.
+.* <_far2>:
+.*: fe ff ff a0 NOP
+.* <_far>:
+.*: f4 ff ff ab CALLR D1RtP,.* <_far2>
diff --git a/ld/testsuite/ld-metag/stub_pic_app.r b/ld/testsuite/ld-metag/stub_pic_app.r
new file mode 100644
index 0000000..326f508
--- /dev/null
+++ b/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/ld/testsuite/ld-metag/stub_pic_app.s b/ld/testsuite/ld-metag/stub_pic_app.s
new file mode 100644
index 0000000..288334f
--- /dev/null
+++ b/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/ld/testsuite/ld-metag/stub_pic_shared.d b/ld/testsuite/ld-metag/stub_pic_shared.d
new file mode 100644
index 0000000..0186186
--- /dev/null
+++ b/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:
+
+.* <.*>:
+ .*: 01 01 90 82 ADDT A0.2,CPC0,#0x20
+ .*: 60 06 12 82 ADD A0.2,A0.2,#0x40cc
+ .*: 20 0c 10 a3 MOV D0Re0,A0.2
+ .*: e3 01 00 b7 SETL \[A0StP\+\+\],D0Re0,D1Re0
+ .*: 2a 01 00 c6 GETD PC,\[D0Re0\+#4\]
+.* <_far2@plt>:
+ .*: 01 01 90 82 ADDT A0.2,CPC0,#0x20
+ .*: 80 05 12 82 ADD A0.2,A0.2,#0x40b0
+ .*: 6a 80 00 c6 GETD PC,\[A0.2\]
+ .*: 04 00 00 03 MOV D1Re0,#0
+ .*: e0 fe ff a0 B .* <_far2@plt-0x14>
+Disassembly of section .text:
+.* <__start-0xc>:
+.*: 01 01 98 82 ADDT A0.3,CPC0,#0x20
+.*: 00 01 18 82 ADD A0.3,A0.3,#0x20
+.*: a0 0c 18 a3 MOV PC,A0.3
+.* <__start>:
+.*: b4 ff ff ab CALLR D1RtP,.* <_far2@plt\+0x14>
+ \.\.\.
+.* <pad_end>:
+.*: f9 fe 9f 82 ADDT A0.3,CPC0,#0xffdf
+.*: e0 fe 1f 82 ADD A0.3,A0.3,#0xffdc
+.*: a0 0c 18 a3 MOV PC,A0.3
+.* <_far2>:
+.*: fe ff ff a0 NOP
+.* <_far>:
+.*: 94 ff ff ab CALLR D1RtP,.* <pad_end>
diff --git a/ld/testsuite/ld-metag/stub_pic_shared.s b/ld/testsuite/ld-metag/stub_pic_shared.s
new file mode 100644
index 0000000..9bf5643
--- /dev/null
+++ b/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/ld/testsuite/ld-metag/stub_shared.d b/ld/testsuite/ld-metag/stub_shared.d
new file mode 100644
index 0000000..8b4a5cc
--- /dev/null
+++ b/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:
+
+.* <.*>:
+ .*: 01 00 90 82 ADDT A0.2,CPC0,#0
+ .*: 00 07 12 82 ADD A0.2,A0.2,#0x40e0
+ .*: 20 0c 10 a3 MOV D0Re0,A0.2
+ .*: e3 01 00 b7 SETL \[A0StP\+\+\],D0Re0,D1Re0
+ .*: 2a 01 00 c6 GETD PC,\[D0Re0\+#4\]
+.* <_far2@plt>:
+ .*: 01 00 90 82 ADDT A0.2,CPC0,#0
+ .*: 20 06 12 82 ADD A0.2,A0.2,#0x40c4
+ .*: 6a 80 00 c6 GETD PC,\[A0.2\]
+ .*: 04 00 00 03 MOV D1Re0,#0
+ .*: e0 fe ff a0 B .* <_far2@plt-0x14>
+Disassembly of section .text:
+
+.* <_lib_func>:
+ .*: 05 32 20 00 MOV D0FrT,A0FrP
+ .*: 26 00 08 86 ADD A0FrP,A0StP,#0
+ .*: e3 01 20 b7 SETL \[A0StP\+\+\],D0FrT,D1RtP
+ .*: e9 02 08 b6 SETD \[A0StP\+#8\+\+\],A1LbP
+ .*: 40 00 00 82 ADD A0StP,A0StP,#0x8
+ .*: 01 00 88 83 ADDT A1LbP,CPC1,#0
+ .*: 00 05 0b 83 ADD A1LbP,A1LbP,#0x60a0
+ .*: 94 fe ff ab CALLR D1RtP,.* <_far2@plt>
+ .*: 64 fe 0f a7 GETD A1LbP,\[A0StP\+#-16\]
+ .*: e3 41 20 c7 GETL D0FrT,D1RtP,\[A0FrP\+\+\]
+ .*: 26 42 00 8e SUB A0StP,A0FrP,#0x8
+ .*: 05 18 08 80 MOV A0FrP,D0FrT
+ .*: a0 08 20 a3 MOV PC,D1RtP
diff --git a/ld/testsuite/ld-metag/stub_shared.r b/ld/testsuite/ld-metag/stub_shared.r
new file mode 100644
index 0000000..8930c63
--- /dev/null
+++ b/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/ld/testsuite/ld-metag/stub_shared.s b/ld/testsuite/ld-metag/stub_shared.s
new file mode 100644
index 0000000..1bd72ee
--- /dev/null
+++ b/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