diff options
author | Paul Iannetta <piannetta@kalrayinc.com> | 2023-08-16 14:22:28 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2023-08-16 14:22:54 +0100 |
commit | 6e712424f5cb1f01acf41c21f8721ee028c2a20c (patch) | |
tree | e385426177cc05115d8f5d69df67c6933ddfe6c3 /ld/testsuite/ld-kvx | |
parent | 7d6a2e34ee8eb061cf73014efefefaa074b499db (diff) | |
download | gdb-6e712424f5cb1f01acf41c21f8721ee028c2a20c.zip gdb-6e712424f5cb1f01acf41c21f8721ee028c2a20c.tar.gz gdb-6e712424f5cb1f01acf41c21f8721ee028c2a20c.tar.bz2 |
kvx: New port.
Diffstat (limited to 'ld/testsuite/ld-kvx')
35 files changed, 870 insertions, 0 deletions
diff --git a/ld/testsuite/ld-kvx/farcall-back.d b/ld/testsuite/ld-kvx/farcall-back.d new file mode 100644 index 0000000..c17dda7 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-back.d @@ -0,0 +1,79 @@ +#name: kvx-farcall-back +#source: farcall-back.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x80001000 +#objdump: -dr + +#... + +Disassembly of section .text: + +.* <_start>: + .*: .. .. .. .. call .* <__bar1_veneer>;; + + .*: .. .. .. .. goto .* <__bar1_veneer>;; + + .*: .. .. .. .. call .* <__bar2_veneer>;; + + .*: .. .. .. .. goto .* <__bar2_veneer>;; + + .*: .. .. .. .. call .* <__bar3_veneer>;; + + .*: .. .. .. .. goto .* <__bar3_veneer>;; + + .*: 00 00 d0 0f ret;; + + ... + +.* <_back>: + .*: 00 00 d0 0f ret;; + +.* <__bar3_veneer>: + .*: 00 .. 40 e0 0c 00 20 00 make \$r16 = .* \(0x.*\);; + + .*: 10 00 d8 0f igoto \$r16;; + +.* <__bar2_veneer>: + .*: 00 .. 40 e0 08 00 20 00 make \$r16 = .* \(0x.*\);; + + .*: 10 00 d8 0f igoto \$r16;; + +.* <__bar1_veneer>: + .*: 00 .. 40 e0 04 00 20 00 make \$r16 = .* \(0x.*\);; + + .*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .foo: + +.* <bar1>: +.*: 00 00 d0 0f ret;; + +.*: .. .. .. .. goto .* <___start_veneer>;; + + ... + +.* <bar2>: +.*: 00 00 d0 0f ret;; + +.*: .. .. .. .. goto .* <___start_veneer>;; + + ... + +.* <bar3>: +.*: 00 00 d0 0f ret;; + +.*: .. .. .. .. goto .* <___back_veneer>;; + + +.* <___start_veneer>: +.*: 00 .. 40 e0 04 00 00 00 make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +.* <___back_veneer>: +.*: 00 .. 40 e0 08 00 00 00 make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + + diff --git a/ld/testsuite/ld-kvx/farcall-back.s b/ld/testsuite/ld-kvx/farcall-back.s new file mode 100644 index 0000000..582d39d --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-back.s @@ -0,0 +1,54 @@ + .global _start + .global _back + .global bar1 + .global bar2 + .global bar3 + +# We will place the section .text at 0x1000. + + .text + + .type _start, @function +_start: + call bar1 + ;; + goto bar1 + ;; + call bar2 + ;; + goto bar2 + ;; + call bar3 + ;; + goto bar3 + ;; + ret + ;; + .space 0x1000 + .type _back, @function +_back: ret + ;; + +# We will place the section .foo at 0x80001000. + + .section .foo, "xa" + .type bar1, @function +bar1: + ret + ;; + goto _start + ;; + .space 0x1000 + .type bar2, @function +bar2: + ret + ;; + goto _start + ;; + .space 0x1000 + .type bar3, @function +bar3: + ret + ;; + goto _back + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call-defsym.d b/ld/testsuite/ld-kvx/farcall-call-defsym.d new file mode 100644 index 0000000..71dcebc --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-defsym.d @@ -0,0 +1,14 @@ +#name: kvx-farcall-call-defsym +#source: farcall-call-defsym.s +#as: +#ld: -Ttext 0x1000 --defsym=bar=0x8001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: + 1000: 00 00 00 1a call 8001000 <bar>;; + + 1004: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-defsym.s b/ld/testsuite/ld-kvx/farcall-call-defsym.s new file mode 100644 index 0000000..2072b53 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-defsym.s @@ -0,0 +1,12 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + call bar + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call-none-function.d b/ld/testsuite/ld-kvx/farcall-call-none-function.d new file mode 100644 index 0000000..3ef4131 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-none-function.d @@ -0,0 +1,24 @@ +#name: kvx-farcall-call-none-function +#source: farcall-call-none-function.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: +.*: .. .. .. .. call .* <__bar_veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <__bar_veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +Disassembly of section .foo: + +.* <bar>: +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-none-function.s b/ld/testsuite/ld-kvx/farcall-call-none-function.s new file mode 100644 index 0000000..85eeca5 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-none-function.s @@ -0,0 +1,19 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + call bar + ;; + ret + ;; + +# We will place the section .foo at 0x10001000. + + .section .foo, "xa" +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call-plt-32bits.d b/ld/testsuite/ld-kvx/farcall-call-plt-32bits.d new file mode 100644 index 0000000..a097e28 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-plt-32bits.d @@ -0,0 +1,31 @@ + +tmpdir/dump: file format elf32-kvx + + +Disassembly of section .plt: + +.* <foo@plt-0x20>: + ... + +.* <foo@plt>: + .*: 10 00 c4 0f get \$r16 = \$pc;; + + .*: .. .. 40 b0 .. .. .. 18 lwz \$r16 = [0-9]* \(0x[0-9a-f]*\)\[\$r16\];; + + .*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .text: + +.* <_start>: + ... +.*: .. .. 00 18 call .* <__foo_veneer>;; + +.*: 00 00 d0 0f ret;; + + +.* <__foo_veneer>: +.*: .. .. 40 e0 00 00 00 00 make \$r16 = .* \(0x[0-9a-f]*\);; + +.*: 10 00 d8 0f igoto \$r16;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-plt.d b/ld/testsuite/ld-kvx/farcall-call-plt.d new file mode 100644 index 0000000..ab431b0 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-plt.d @@ -0,0 +1,34 @@ +#name: kvx-farcall-call-plt +#source: farcall-call-plt.s +#as: +#ld: -shared +#objdump: -dr +#... + +Disassembly of section .plt: + +.* <.plt>: + ... + +.* <foo@plt>: +.*: 10 00 c4 0f get \$r16 = \$pc;; + +.*: .. .. 40 .. .. .. .. 18 l[wzd]* \$r16 = [0-9]* \(0x[0-9a-f]*\)\[\$r16\];; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .text: + +.* <_start>: + ... +.*: .. .. 00 18 call .* <__foo_veneer>;; + +.*: 00 00 d0 0f ret;; + + +.* <__foo_veneer>: +.*: .. .. 40 e0 00 00 00 00 make \$r16 = .* \(0x[0-9a-f]*\);; + +.*: 10 00 d8 0f igoto \$r16;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-plt.s b/ld/testsuite/ld-kvx/farcall-call-plt.s new file mode 100644 index 0000000..e1b1bbc --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-plt.s @@ -0,0 +1,14 @@ + .global _start + .global foo + .type foo, @function + .text + +_start: + # ((1 << 26) - 1) << 2 + # PCREL27 relocation out of range to plt stub, + # we need long branch veneer. + .skip 268435452, 0 + call foo + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call-section.d b/ld/testsuite/ld-kvx/farcall-call-section.d new file mode 100644 index 0000000..86f3f03 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-section.d @@ -0,0 +1,34 @@ +#name: kvx-farcall-call-section +#source: farcall-call-section.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: +.*: .. .. .. .. call .* <___veneer>;; + +.*: .. .. .. .. call .* <___veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <___veneer>: +.*: .. 00 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +.* <___veneer>: +.*: .. 01 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +Disassembly of section .foo: + +.* <bar>: +.*: 00 00 d0 0f ret;; + +.* <bar2>: +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-section.s b/ld/testsuite/ld-kvx/farcall-call-section.s new file mode 100644 index 0000000..3b22fc6 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-section.s @@ -0,0 +1,25 @@ + .global _start + +# We will place the section .text at 0x1000. + + .text + +_start: + call bar + ;; + call bar2 + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; + .type bar2, @function +bar2: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call.d b/ld/testsuite/ld-kvx/farcall-call.d new file mode 100644 index 0000000..6db1f16 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call.d @@ -0,0 +1,25 @@ +#name: kvx-farcall-call +#source: farcall-call.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + + +.* <_start>: +.*: .. .. .. 18 call .* <__bar_veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <__bar_veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +Disassembly of section .foo: + +.* <bar>: +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-call.s b/ld/testsuite/ld-kvx/farcall-call.s new file mode 100644 index 0000000..7319ae4 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call.s @@ -0,0 +1,20 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + call bar + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-defsym.d b/ld/testsuite/ld-kvx/farcall-goto-defsym.d new file mode 100644 index 0000000..27ba7be --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-defsym.d @@ -0,0 +1,14 @@ +#name: kvx-farcall-goto-defsym +#source: farcall-goto-defsym.s +#as: +#ld: -Ttext 0x1000 --defsym=bar=0x8001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: + 1000: 00 00 00 12 goto 8001000 <bar>;; + + 1004: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-defsym.s b/ld/testsuite/ld-kvx/farcall-goto-defsym.s new file mode 100644 index 0000000..f2e1da6 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-defsym.s @@ -0,0 +1,12 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + goto bar + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-gsym.d b/ld/testsuite/ld-kvx/farcall-goto-gsym.d new file mode 100644 index 0000000..9874d41 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-gsym.d @@ -0,0 +1,5 @@ +#name: kvx-farcall-goto-gsym +#source: farcall-goto-gsym.s +#as: +#ld: -Ttext 0x1000 +#error: .*\(.text\+0x0\): relocation truncated to fit: R_KVX_PCREL27 against symbol `bar_gsym'.* diff --git a/ld/testsuite/ld-kvx/farcall-goto-gsym.s b/ld/testsuite/ld-kvx/farcall-goto-gsym.s new file mode 100644 index 0000000..2cb7b19 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-gsym.s @@ -0,0 +1,20 @@ + .global _start + .global bar_gsym + +# We will place the section .text at 0x1000. + + .text + +_start: +# for long jump (goto) to global symbol, we shouldn't insert veneer +# as the veneer will clobber r16/r17 which is caller saved, gcc only +# reserve them for function call relocation (call). + goto bar_gsym + ;; + # ((1 << 26) - 1) << 2 + .skip 268435452, 0 +bar_gsym: + nop + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-none-function.d b/ld/testsuite/ld-kvx/farcall-goto-none-function.d new file mode 100644 index 0000000..88b7a27 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-none-function.d @@ -0,0 +1,26 @@ +#name: kvx-farcall-goto-none-function +#source: farcall-goto-none-function.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + + +.* <_start>: +.*: .. .. .. .. goto .* <__bar_veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <__bar_veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .foo: + +.* <bar>: +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-none-function.s b/ld/testsuite/ld-kvx/farcall-goto-none-function.s new file mode 100644 index 0000000..1223bc3 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-none-function.s @@ -0,0 +1,19 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + goto bar + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-plt-32bits.d b/ld/testsuite/ld-kvx/farcall-goto-plt-32bits.d new file mode 100644 index 0000000..04b4380 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-plt-32bits.d @@ -0,0 +1,31 @@ + +tmpdir/dump: file format elf32-kvx + + +Disassembly of section .plt: + +.* <.plt>: + ... + +.* <foo@plt>: +.*: 10 00 c4 0f get \$r16 = \$pc;; + +.*: .. .. 40 .. .. .. .. .. l[wzd]* \$r16 = [0-9]* \(0x[0-9a-b]*\)\[\$r16\];; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .text: + +.* <_start>: + ... +.*: .. .. .. 10 goto .* <__foo_veneer>;; + +.*: 00 00 d0 0f ret;; + + +.* <__foo_veneer>: +.*: .. .. 40 e0 00 00 00 00 make \$r16 = [0-9]* \(0x[0-9a-b]*\);; + +.*: 10 00 d8 0f igoto \$r16;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-plt.d b/ld/testsuite/ld-kvx/farcall-goto-plt.d new file mode 100644 index 0000000..e1e20e6 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-plt.d @@ -0,0 +1,34 @@ +#name: kvx-farcall-goto-plt +#source: farcall-goto-plt.s +#as: +#ld: -shared +#objdump: -dr +#... + +Disassembly of section .plt: + +.* <.plt>: + ... + +.* <foo@plt>: +.*: 10 00 c4 0f get \$r16 = \$pc;; + +.*: .. .. 40 .. .. .. .. .. l[wzd]* \$r16 = [0-9]* \(0x[0-9a-b]*\)\[\$r16\];; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .text: + +.* <_start>: + ... +.*: .. .. .. 10 goto .* <__foo_veneer>;; + +.*: 00 00 d0 0f ret;; + + +.* <__foo_veneer>: +.*: .. .. 40 e0 00 00 00 00 make \$r16 = [0-9]* \(0x[0-9a-b]*\);; + +.*: 10 00 d8 0f igoto \$r16;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-plt.s b/ld/testsuite/ld-kvx/farcall-goto-plt.s new file mode 100644 index 0000000..f912d9f --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-plt.s @@ -0,0 +1,13 @@ + .global _start + .global foo + .type foo, @function + .text +_start: + # ((1 << 26) - 1) << 2 + # PCREL27 relocation out of range to plt stub, + # we need long branch veneer. + .skip 268435452, 0 + goto foo + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-section.d b/ld/testsuite/ld-kvx/farcall-goto-section.d new file mode 100644 index 0000000..0599795 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-section.d @@ -0,0 +1,36 @@ +#name: kvx-farcall-goto-section +#source: farcall-goto-section.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: +.*: .. .. .. .. goto .* <___veneer>;; + +.*: .. .. .. .. goto .* <___veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <___veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +.* <___veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .foo: + +.* <bar>: +.*: 00 00 d0 0f ret;; + + +.* <bar2>: +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-section.s b/ld/testsuite/ld-kvx/farcall-goto-section.s new file mode 100644 index 0000000..d6287d1 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-section.s @@ -0,0 +1,25 @@ +.global _start + +# We will place the section .text at 0x1000. + + .text + +_start: + goto bar + ;; + goto bar2 + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; + .type bar2, @function +bar2: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto.d b/ld/testsuite/ld-kvx/farcall-goto.d new file mode 100644 index 0000000..7e34eeb --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto.d @@ -0,0 +1,25 @@ +#name: kvx-farcall-goto +#source: farcall-goto.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: +.*: .. .. .. .. goto .* <__bar_veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <__bar_veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .foo: + +.* <bar>: +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto.s b/ld/testsuite/ld-kvx/farcall-goto.s new file mode 100644 index 0000000..114bc56 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto.s @@ -0,0 +1,20 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + goto bar + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/kvx-elf.exp b/ld/testsuite/ld-kvx/kvx-elf.exp new file mode 100644 index 0000000..9323a9b --- /dev/null +++ b/ld/testsuite/ld-kvx/kvx-elf.exp @@ -0,0 +1,71 @@ +# Expect script for various KVX ELF tests. +# Copyright (C) 2009-2023 Free Software Foundation, Inc. +# Contributed by Kalray Inc. +# +# This file is part of the GNU Binutils. +# +# 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; see the file COPYING3. If not, +# see <http://www.gnu.org/licenses/>. +# + +# Exclude non-kvx-ELF targets. +if { ![istarget "kvx-*-*"] } { + return +} + +# List contains test-items with 3 items followed by 2 lists: +# 0:name 1:ld early options 2:ld late options 3:assembler options +# 4:filenames of assembler files 5: action and options. 6: name of output file + +# Actions: +# objdump: Apply objdump options on result. Compare with regex (last arg). +# nm: Apply nm options on result. Compare with regex (last arg). +# readelf: Apply readelf options on result. Compare with regex (last arg). + +# 64bits tests +run_dump_test "limit-call" +run_dump_test "limit-goto" +run_dump_test "farcall-back" +run_dump_test "farcall-goto-defsym" +run_dump_test "farcall-call-defsym" +run_dump_test "farcall-goto-gsym" +run_dump_test "farcall-goto-plt" +run_dump_test "farcall-call-plt" +run_dump_test "farcall-call" +run_dump_test "farcall-goto" +run_dump_test "farcall-goto-none-function" +run_dump_test "farcall-call-none-function" +run_dump_test "farcall-goto-section" +run_dump_test "farcall-call-section" +run_dump_test "pcrel-reloc" + +## 32bits tests +if { ![istarget "kvx*-linux-*"] } { + set extra_32bits [list [list as -m32] [list ld -melf32kvx]] + run_dump_test "limit-call" $extra_32bits + run_dump_test "limit-goto" $extra_32bits + run_dump_test "farcall-back" $extra_32bits + run_dump_test "farcall-goto-defsym" $extra_32bits + run_dump_test "farcall-call-defsym" $extra_32bits + run_dump_test "farcall-goto-gsym" $extra_32bits + run_dump_test "farcall-goto-plt" $extra_32bits + run_dump_test "farcall-call-plt" $extra_32bits + run_dump_test "farcall-call" $extra_32bits + run_dump_test "farcall-goto" $extra_32bits + run_dump_test "farcall-goto-none-function" $extra_32bits + run_dump_test "farcall-call-none-function" $extra_32bits + run_dump_test "farcall-goto-section" $extra_32bits + run_dump_test "farcall-call-section" $extra_32bits + run_dump_test "pcrel-reloc" [list [list as -m32] [list ld -melf32kvx] [list dump pcrel-reloc-32bits.d]] +} diff --git a/ld/testsuite/ld-kvx/kvx.ld b/ld/testsuite/ld-kvx/kvx.ld new file mode 100644 index 0000000..b1f3c05 --- /dev/null +++ b/ld/testsuite/ld-kvx/kvx.ld @@ -0,0 +1,18 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(kv3-1:64) +ENTRY(_start) +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__executable_start = 0x8000); . = 0x8000; + .text : + { + *(.before) + *(.text) + *(.after) + } =0 + . = 0x9000; + .got : { *(.got) *(.got.plt)} + . = 0x12340000; + .far : { *(.far) } +} diff --git a/ld/testsuite/ld-kvx/limit-call.d b/ld/testsuite/ld-kvx/limit-call.d new file mode 100644 index 0000000..a9b6c72 --- /dev/null +++ b/ld/testsuite/ld-kvx/limit-call.d @@ -0,0 +1,20 @@ +#name: kvx-limit-call +#source: limit-call.s +#as: +#ld: -Ttext 0x0000 --section-start .foo=0x0FFFFFFC +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: + 0: ff ff ff 1b call ffffffc <bar>;; + + 4: 00 00 d0 0f ret;; + + +Disassembly of section .foo: + +.* <bar>: +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/limit-call.s b/ld/testsuite/ld-kvx/limit-call.s new file mode 100644 index 0000000..e5cff12 --- /dev/null +++ b/ld/testsuite/ld-kvx/limit-call.s @@ -0,0 +1,22 @@ +# Test maximum encoding range of call + + .global _start + .global bar + +# We will place the section .text at 0x0000. + + .text + +_start: + call bar + ;; + ret + ;; + +# We will place the section .foo at 0x10000000 + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/limit-goto.d b/ld/testsuite/ld-kvx/limit-goto.d new file mode 100644 index 0000000..36c4386 --- /dev/null +++ b/ld/testsuite/ld-kvx/limit-goto.d @@ -0,0 +1,20 @@ +#name: kvx-limit-goto +#source: limit-goto.s +#as: +#ld: -Ttext 0x0 --section-start .foo=0x0FFFFFFC +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: + 0: ff ff ff 13 goto ffffffc <bar>;; + + 4: 00 00 d0 0f ret;; + + +Disassembly of section .foo: + +.* <bar>: +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/limit-goto.s b/ld/testsuite/ld-kvx/limit-goto.s new file mode 100644 index 0000000..f902114 --- /dev/null +++ b/ld/testsuite/ld-kvx/limit-goto.s @@ -0,0 +1,22 @@ +# Test maximum encoding range of call + + .global _start + .global bar + +# We will place the section .text at 0x0000. + + .text + +_start: + goto bar + ;; + ret + ;; + +# We will place the section .foo at 0x10000000 + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/pcrel-reloc-32bits.d b/ld/testsuite/ld-kvx/pcrel-reloc-32bits.d new file mode 100644 index 0000000..3ca9eb9 --- /dev/null +++ b/ld/testsuite/ld-kvx/pcrel-reloc-32bits.d @@ -0,0 +1,8 @@ +.*: file format elf32-kvx + + +Disassembly of section .text: + +.* <_start>: +.*: 00 00 d0 8f ret +.*: c0 cd 04 f0 04 00 00 00 pcrel \$r1 = 4919 \(0x1337\);; diff --git a/ld/testsuite/ld-kvx/pcrel-reloc.d b/ld/testsuite/ld-kvx/pcrel-reloc.d new file mode 100644 index 0000000..1931d9e --- /dev/null +++ b/ld/testsuite/ld-kvx/pcrel-reloc.d @@ -0,0 +1,14 @@ +#name: pcrel-reloc +#source: pcrel-reloc.s +#as: +#ld: -Ttext 0x0 --defsym foo=0x1337 +#objdump: -dr + +.*: file format elf64-kvx + + +Disassembly of section .text: + +0000000000000000 <_start>: + 0: 00 00 d0 8f ret + 4: c0 cd 04 f0 04 00 00 80 00 00 00 00 pcrel \$r1 = 4919 \(0x1337\);; diff --git a/ld/testsuite/ld-kvx/pcrel-reloc.s b/ld/testsuite/ld-kvx/pcrel-reloc.s new file mode 100644 index 0000000..825a381 --- /dev/null +++ b/ld/testsuite/ld-kvx/pcrel-reloc.s @@ -0,0 +1,10 @@ +.text +.global _start +.weak foo +.hidden foo + +.type _start, @function +_start: + pcrel $r1 = @pcrel(foo) + ret + ;; |