diff options
Diffstat (limited to 'binutils-2.21/ld/testsuite/ld-mn10300')
29 files changed, 585 insertions, 0 deletions
diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i112045-1.d b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-1.d new file mode 100644 index 0000000..dcb5a41 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-1.d @@ -0,0 +1,22 @@ + +tmpdir/i112045-1.x: file format elf32-.* + +Disassembly of section .text: + +0+0 <_start>: + 0: fc d0 f8 0f[ ]+add 4088,a0 + 4: 00 00 + 6: cb[ ]+nop[ ]+ + 7: cb[ ]+nop[ ]+ + +0+08 <L01>: + 8: fc d0 2b 01[ ]+add 299,a0 + c: 00 00 + e: cb[ ]+nop[ ]+ + f: cb[ ]+nop[ ]+ + +0+010 <L02>: + 10: fc d0 08 00[ ]+add 8,a0 + 14: 00 00 + 16: cb[ ]+nop[ ]+ + 17: cb[ ]+nop[ ]+ diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i112045-1.s b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-1.s new file mode 100644 index 0000000..b9e0346 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-1.s @@ -0,0 +1,14 @@ + .text + .global _start +_start: + add 0x1000 - L01, A0 + nop + nop +L01: + add L01 + 0x123, A0 + nop + nop +L02: + add L02 - L01, A0 + nop + nop diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i112045-2.d b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-2.d new file mode 100644 index 0000000..9aa2d82 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-2.d @@ -0,0 +1,6 @@ + +tmpdir/i112045-2.x: file format elf32-.* + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +[0-9a-f]+ R_MN10300_RELATIVE \*ABS\*\+0x[0-9a-f]+ diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i112045-2.s b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-2.s new file mode 100644 index 0000000..90e942d --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-2.s @@ -0,0 +1,12 @@ + .section .data +L01: + .long L04 - L01 +L02: + .long L04 - L02 +L03: + .long L04 - L03 +L04: + .long L04 + .long L00 + .equ L00, 0xff + diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i112045-3.d b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-3.d new file mode 100644 index 0000000..c4b2f4b --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-3.d @@ -0,0 +1,17 @@ + +tmpdir/i112045-3.x: file format elf32-.* + +Disassembly of section .text: + +0+0100 <L001>: + 100:[ ]+24 00 01[ ]+mov[ ]+256,a0 + +0+0103 <L002>: + 103:[ ]+24 00 01[ ]+mov[ ]+256,a0 +Disassembly of section .rodata: + +0+0106 <L004>: + 106:[ ]+06 00 00[ ]+movbu[ ]+d1,\(0 <L001-0x100>\) + 109:[ ]+00[ ]+clr[ ]+d0 + 10a:[ ]+03 00 00[ ]+movhu[ ]+d0,\(0 <L001-0x100>\) +[ ]+... diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i112045-3.s b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-3.s new file mode 100644 index 0000000..b372a77 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i112045-3.s @@ -0,0 +1,11 @@ + .text +L001: + mov L001,A0 +L002: + mov L001,A0 +L003: + + .section .rodata +L004: + .long L003-L001 + .long L003-L002 diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i126256-1.c b/binutils-2.21/ld/testsuite/ld-mn10300/i126256-1.c new file mode 100644 index 0000000..5907d87 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i126256-1.c @@ -0,0 +1,7 @@ +void +sub0 (int i) +{ + extern int sub (int); + + sub (i); +} diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i126256-2.c b/binutils-2.21/ld/testsuite/ld-mn10300/i126256-2.c new file mode 100644 index 0000000..2948e5b --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i126256-2.c @@ -0,0 +1,5 @@ +int +sub (int i) +{ + return i + 10; +} diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i127740.d b/binutils-2.21/ld/testsuite/ld-mn10300/i127740.d new file mode 100644 index 0000000..456a75b --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i127740.d @@ -0,0 +1,17 @@ + +tmpdir/i127740.x: file format elf32-.* + +Disassembly of section .text: + +0+0100 <_main>: + 100: 2d 00 03[ ]+mov 768,d1 + 103: cb[ ]+nop + 104: cb[ ]+nop + 105: cb[ ]+nop + ... + +0+0200 <_dummy>: + 200: 00[ ]+clr d0 + 201: 02 00 00[ ]+movbu d0,\(0 <_main-0x100>\) + 204: df 00 00[ ]+ret \[\],0 + ... diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i127740.s b/binutils-2.21/ld/testsuite/ld-mn10300/i127740.s new file mode 100644 index 0000000..358266b --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i127740.s @@ -0,0 +1,12 @@ + .section .text + .global _main + .global _dummy +_main: + mov _g_label,d1 # instruction is changed by relaxations + + .balign 0x100 +_dummy: + .long _dummy + ret [],0 + .size _main, .-_main + .comm _g_label,4,4 diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-1.d b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-1.d new file mode 100644 index 0000000..7fa868a --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-1.d @@ -0,0 +1,11 @@ + +Symbol table '.symtab' contains .. entries: + +Num: +Value +Size +Type +Bind +Vis +Ndx +Name +#... + +..: 0[0-9a-f]+ +7 +FUNC +LOCAL +DEFAULT +. _func +#... + +..: 0[0-9a-f]+ +0 +NOTYPE +LOCAL +DEFAULT +. A + +..: 0[0-9a-f]+ +7 +FUNC +GLOBAL +DEFAULT +. _func2 +#... + +..: 0[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +. BOTTOM +#... diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-1.s b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-1.s new file mode 100644 index 0000000..b9faaf4 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-1.s @@ -0,0 +1,29 @@ + .text + + nop + + .global _start +_start: + .type _func, @function +_func: + mov L001,A1 + nop +A: + mov L001,A1 + .size _func, . - _func + + + .global _func2 +_func2: + .type _func2, @function + mov L001,A1 + nop + mov L001,A1 + .size _func2, . - _func2 + + .global BOTTOM +BOTTOM: + + .data +L001: + diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-2.d b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-2.d new file mode 100644 index 0000000..502a3ba --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-2.d @@ -0,0 +1,11 @@ + +Symbol table '.symtab' contains .. entries: + +Num: +Value +Size +Type +Bind +Vis +Ndx +Name +#... + +..: 0[0-9a-f]+02 +0 +NOTYPE +LOCAL +DEFAULT +. _A + +..: 0[0-9a-f]+08 +0 +NOTYPE +LOCAL +DEFAULT +. _B + +..: 0[0-9a-f]+08 +0 +NOTYPE +LOCAL +DEFAULT +. _C + +..: 0[0-9a-f]+10 +7 +FUNC +LOCAL +DEFAULT +. _func + +..: 0[0-9a-f]+14 +0 +NOTYPE +LOCAL +DEFAULT +. _D + +..: 0[0-9a-f]+17 +0 +NOTYPE +LOCAL +DEFAULT +. BOTTOM +#pass diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-2.s b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-2.s new file mode 100644 index 0000000..36448ed --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-2.s @@ -0,0 +1,23 @@ + .text + .global _start +_start: + add A0, A1 +_A: + mov L001, A0 +_B: + .balign 0x8 +_C: + nop + .balign 0x10 + + .type _func, @function +_func: + mov L001, A1 + nop +_D: + mov L001, A1 +BOTTOM: + .size _func, . - _func + + .data +L001: diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-3.d b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-3.d new file mode 100644 index 0000000..1ea91ba --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-3.d @@ -0,0 +1,16 @@ + +tmpdir/i135409-3.x: file format elf32-.* + +Disassembly of section .text: + +0+0 <_func>: + 0: 25 1f 00[ ]+mov 31,a1 + 3: cb[ ]+nop + +0+04 <A>: + 4: 25 1f 00[ ]+mov 31,a1 + 7: cb[ ]+nop + +0+08 <BOTTOM>: + 8: e1[ ]+add d0,d1 +#pass diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-3.s b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-3.s new file mode 100644 index 0000000..e83ad96 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-3.s @@ -0,0 +1,16 @@ + .text + .global _start +_start: + .type _func, @function +_func: + mov L001,A1 + nop +A: + mov L001,A1 +BOTTOM: + .balign 0x8 + add D0,D1 + .size _func, .-func + + .data +L001: diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-4.d b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-4.d new file mode 100644 index 0000000..f14ea7d --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-4.d @@ -0,0 +1,7 @@ + +tmpdir/i135409-4.x: file format elf32-.* + +Disassembly of section .text: + +0+0 <_start>: + 0:[ ]+cc 00 07[ ]+jmp[ ]+700 \<L001\> diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-4.s b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-4.s new file mode 100644 index 0000000..90badde --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-4.s @@ -0,0 +1,8 @@ + .text + .global _start +_start: + jmp L001 + + .section .text1 +L001: + nop diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-4.t b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-4.t new file mode 100644 index 0000000..9d905cb --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-4.t @@ -0,0 +1,23 @@ +SECTIONS +{ + . = 0x0; + .text : + { + *(.text) + } + + . = 0x700; + .text1 : + { + *(.text1) + } + . = 0x8100; + .bss : + { + *(.bss) + } + .data : + { + *(.data) + } +} diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-5.d b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-5.d new file mode 100644 index 0000000..dbff701 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-5.d @@ -0,0 +1,7 @@ + +tmpdir/i135409-5.x: file format elf32-.* + +Disassembly of section .text: + +0+0700 <_start>: + 700:[ ]+cc 00 f9[ ]+jmp[ ]+0 \<L001\> diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-5.s b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-5.s new file mode 100644 index 0000000..23897e8 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-5.s @@ -0,0 +1,8 @@ + .text + .global _start +_start: + jmp L001 + + .section .text1 +L001: + nop diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i135409-5.t b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-5.t new file mode 100644 index 0000000..8b42814 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i135409-5.t @@ -0,0 +1,23 @@ +SECTIONS +{ + . = 0x0; + .text1 : + { + *(.text1) + } + + . = 0x700; + .text : + { + *(.text) + } + . = 0x8100; + .bss : + { + *(.bss) + } + .data : + { + *(.data) + } +} diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i143317.d b/binutils-2.21/ld/testsuite/ld-mn10300/i143317.d new file mode 100644 index 0000000..ace2831 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i143317.d @@ -0,0 +1,8 @@ + +tmpdir/i143317.x: file format elf32-.* + +Disassembly of section .text: + +0+100c <.text>: +[ ]+100c:[ ]+fa 02 fe 7f[ ]+mov[ ]+\(32766,a2\),d0 +[ ]+1010:[ ]+fa 06 fe 7f[ ]+mov[ ]+\(32766,a2\),d1 diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i143317.s b/binutils-2.21/ld/testsuite/ld-mn10300/i143317.s new file mode 100644 index 0000000..abcc896 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i143317.s @@ -0,0 +1,36 @@ +.section .rodata.str1.1 ,"aMS",@progbits,0x1 +_start: +.string "abcdefgh" +L001: +.string "hogehoge" +L002: +.string "fooooooo" +L003: + +.text +.align 0x02 +mov (L001@GOTOFF,A2),D0 +mov (L004@GOTOFF,A2),D1 + + +.section .rodata.str1.1 ,"aMS",@progbits,0x1 +L006: +.string "" +.string "" +.string "" +.string "%" +.string "" +.string "" +.string "s" +.string "" +L005: +.string "" +.string "" +.string "" +.string "%" +.string "" +.string "" +.string "r" +.string "" +L004: +.string "hogehoge" diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i143317.t b/binutils-2.21/ld/testsuite/ld-mn10300/i143317.t new file mode 100644 index 0000000..47d9262 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i143317.t @@ -0,0 +1,31 @@ +SECTIONS +{ +.bss : +{ +*(.bss) +end = .; +} +. = 0x1000; +.got : { *(.got.plt) *(.got) } +.text : +{ +*(.text) +} +. = 0x8ff5; +.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } +.data : +{ +*(.data) +} +edata = .; +.stac : +{ +*(.stack) +} +.plt : { *(.plt) } +.rela.plt : { *(.rela.plt) } +.rela.dyn : +{ +*(.rela.text) +} +} diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i36434-2.s b/binutils-2.21/ld/testsuite/ld-mn10300/i36434-2.s new file mode 100644 index 0000000..cf31ce1 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i36434-2.s @@ -0,0 +1,16 @@ + .section .text + .global _bar + .type _bar,@function +_bar: + mov .LC1,d0 + mov .LC2,d1 + nop + + .section .rodata.str1.1,"aMS",@progbits,1 +.LC1: + .rept 32768 + .byte 'a' + .endr + .byte 0 +.LC2: + .string "abc\n" diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i36434.d b/binutils-2.21/ld/testsuite/ld-mn10300/i36434.d new file mode 100644 index 0000000..af37b3b --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i36434.d @@ -0,0 +1,16 @@ + +tmpdir/i36434.x: file format elf32-.* + +Disassembly of section .text: + +08000074 <_start>: + 8000074: fc cd 8c 80 mov 134250636,d1 + 8000078: 00 08 + 800007a: cb nop + +0800007b <_bar>: + 800007b: fc cc 88 00 mov 134217864,d0 + 800007f: 00 08 + 8000081: fc cd 89 80 mov 134250633,d1 + 8000085: 00 08 + 8000087: cb nop diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/i36434.s b/binutils-2.21/ld/testsuite/ld-mn10300/i36434.s new file mode 100644 index 0000000..84c1d83 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/i36434.s @@ -0,0 +1,10 @@ + .section .text + .global _start + .type _start,@function +_start: + mov .LC2,d1 + nop + + .section .rodata.str1.1,"aMS",@progbits,1 +.LC2: + .string "\n" diff --git a/binutils-2.21/ld/testsuite/ld-mn10300/mn10300.exp b/binutils-2.21/ld/testsuite/ld-mn10300/mn10300.exp new file mode 100644 index 0000000..617ad8a --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-mn10300/mn10300.exp @@ -0,0 +1,163 @@ +# Expect script for ld-mn10300 tests +# Copyright (C) 2007 Free Software Foundation +# +# This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +if {!([istarget "am3*-*-*"]) && !([istarget "mn10300*-*-*"]) } { + return +} + +# Set up a list as described in ld-lib.exp + +set mn10300_tests { + { + "am33 string merging" + "-relax -Ttext 0x8000074" + "" + { "i36434.s" "i36434-2.s" } + { {objdump -dz i36434.d} } + "i36434.x" + } + { + "difference of two same-section symbols" + "-Ttext 0" + "" + { "i112045-1.s" } + { {objdump -d i112045-1.d} } + "i112045-1.x" + } + { + "difference of two same-section symbols where the difference is held in another section" + "-relax -Ttext 100" + "" + { "i112045-3.s" } + { {objdump -D i112045-3.d} } + "i112045-3.x" + } + { + "relaxation and alignment directives" + "-relax -Ttext 100 -Tbss 300" + "" + { "i127740.s" } + { {objdump -d i127740.d} } + "i127740.x" + } + { + "adjustment of symbols due to relaxation" + "-Tdata 1f -Ttext 0 -relax" + "" + { "i135409-1.s" } + { {readelf --syms i135409-1.d} } + "i135409-1.x" + } + { + "adjustment of symbols due to relaxation (with alignment directives)" + "-Tdata 1f -Ttext 0 -relax" + "" + { "i135409-2.s" } + { {readelf --syms i135409-2.d} } + "i135409-2.x" + } + { + "adjustment of symbols due to relaxation (with a symbol in the deleted region)" + "-Tdata 1f -Ttext 0 -relax" + "" + { "i135409-3.s" } + { {objdump -d i135409-3.d} } + "i135409-3.x" + } + { + "adjusting a 16-bit forward branch" + "-Ti135409-4.t -relax" + "" + { "i135409-4.s" } + { {objdump -d i135409-4.d} } + "i135409-4.x" + } + { + "adjusting a 16-bit backward branch" + "-Ti135409-5.t -relax" + "" + { "i135409-5.s" } + { {objdump -d i135409-5.d} } + "i135409-5.x" + } + { + "relaxing offsets into a merged string section" + "-Ti143317.t -shared -relax" + "" + { "i143317.s" } + { {objdump -d i143317.d} } + "i143317.x" + } +} + +run_ld_link_tests $mn10300_tests + +if {!([istarget "am3*-*-*"])} { + return +} + +set am33_tests { + { + "difference of two same-section symbols (in a shared library)" + "-shared" + "" + { "i112045-2.s" } + { {objdump -R i112045-2.d} } + "i112045-2.x" + } +} + +run_ld_link_tests $am33_tests + +proc i126256-test { } { + global CC + global ld + global srcdir + global subdir + + set tmpdir tmpdir + set testname "Seg fault whilst linking one shared library into another when relaxation is enabled." + + if {![is_remote host] && [which $CC] == 0} then { + return + } + + if { ![ld_compile "$CC -mrelax -fPIC" $srcdir/$subdir/i126256-1.c $tmpdir/i126256-1.o] } { + unresolved $testname + return + } + + if { ![ld_compile "$CC -mrelax -fPIC" $srcdir/$subdir/i126256-2.c $tmpdir/i126256-2.o] } { + unresolved $testname + return + } + + if { ![ld_simple_link $ld $tmpdir/i126256-1.so "-shared $tmpdir/i126256-1.o -e 0"]} { + unresolved $testname + return + } + + if { ![ld_simple_link $ld $tmpdir/i126256-2.so "--relax -shared $tmpdir/i126256-2.o $tmpdir/i126256-1.so -e 0"]} { + fail $testname + return + } + + pass $testname +} + +i126256-test |