diff options
Diffstat (limited to 'binutils-2.25/gas/testsuite/gas/all')
89 files changed, 2958 insertions, 0 deletions
diff --git a/binutils-2.25/gas/testsuite/gas/all/align.d b/binutils-2.25/gas/testsuite/gas/all/align.d new file mode 100644 index 00000000..dec2168a --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/align.d @@ -0,0 +1,15 @@ +#objdump: -s -j .text +#name: align +# The RX port will always replace zeros in any aligned area with NOPs, +# even if the user requested that they filled with zeros. +#not-target: m32c-* rx-* + +# Test the alignment pseudo-op. + +.*: .* + +Contents of section .text: + 0000 ff00ff01 ff020202 ffff0303 04040404 ................ + 0010 ffffffff 05050505 ff090a0a 0a0a0a0a ................ + 0020 ff00ff01 ff020202 ffff0303 04040404 ................ + 0030 ffffffff 05050505 ff090a0a 0a0a0a0a ................ diff --git a/binutils-2.25/gas/testsuite/gas/all/align.s b/binutils-2.25/gas/testsuite/gas/all/align.s new file mode 100644 index 00000000..9ccca130 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/align.s @@ -0,0 +1,61 @@ +/* Test the alignment pseudo-ops. */ + .text + + .byte 0xff + .p2align 1,0 + + .byte 0xff + .p2align 1,1 + + .byte 0xff + .p2align 2,2 + + .byte 0xff + .byte 0xff + .p2alignw 2,0x0303 + + .p2align 3,4 + .byte 0xff + .byte 0xff + .byte 0xff + .byte 0xff + .p2alignl 3,0x05050505 + + .p2align 1,6 + .p2align 1,7 + + .byte 0xff + .p2align 3,8,5 + .byte 9 + .p2align 3,0xa + + .byte 0xff + .balign 2,0 + + .byte 0xff + .balign 2,1 + + .byte 0xff + .balign 4,2 + + .byte 0xff + .byte 0xff + .balignw 4,0x0303 + + .balign 8,4 + .byte 0xff + .byte 0xff + .byte 0xff + .byte 0xff + .balignl 8,0x05050505 + + .balign 2,6 + .balign 2,7 + + .byte 0xff + .balign 8,8,5 + .byte 9 + .balign 8,0xa + + .p2align 5 + .balign 32 diff --git a/binutils-2.25/gas/testsuite/gas/all/align2.d b/binutils-2.25/gas/testsuite/gas/all/align2.d new file mode 100644 index 00000000..47c93d3a --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/align2.d @@ -0,0 +1,9 @@ +#objdump: -s -j .text +#name: align2 + +# Test the section alignment. + +.*: .* + +Contents of section .text: + 0000 ff[ 0-9a-f]*[ ]+.* diff --git a/binutils-2.25/gas/testsuite/gas/all/align2.s b/binutils-2.25/gas/testsuite/gas/all/align2.s new file mode 100644 index 00000000..106811dc --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/align2.s @@ -0,0 +1,2 @@ + .p2align 4,0 + .byte 0xff diff --git a/binutils-2.25/gas/testsuite/gas/all/altmac2.d b/binutils-2.25/gas/testsuite/gas/all/altmac2.d new file mode 100644 index 00000000..59fb3270 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/altmac2.d @@ -0,0 +1,10 @@ +#as: --alternate +#objdump: -s -j .data +#name: alternate macro syntax (escape) + +# Test the alternate macro syntax. + +.*: .* + +Contents of section .data: + 0000 3e3c21.* diff --git a/binutils-2.25/gas/testsuite/gas/all/altmac2.s b/binutils-2.25/gas/testsuite/gas/all/altmac2.s new file mode 100644 index 00000000..05f79afd --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/altmac2.s @@ -0,0 +1,7 @@ +.macro m1 str + .ascii "&str" +.endm + + .data + +m1 <!>!<!!> diff --git a/binutils-2.25/gas/testsuite/gas/all/altmacro.d b/binutils-2.25/gas/testsuite/gas/all/altmacro.d new file mode 100644 index 00000000..aa72f6d6 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/altmacro.d @@ -0,0 +1,11 @@ +#as: --alternate +#objdump: -s -j .data +#name: alternate macro syntax + +# Test the alternate macro syntax. + +.*: .* + +Contents of section .data: + 0000 01020912 61626331 32332121 3c3e2721 .* + 0010 3c3e27.* diff --git a/binutils-2.25/gas/testsuite/gas/all/altmacro.s b/binutils-2.25/gas/testsuite/gas/all/altmacro.s new file mode 100644 index 00000000..d2955391 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/altmacro.s @@ -0,0 +1,35 @@ +.macro m1 v1, v2 + LOCAL l1, l2 +label&v1: +l1: .byte v1 +label&v2: +l2: .byte v2 +.endm + +.macro m2 v1, v2 + m1 %(v1), %(v2-v1) +.endm + +.macro m3 str + .ascii &str +.endm + + .data + +m2 1, 3 +m2 9, 27 + +m3 "abc" +m3 <"1", "23"> + + .noaltmacro + +.macro m4 str + .ascii "&str" +.endm + +m4 "!!<>'" + + .altmacro + +m3 "!!<>'" diff --git a/binutils-2.25/gas/testsuite/gas/all/assign-bad.s b/binutils-2.25/gas/testsuite/gas/all/assign-bad.s new file mode 100644 index 00000000..3c7a2d7c --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/assign-bad.s @@ -0,0 +1,2 @@ + yyy == 3 + yyy == 4 diff --git a/binutils-2.25/gas/testsuite/gas/all/assign-ok.s b/binutils-2.25/gas/testsuite/gas/all/assign-ok.s new file mode 100644 index 00000000..fb8e06fe --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/assign-ok.s @@ -0,0 +1,3 @@ + xxx = 1 + xxx = 2 + yyy == 3 diff --git a/binutils-2.25/gas/testsuite/gas/all/assign.d b/binutils-2.25/gas/testsuite/gas/all/assign.d new file mode 100644 index 00000000..fce74661 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/assign.d @@ -0,0 +1,6 @@ +#objdump : -r +#name : assignment tests + +#... +.*zzz.* +.*zzz.* diff --git a/binutils-2.25/gas/testsuite/gas/all/assign.s b/binutils-2.25/gas/testsuite/gas/all/assign.s new file mode 100644 index 00000000..5f94392d --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/assign.s @@ -0,0 +1,9 @@ + .global x + x = zzz + x = x+1 + .long x + + .global y + y = 1 + y = y+zzz + .long y diff --git a/binutils-2.25/gas/testsuite/gas/all/byte.d b/binutils-2.25/gas/testsuite/gas/all/byte.d new file mode 100644 index 00000000..9e23feaa --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/byte.d @@ -0,0 +1,5 @@ +#name: bad byte directive +#error-output: byte.l +# The RX target allows quoted ASCII strings inside .byte directives +# for compatibily with the Renesas assembler. +#skip: rx-*-* diff --git a/binutils-2.25/gas/testsuite/gas/all/byte.l b/binutils-2.25/gas/testsuite/gas/all/byte.l new file mode 100644 index 00000000..a87bb715 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/byte.l @@ -0,0 +1,3 @@ +[^:]*: Assembler messages: +[^:]*:1: Error: unexpected `"' in expression +[^:]*:2: Error: unexpected `"' in expression diff --git a/binutils-2.25/gas/testsuite/gas/all/byte.s b/binutils-2.25/gas/testsuite/gas/all/byte.s new file mode 100644 index 00000000..8d609388 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/byte.s @@ -0,0 +1,2 @@ + .byte " " + .byte " " diff --git a/binutils-2.25/gas/testsuite/gas/all/cofftag.d b/binutils-2.25/gas/testsuite/gas/all/cofftag.d new file mode 100644 index 00000000..88cf13c7 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/cofftag.d @@ -0,0 +1,25 @@ +#objdump: -t +#name: cofftag + +.*: file format .* + +SYMBOL TABLE: +\[ 0\]\(sec -2\)\(fl 0x00\)\(ty 0\)\(scl 103\) \(nx 1\) 0x0+0000 foo.c +File +\[ 2\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 6\) \(nx 0\) 0x0+0000 gcc2_compiled. +\[ 3\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 6\) \(nx 0\) 0x0+0000 ___gnu_compiled_c +\[ 4\]\(sec -2\)\(fl 0x00\)\(ty a\)\(scl 15\) \(nx 1\) 0x0+0000 _token +AUX lnno 0 size 0x4 tagndx 0 endndx 10 +\[ 6\]\(sec -(1|2)\)\(fl 0x00\)\(ty b\)\(scl 16\) \(nx 0\) 0x0+0000 _operator +\[ 7\]\(sec -(1|2)\)\(fl 0x00\)\(ty b\)\(scl 16\) \(nx 0\) 0x0+0001 _flags +\[ 8\]\(sec -(1|2)\)\(fl 0x00\)\(ty 0\)\(scl 102\) \(nx 1\) 0x0+0004 .eos +AUX lnno 0 size 0x4 tagndx 4 +\[ 10\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x[0-9a-f]+ .text +AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0 +\[ 12\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x[0-9a-f]+ .data +AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0 +\[ 14\]\(sec 3\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x[0-9a-f]+ .bss +AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0 +\[ 16\]\(sec 2\)\(fl 0x00\)\(ty 2\)\(scl 2\) \(nx 0\) 0x0+0000 _token +\[ 17\]\(sec 2\)\(fl 0x00\)\(ty a\)\(scl 2\) \(nx 1\) 0x[0-9a-f]+ _what +AUX lnno 0 size 0x4 tagndx 4 diff --git a/binutils-2.25/gas/testsuite/gas/all/cofftag.s b/binutils-2.25/gas/testsuite/gas/all/cofftag.s new file mode 100644 index 00000000..814d3ede --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/cofftag.s @@ -0,0 +1,60 @@ +/* This file was compiled from this C source: + char token =0; + enum token { + operator, + flags + }; + + enum token what= operator; + + Type numbers have been converted to decimal to make this test pass on + ports having NUMBERS_WITH_SUFFIX. + */ + + .file "foo.c" +gcc2_compiled.: +___gnu_compiled_c: +.globl _token +.data +_token: + .byte 0 +.text + .def _token + .scl 15 + .type 10 + .size 4 + .endef + .def _operator + .val 0 + .scl 16 + .type 11 + .endef + .def _flags + .val 1 + .scl 16 + .type 11 + .endef + .def .eos + .val 4 + .scl 102 + .tag _token + .size 4 + .endef +.globl _what +.data + .p2align 2 +_what: + .long 0 +.text + .def _token + .val _token + .scl 2 + .type 2 + .endef + .def _what + .val _what + .scl 2 + .tag _token + .size 4 + .type 10 + .endef diff --git a/binutils-2.25/gas/testsuite/gas/all/comment.s b/binutils-2.25/gas/testsuite/gas/all/comment.s new file mode 100644 index 00000000..76bc641a --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/comment.s @@ -0,0 +1,3 @@ +# This test file is to see whether comments get written into listings +# correctly. The file has no real contents. +/* C comments too! */ diff --git a/binutils-2.25/gas/testsuite/gas/all/cond.l b/binutils-2.25/gas/testsuite/gas/all/cond.l new file mode 100644 index 00000000..36f00664 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/cond.l @@ -0,0 +1,71 @@ +# This should match the output of gas -alc cond.s. + +.*cond.s.* + + + 1[ ]+.if 0 + 8[ ]+.else + 9[ ]+.if 1 + 10[ ]+.endc + 11 0000 0[02] ?00 ?00 ?0[02][ ]+.long[ ]+2 + 12[ ]+.if 0 + 14[ ]+.else + 15 0004 0[04] ?00 ?00 ?0[04][ ]+.long[ ]+4 + 16[ ]+.endc + 17[ ]+.endc + 18[ ]+ + 19[ ]+.if 0 + 21[ ]+.elseif 1 + 22[ ]+.if 0 + 24[ ]+.elseif 1 + 25 0008 0[07] ?00 ?00 ?0[07][ ]+.long[ ]+7 + 26[ ]+.endif + 27[ ]+.elseif 1 + 29[ ]+.else + 31[ ]+.endif +[ ]*[1-9][0-9]*[ ]+ +[ ]*[1-9][0-9]*[ ]+\.comm[ ]+c,[ ]*1[ ]* +[ ]*[1-9][0-9]*[ ]+\.ifndef[ ]+c[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+\.if[ ]+x[ ]*<>[ ]*x[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+y,[ ]*x[ ]* +[ ]*[1-9][0-9]*[ ]+\.ifndef[ ]+y[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]+\.if[ ]+x[ ]*<>[ ]*y[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+z,[ ]*x[ ]* +[ ]*[1-9][0-9]*[ ]+\.if[ ]+y[ ]*<>[ ]*z[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+a,[ ]*y[ ]*\+[ ]*1[ ]* +[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+b,[ ]*z[ ]*-[ ]*1[ ]* +[ ]*[1-9][0-9]*[ ]+\.if[ ]+a[ ]*==[ ]*x[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]+\.if[ ]+a[ ]*-[ ]*1[ ]*<>[ ]*x[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]+\.if[ ]+a[ ]*<>[ ]*b[ ]*\+[ ]*2[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]+\.if[ ]+a[ ]*-[ ]*b[ ]*<>[ ]*2[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]* +[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+x,[ ]*0[ ]* +[ ]*[1-9][0-9]*[ ]+\.if[ ]+y[ ]* +[ ]*[1-9][0-9]*[ ]+\.elseif[ ]+y[ ]* +[ ]*[1-9][0-9]*[ ]+\.endif[ ]* +[ ]*[1-9][0-9]*[ ]+ +[ ]*[1-9][0-9]*[ ]+\.macro[ ]+m[ ]+x,[ ]*y[ ]* +#... +[ ]*[1-9][0-9]*[ ]+\.endm[ ]* +[ ]*[1-9][0-9]*[ ]+[0-9a-f]+[048c] FF ?FF ?FF ?FF[ ]+m[ ]+,[ ]* +[ ]*[1-9][0-9]*[ ]+FF ?FF ?FF ?FF[ ]* +[ ]*[1-9][0-9]*[ ]+[0-9a-f]+[048c] FF ?FF ?FF ?FF[ ]+m[ ]+,[ ]*10[ ]* +[ ]*[1-9][0-9]*[ ]+0[0A] ?00 ?00 ?0[0A][ ]* +[ ]*[1-9][0-9]*[ ]+[0-9a-f]+[048c] 0[0B] ?00 ?00 ?0[0B][ ]+m[ ]+11,[ ]* +[ ]*[1-9][0-9]*[ ]+FF ?FF ?FF ?FF[ ]* +[ ]*[1-9][0-9]*[ ]+[0-9a-f]+[048c] 0[0C] ?00 ?00 ?0[0C][ ]+m[ ]+12,[ ]*13[ ]* +[ ]*[1-9][0-9]*[ ]+0[0D] ?00 ?00 ?0[0D][ ]* +[ ]*[1-9][0-9]*[ ]+ +[ ]*[1-9][0-9]*[ ]+.*\.p2align 5,0 +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/cond.s b/binutils-2.25/gas/testsuite/gas/all/cond.s new file mode 100644 index 00000000..164e055b --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/cond.s @@ -0,0 +1,92 @@ + .if 0 + .if 1 + .endc + .long 0 + .if 0 + .long 1 + .endc + .else + .if 1 + .endc + .long 2 + .if 0 + .long 3 + .else + .long 4 + .endc + .endc + + .if 0 + .long 5 + .elseif 1 + .if 0 + .long 6 + .elseif 1 + .long 7 + .endif + .elseif 1 + .long 8 + .else + .long 9 + .endif + + .comm c, 1 + .ifndef c + .err + .endif + + .if x <> x + .err + .endif + .equiv y, x + .ifndef y + .err + .endif + .if x <> y + .err + .endif + .equiv z, x + .if y <> z + .err + .endif + + .equiv a, y + 1 + .equiv b, z - 1 + .if a == x + .err + .endif + .if a - 1 <> x + .err + .endif + .if a <> b + 2 + .err + .endif + .if a - b <> 2 + .err + .endif + + .equiv x, 0 + .if y + .err + .elseif y + .err + .endif + + .macro m x, y + .ifb \x + .long -1 + .else + .long \x + .endif + .ifnb \y + .long \y + .else + .long -1 + .endif + .endm + m , + m , 10 + m 11, + m 12, 13 + + .p2align 5,0 diff --git a/binutils-2.25/gas/testsuite/gas/all/diff1.s b/binutils-2.25/gas/testsuite/gas/all/diff1.s new file mode 100644 index 00000000..10a89fdc --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/diff1.s @@ -0,0 +1,5 @@ +# Difference of two undefined symbols. +# The assembler should reject this. + .text + .globl _foo +_foo: .long _a - _b diff --git a/binutils-2.25/gas/testsuite/gas/all/equ-bad.s b/binutils-2.25/gas/testsuite/gas/all/equ-bad.s new file mode 100644 index 00000000..4e3f9310 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/equ-bad.s @@ -0,0 +1,2 @@ + .equ x, 1 + .eqv x, 2 diff --git a/binutils-2.25/gas/testsuite/gas/all/equ-ok.s b/binutils-2.25/gas/testsuite/gas/all/equ-ok.s new file mode 100644 index 00000000..c620e970 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/equ-ok.s @@ -0,0 +1,2 @@ + .equ x, 1 + .equ x, 2 diff --git a/binutils-2.25/gas/testsuite/gas/all/equiv1.s b/binutils-2.25/gas/testsuite/gas/all/equiv1.s new file mode 100644 index 00000000..cd59bda1 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/equiv1.s @@ -0,0 +1,5 @@ +;# Re-definition of an already .equiv-ed symbol (to another symbol). +;# The assembler should reject this. + .equiv x, y + .equiv y, 1 + .equiv x, 0 diff --git a/binutils-2.25/gas/testsuite/gas/all/equiv2.s b/binutils-2.25/gas/testsuite/gas/all/equiv2.s new file mode 100644 index 00000000..c533af7b --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/equiv2.s @@ -0,0 +1,6 @@ +;# Re-definition of an already .equiv-ed symbol (to an expression). +;# The assembler should reject this. + .equiv x, y-z + .equiv y, 1 + .equiv z, 1 + .equiv x, 1 diff --git a/binutils-2.25/gas/testsuite/gas/all/eqv-bad.s b/binutils-2.25/gas/testsuite/gas/all/eqv-bad.s new file mode 100644 index 00000000..66172b3f --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/eqv-bad.s @@ -0,0 +1,2 @@ + .eqv x, 1 + .eqv x, 2 diff --git a/binutils-2.25/gas/testsuite/gas/all/eqv-ok.s b/binutils-2.25/gas/testsuite/gas/all/eqv-ok.s new file mode 100644 index 00000000..2fe13d5d --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/eqv-ok.s @@ -0,0 +1 @@ + .eqv x, 1 diff --git a/binutils-2.25/gas/testsuite/gas/all/err-1.s b/binutils-2.25/gas/testsuite/gas/all/err-1.s new file mode 100644 index 00000000..68fbad54 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/err-1.s @@ -0,0 +1,7 @@ +;# Test .error directive. +;# { dg-do assemble } + .error "an error message" ;# { dg-error "Error: an error message" } + .error an error message ;# { dg-error "Error: .error argument must be a string" } + .error ;# { dg-error "Error: .error directive invoked in source file" } + .error ".error directive invoked in source file" ;# { dg-error "Error: .error directive invoked in source file" } + .error "" ;# { dg-error "Error: " } diff --git a/binutils-2.25/gas/testsuite/gas/all/eval.d b/binutils-2.25/gas/testsuite/gas/all/eval.d new file mode 100644 index 00000000..9a7e9e88 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/eval.d @@ -0,0 +1,8 @@ +#objdump: -s -j .data +#name: evaluation of simple expressions + +.*: .* + +Contents of section .data: + 0000 01010101 010101.. ........ ........ ................ +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/eval.s b/binutils-2.25/gas/testsuite/gas/all/eval.s new file mode 100644 index 00000000..14efe94c --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/eval.s @@ -0,0 +1,48 @@ +.equ zero, 0 +.equ one, 1 +.equ two, 2 + + + .data + + .if two > one + .byte one + .else + .byte two + .endif + + .if one == one + .byte one + .else + .byte two + .endif + + .if one < two + .byte one + .else + .byte two + .endif + + .if one <> two + .byte one + .else + .byte two + .endif + + .if one != two + .byte one + .else + .byte two + .endif + + .if one <= two + .byte one + .else + .byte two + .endif + + .if two >= one + .byte one + .else + .byte two + .endif diff --git a/binutils-2.25/gas/testsuite/gas/all/excl.s b/binutils-2.25/gas/testsuite/gas/all/excl.s new file mode 100644 index 00000000..cf84a959 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/excl.s @@ -0,0 +1 @@ +.equ a,!0 diff --git a/binutils-2.25/gas/testsuite/gas/all/fastcall.s b/binutils-2.25/gas/testsuite/gas/all/fastcall.s new file mode 100644 index 00000000..de771cd5 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/fastcall.s @@ -0,0 +1 @@ +@fastcall_label@0:
diff --git a/binutils-2.25/gas/testsuite/gas/all/float.s b/binutils-2.25/gas/testsuite/gas/all/float.s new file mode 100644 index 00000000..b098cad1 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/float.s @@ -0,0 +1,4 @@ + .text +foo: .single 0r1.2345e+06 + .single 0f3.14159 + .double 0r2.718282 diff --git a/binutils-2.25/gas/testsuite/gas/all/forward.d b/binutils-2.25/gas/testsuite/gas/all/forward.d new file mode 100644 index 00000000..8e45201c --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/forward.d @@ -0,0 +1,8 @@ +#objdump: -s -j .data +#name: forward references + +.*: .* + +Contents of section .data: + 0000 01020304 ff0203fc 01020304 ff0203fc ................ +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/forward.s b/binutils-2.25/gas/testsuite/gas/all/forward.s new file mode 100644 index 00000000..d51103ce --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/forward.s @@ -0,0 +1,44 @@ + .equiv two, 2*one + .equiv minus_one, -one + .equ one, 1 + .equiv three, 3*one + .eqv four, 4*one + + .data + + .if two > one + .byte one + .byte two + .endif + + .if four > one + .byte three + .byte four + .endif + + .equ one, -1 + .byte one + .byte two + + .if four < one + .byte three + .byte four + .endif + + .equ one, -minus_one + .byte one + .byte two + + .if four > one + .byte three + .byte four + .endif + + .equ one, minus_one + .byte one + .byte two + + .if four < one + .byte three + .byte four + .endif diff --git a/binutils-2.25/gas/testsuite/gas/all/fwdexp.d b/binutils-2.25/gas/testsuite/gas/all/fwdexp.d new file mode 100644 index 00000000..eee91c03 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/fwdexp.d @@ -0,0 +1,11 @@ +#objdump: -rs -j .text +#name: forward expression + +.*: .* + +RELOCATION RECORDS FOR .* +OFFSET +TYPE +VALUE +0+ .*(\.data|i)(|\+0xf+e|\+0xf+c|\+0xf+8|-0x0*2|-0x0*4|-0x0*8) + +Contents of section .* + 0+ (0+|feff|fffe|fcffffff|fffffffc|f8ffffff|f8ffffff ffffffff|ffffffff fffffff8|0+4) .* diff --git a/binutils-2.25/gas/testsuite/gas/all/fwdexp.s b/binutils-2.25/gas/testsuite/gas/all/fwdexp.s new file mode 100644 index 00000000..e1030995 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/fwdexp.s @@ -0,0 +1,6 @@ + .data +i: + + .text + .dc.a i + (. - .L1) +.L1: diff --git a/binutils-2.25/gas/testsuite/gas/all/gas.exp b/binutils-2.25/gas/testsuite/gas/all/gas.exp new file mode 100644 index 00000000..35bcd959 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/gas.exp @@ -0,0 +1,433 @@ +# Copyright 2012 +# Free Software Foundation, Inc. + +# 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. + +# +# These tests should be valid on all targets. +# + +# I think currently all targets fail this one when listings are enabled. +gas_test "p2425.s" "" "" "pcrel values in assignment" + +# p1480.s uses a ".space" directive which for most assemblers means +# "allocate some space". On the PA it means "switch into this space". +# +# Therefore this test (as it is currently written) is completely bogus +# for any PA target. Do not bother trying to run it and just claim +# it fails. +# +# The C54x uses ".space" to allocate bits, and requires absolute expressions; +# The ".space" directive is taken care of in the C54x-specific tests, so fail +# here +# +# The test also doesn't work on mep targets, since they use RELC, and it +# will avoid simplifying the expression since it conservatively assumes +# ugly expressions can be saved until link-time. +if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] || [istarget mep*-*-*]} then { + setup_xfail *-*-* + fail "simplifiable double subtraction" +} else { + gas_test "p1480.s" "" "-a>" "simplifiable double subtraction" +} + +# No floating point support in assembly code for CRIS and Z80. +if { ![istarget cris-*-*] && ![istarget crisv32-*-*] + && ![istarget z80-*-*] } then { + gas_test "float.s" "" "" "simple FP constants" +} + +# This test is meaningless for the PA; the difference of two undefined +# symbols is something that is (and must be) supported on the PA. +# The same is true for alpha-vms +# +# The MN10300 port supports link time relaxation which in turn allows +# for link time resolution of the differneces of two symbols which are +# undefined at assembly time. Hence this test will not pass for the +# MN10300. The same thing is true for the RX port as well. +if { ![istarget hppa*-*-*] + && ![istarget alpha*-*-*vms*] + && ![istarget rx-*-*] + && ![istarget mn10300-*-*] + && ![istarget msp430*-*-*] + && ![istarget am3*-*-*] } then { + gas_test_error "diff1.s" "" "difference of two undefined symbols" +} + +gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one" +gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression" + +# .equ works differently on some targets. +case $target_triplet in { + { hppa*-*-* } { } + { *c54x*-*-* } { } + default { + gas_test "equ-ok.s" "" "" ".equ for symbol already set" + gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv" + } +} + +gas_test "eqv-ok.s" "" "" ".eqv support" +gas_test_error "eqv-bad.s" "" ".eqv for symbol already set" + +if { ![istarget "bfin-*-*"] } then { + gas_test "assign-ok.s" "" "" "== assignment support" +} +gas_test_error "assign-bad.s" "" "== assignment for symbol already set" + +# .equ works differently on some targets. +# linkrelax-ing prevents most forward references from working. +case $target_triplet in { + { *c54x*-*-* } { } + { cr16*-*-* } { } + { crx*-*-* } { } + { h8300*-*-* } { } + { hppa*-*-* } { } + { mep-*-* } { } + { mn10\[23\]00*-*-* } { } + default { + # Some targets don't manage to resolve BFD_RELOC_8 for constants. + setup_xfail "alpha*-*-*" "*c30*-*-*" "*c4x*-*-*" \ + "d\[13\]0v*-*-*" "i860-*-*" "mips*-*-*" \ + "pdp11-*-*" "xtensa*-*-*" + run_dump_test forward + } +} + +# aout relocs are often weird, so is mep. don't bother testing +# som doesn't use a .text section +# mmix doesn't like .L1: +# ti addresses aren't octets. +if { ![is_aout_format] } { + case $target_triplet in { + { hppa*64*-*-* } { + run_dump_test fwdexp + } + { hppa*-*-hpux* } { } + { mep-*-* } { } + { mmix-*-* } { } + { tic30*-*-* } { } + { tic4x*-*-* } { } + { tic54x*-*-* } { } + default { + run_dump_test fwdexp + } + } +} + +# .set works differently on some targets. +# most of the tests won't work on targets that set linkrelax. +# 4 octet bytes confuse address matching on ti targets. +# pdp11 gets unexpected reloc types. +case $target_triplet in { + { alpha*-*-* } { } + { cr16*-*-* } { } + { crx*-*-* } { } + { h8300-*-* } { } + { mips*-*-* } { } + { mn10200-*-* } { } + { mn10300-*-* } { } + { msp430*-*-* } { } + { pdp11-*-* } { } + { tic30*-*-* } { } + { tic4x*-*-* } { } + { tic54x*-*-* } { } + { xtensa*-*-* } { } + { z80-*-* } { } + default { + run_dump_test redef + # These targets fail redef2 because they disallow redefined + # symbols on relocs. + setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" + setup_xfail "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*" + run_dump_test redef2 + setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" + setup_xfail "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*" + # rs6000-aix disallows redefinition via .comm. + setup_xfail "*-*-aix*" + # SOM uses a different syntax for .comm + setup_xfail "hppa*-*-hpux*" + # These targets fail redef3 because section contents for the + # word referencing the .comm sym is not zero and/or its reloc + # has a non-zero addend. Relaxing the test would hide real + # failures such as or32-elf. + setup_xfail "bfin-*-*" "i\[3-7\]86-*-*coff" \ + "i\[3-7\]86-*-*pe" "i\[3-7\]86-*-go32*" \ + "i\[3-7\]86-*-cygwin*" "i\[3-7\]86-*-mingw*" "x86_64-*-mingw*" + run_dump_test redef3 + gas_test_error "redef4.s" "" ".set for symbol already used as label" + gas_test_error "redef5.s" "" ".set for symbol already defined through .comm" + } +} + +proc do_comment {} { + set testname "comment.s: comments in listings" + set x1 0 + set x2 0 + set x3 0 + set white {[ \t]*} + gas_start "comment.s" "-al" + while 1 { +# Apparently CRLF is received when using ptys for subprocesses; hence the +# \r\n for line 3. + expect { + -re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 } + -re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 } + -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + gas_finish + if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname } +} + +# m32c pads out sections, even empty ones. +case $target_triplet in { + { m32c-*-* } { } + default { + do_comment + } +} + +# This test checks the output of the -ag switch. It must detect at least +# the name of the input file, output file, and options passed. +proc general_info_section {} { + set testname "general info section in listings" + set x1 0 + set x2 0 + set x3 0 + set white {[ \t]*} + gas_start "comment.s" "-agn" + while 1 { + expect { + -re "^ \[^\n\]*\t: .*\-agn\[^\n\]*\n" { set x1 1 } + -re "^ \[^\n\]*\t: \[^\n\]*comment\.s\[^\n\]*\n" { set x2 1 } + -re "^ \[^\n\]*\t: a\.out\[^\n\]*\n" { set x3 1 } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + gas_finish + if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname } +} + +general_info_section + +# +# Test x930509a -- correct assembly of differences involving forward +# references. +# + +proc do_930509a {} { + set testname "difference between forward references" + set x 0 + gas_start "x930509.s" "-al" + while 1 { +# We need to accomodate both byte orders here. +# If ".long" means an 8-byte value on some target someday, this test will have +# to be fixed. + expect { + -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 } + -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 } + -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 } + -re "\[^\n\]*\n" { } + timeout { perror "timeout\n"; break } + eof { break } + } + } + gas_finish + if !$x then { fail $testname } +} + +# This test is meaningless for the PA and CR16/CRX: the difference of two +# symbols cannot be resolved by the assembler. +# C54x assembler (for compatibility) does not allow differences between +# forward references. +# C30 counts a four byte offset as a difference of one. +if { ![istarget hppa*-*-*] && + ![istarget cr16*-*-*] && + ![istarget crx*-*-*] && + ![istarget *c30*-*-*] && + ![istarget *c4x*-*-*] && + ![istarget *c54x*-*-*] } then { + # the vax fails because VMS can apparently actually handle this + # case in relocs, so gas doesn't handle it itself. + # msp430 and mn10300 emit two relocs to handle the difference of two symbols. + setup_xfail "mn10300*-*-*" "msp430*-*-*" "vax*-*-vms*" + do_930509a +} + +# ".struct" and ".align" have different meanings on c54x +# These directives are done in the c54x-specific tests instead +case $target_triplet in { + { hppa*-*-* } { } + { *c4x*-*-* } { } + { *c54x*-*-* } { } + default { + run_dump_test struct + run_dump_test align + run_dump_test align2 + } +} + +# '<' and '>' appear to have special meanings on the excluded targets +case $target_triplet in { + { frv-*-* } { } + { hppa*-*-* } { } + { m32r-*-* } { } + { mmix-*-* } { } + { *c4x*-*-* } { } + { *c54x*-*-* } { } + { bfin-*-* } { } + default { + run_dump_test altmacro + # The second test is valid only when '!' is not a comment + # character (it is allowed to be a line comment character). + if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] { + run_dump_test altmac2 + # Similarly this test does not work when ! is a line seperator. + run_dump_test eval + } + } +} + +# This test is for any COFF target. +# We omit the ARM toolchains because they define locals to +# start with '.', which eliminates .eos, .text etc from the output. +# Omit c54x, since .tag and .def mean something different on that target +if { ([istarget *-*-coff*] && ![istarget arm*-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \ + ||([istarget *-*-pe*] && ![istarget arm*-*-pe*]) \ + || [istarget i*86-*-aix*] \ + || [istarget i*86-*-sco*] \ + || [istarget i*86-*-isc*] \ + || [istarget i*86-*-go32*] \ + || [istarget i*86-*-cygwin*] \ + || [istarget x86_64-*-mingw*] \ + || [istarget i*86-*-*nt] \ + || [istarget i*86-*-interix*] \ + || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } { + run_dump_test cofftag +} + +# Test omitting conditionals from listings. +proc test_cond {} { + global comp_output + global srcdir + global subdir + + set testname "conditional listings" + gas_run cond.s "-alc" ">dump.out" + if ![string match "" $comp_output] { + send_log "$comp_output\n" + fail $testname + } else { + if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } { + fail $testname + } else { + pass $testname + } + } +} + +# This test is not suitable for the PA for various reasons +# not limited to the fact that it depends on specific section +# names appearing in the output file. +# again, p2align doesn't work on c54x target +case $target_triplet in { + { hppa*-*-* } { } + { *c4x*-*-* } { } + { *c54x*-*-* } { } + { rx-*-* } { } + default { + test_cond + remote_download host "$srcdir/$subdir/incbin.dat" + run_dump_test incbin + } +} + +if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \ + || [istarget "i*86-*-cygwin*"] \ + || [istarget "i*86-*-mingw32*"] } { + gas_test "fastcall.s" "" "" "fastcall labels" +} + +if { ![istarget "bfin-*-*"] } then { + run_dump_test assign +} +run_dump_test sleb128 +run_dump_test sleb128-2 +run_dump_test sleb128-3 +run_dump_test sleb128-4 +run_dump_test sleb128-5 +# .byte is not 8 bits on either tic4x or tic54x +if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] } { + run_dump_test sleb128-7 +} + +# .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x +# .space is different on hppa*-hpux. +# MeP put bytes into packets. +if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] && ![istarget "hppa*-*-hpux*"] && ![istarget "mep*-*-*"] } { + run_dump_test relax +} + +# powerpc and s390 allow a string argument to .byte +if { ![istarget "powerpc*-*-*"] && ![istarget "rs6000*-*-*"] && ![istarget "s390*-*-*"] } { + run_dump_test byte +} + +# .quad is 16 bytes on i960. +if { ![istarget "i960-*-*"] } { + run_dump_test quad +} + +# som doesn't use .data section. +case $target_triplet in { + { hppa*64*-*-* } { + run_dump_test octa + } + { hppa*-*-hpux* } { } + default { + run_dump_test octa + } +} + +# .set works differently on some targets. +case $target_triplet in { + { alpha*-*-* } { } + { mips*-*-* } { } + { *c54x*-*-* } { } + { z80-*-* } { } + default { + run_dump_test weakref1 + run_dump_test weakref1g + run_dump_test weakref1l + run_dump_test weakref1u + run_dump_test weakref1w + } +} +gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e" +gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a" +gas_test_error "weakref4.s" "" "is already defined" + +run_dump_test string + +load_lib gas-dg.exp +dg-init +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" "" +dg-finish diff --git a/binutils-2.25/gas/testsuite/gas/all/incbin.d b/binutils-2.25/gas/testsuite/gas/all/incbin.d new file mode 100644 index 00000000..6505dc54 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/incbin.d @@ -0,0 +1,14 @@ +#as: -I$srcdir/$subdir +#objdump: -s -j .text +#name: incbin +#not-target: m32c-* + +# Test the incbin pseudo-op + +.*: .* + +Contents of section .text: + 0000 38383838 38383838 0c313232 3333330c 88888888.122333. + 0010 534f4d45 4d4f5245 44415441 44415441 SOMEMOREDATADATA + 0020 38383838 38383838 0c313232 3333330c 88888888.122333. + 0030 534f4d45 4d4f5245 44415441 44415441 SOMEMOREDATADATA diff --git a/binutils-2.25/gas/testsuite/gas/all/incbin.dat b/binutils-2.25/gas/testsuite/gas/all/incbin.dat new file mode 100644 index 00000000..8053dad4 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/incbin.dat @@ -0,0 +1 @@ +88888888122333SOMEMOREDATADATA
\ No newline at end of file diff --git a/binutils-2.25/gas/testsuite/gas/all/incbin.s b/binutils-2.25/gas/testsuite/gas/all/incbin.s new file mode 100644 index 00000000..dd4ebbd8 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/incbin.s @@ -0,0 +1,5 @@ + .text + .incbin "incbin.dat" + .incbin "incbin.dat",0,8 + .incbin "incbin.dat",8,8 + .incbin "incbin.dat",16,16 diff --git a/binutils-2.25/gas/testsuite/gas/all/itbl b/binutils-2.25/gas/testsuite/gas/all/itbl new file mode 100644 index 00000000..ac66dfbf --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/itbl @@ -0,0 +1,20 @@ + + ; Test case for assembler option "itbl". + ; Run as "as --itbl itbl itbl.s" + ; or with stand-alone test case "itbl-test itbl itbl.s". + ; The "p<n>" represent processors of a multi-processor system. + + p1 dreg d1 1 ; data register "d1" for COP1 has value 1 + p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3 + p3 insn fie 0x1e:24-20 ; function "fill" for COP3 has value 31 + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 insn fee 0x1e:24-20,dreg:17-13,creg:12-8,immed:7-0 + + p3 dreg d3 3 ; data register "d3" for COP3 has value 3 + p3 creg c2 22 ; control register "c2" for COP3 has value 22 + p3 insn fum 0x01e00001 dreg:17-13 creg:12-8 + p3 insn foh 0xf:24-21 dreg:20-16 immed:15-0 + + p3 insn pig 0x1:24-21*[0x100|0x2], dreg:20-16, immed:15-0*0x10000 + diff --git a/binutils-2.25/gas/testsuite/gas/all/itbl-test.c b/binutils-2.25/gas/testsuite/gas/all/itbl-test.c new file mode 100644 index 00000000..c00ff1ae --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/itbl-test.c @@ -0,0 +1,128 @@ +/* itbl-test.c + + Copyright (C) 1997-2013 Free Software Foundation. + + This file is part of GAS, the GNU Assembler. + + GAS 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, or (at your option) + any later version. + + GAS 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 GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +/* Stand-alone test for instruction specification table support. + Run using "itbl-test <itbl> <asm.s>" + where <itbl> is the name of the instruction table, + and <asm.s> is the name of the assembler fie. */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "itbl-ops.h" + +static int test_reg (e_processor processor, e_type type, char *name, + unsigned long val); + +int +main (int argc, char **argv) +{ + unsigned int insn; + FILE *fas; + int aline = 0; + char s[81], *name; + + if (argc < 3) + { + printf ("usage: %s itbl asm.s\n", argv[0]); + exit (0); + } + if (itbl_parse (argv[1]) != 0) + { + printf ("failed to parse itbl\n"); + exit (0); + } + + fas = fopen (argv[2], "r"); + if (fas == 0) + { + printf ("failed to open asm file %s\n", argv[2]); + exit (0); + } + while (fgets (s, 80, fas)) + { + char *p; + aline++; + + if (p = strchr (s, ';'), p) /* strip comments */ + *p = 0; + if (p = strchr (s, '#'), p) /* strip comments */ + *p = 0; + p = s + strlen (s) - 1; + while (p >= s && (*p == ' ' || *p == '\t' || *p == '\n')) /* strip trailing spaces */ + p--; + *(p + 1) = 0; + p = s; + while (*p && (*p == ' ' || *p == '\t' || *p == '\n')) /* strip leading spaces */ + p++; + if (!*p) + continue; + + name = itbl_get_field (&p); + insn = itbl_assemble (name, p); + if (insn == 0) + printf ("line %d: Invalid instruction (%s)\n", aline, s); + else + { + char buf[128]; + printf ("line %d: insn(%s) = 0x%x)\n", aline, s, insn); + if (!itbl_disassemble (buf, insn)) + printf ("line %d: Can't disassemble instruction " + "(0x%x)\n", aline, insn); + else + printf ("line %d: disasm(0x%x) = %s)\n", aline, insn, buf); + } + } + + test_reg (1, e_dreg, "d1", 1); + test_reg (3, e_creg, "c2", 22); + test_reg (3, e_dreg, "d3", 3); + + fclose (fas); + return 0; +} + +static int +test_reg (e_processor processor, e_type type, char *name, + unsigned long val) +{ + char *n; + unsigned long v; + + n = itbl_get_name (processor, type, val); + if (!n || strcmp (n, name)) + printf ("Error - reg name not found for proessor=%d, type=%d, val=%d\n", + processor, type, val); + else + printf ("name=%s found for processor=%d, type=%d, val=%d\n", + n, processor, type, val); + + /* We require that names be unique amoung processors and types. */ + if (! itbl_get_reg_val (name, &v) + || v != val) + printf ("Error - reg val not found for processor=%d, type=%d, name=%s\n", + processor, type, name); + else + printf ("val=0x%x found for processor=%d, type=%d, name=%s\n", + v, processor, type, name); + return 0; +} diff --git a/binutils-2.25/gas/testsuite/gas/all/itbl.s b/binutils-2.25/gas/testsuite/gas/all/itbl.s new file mode 100644 index 00000000..9351aa4b --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/itbl.s @@ -0,0 +1,13 @@ + + ; Test case for assembler option "itbl". + ; Run as "as --itbl itbl itbl.s" + ; or with stand-alone test case "itbl-test itbl itbl.s". + + ; Assemble processor instructions as defined in "itbl". + + fee $d3,$c2,0x1 ; 0x4ff07601 + fie ; 0x4ff00000 + foh $2,0x100 + fum $d3,$c2 ; 0x4ff07601 + pig $2,0x100 + diff --git a/binutils-2.25/gas/testsuite/gas/all/octa.d b/binutils-2.25/gas/testsuite/gas/all/octa.d new file mode 100644 index 00000000..21bc672d --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/octa.d @@ -0,0 +1,8 @@ +#objdump: -s -j .data +#name: octa bignum + +.*: +file format .* + +Contents of section .data: + [^ ]* (ffff3344 55667788 99aabbcc ddeeffff|ffffeedd ccbbaa99 88776655 4433ffff) .* + [^ ]* (00003444 55667788 99aabbcc ddeeffff|ffffeedd ccbbaa99 88776655 44340000) .* diff --git a/binutils-2.25/gas/testsuite/gas/all/octa.s b/binutils-2.25/gas/testsuite/gas/all/octa.s new file mode 100644 index 00000000..0d0ce144 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/octa.s @@ -0,0 +1,3 @@ + .data + .octa ~0x112233445566778899aabbcc0000 + .octa -347510587133311339321256747728896 diff --git a/binutils-2.25/gas/testsuite/gas/all/p1480.s b/binutils-2.25/gas/testsuite/gas/all/p1480.s new file mode 100644 index 00000000..9d0ba81a --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/p1480.s @@ -0,0 +1,3 @@ +start: .long 0, 1, 2, 3, 4, 5, 6, 7 + .space 0x80 - (. - start) +foo: .long 42 diff --git a/binutils-2.25/gas/testsuite/gas/all/p2425.s b/binutils-2.25/gas/testsuite/gas/all/p2425.s new file mode 100644 index 00000000..e02c6a1c --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/p2425.s @@ -0,0 +1,6 @@ + .text + .globl _frobnitz +_frobnitz: + .long 1, 2, 3, 4, 5, 6, 7, GRUMP, 42 + GRUMP==.-_frobnitz + HALFGRUMP==GRUMP/2 diff --git a/binutils-2.25/gas/testsuite/gas/all/quad.d b/binutils-2.25/gas/testsuite/gas/all/quad.d new file mode 100644 index 00000000..d0a8ddee --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/quad.d @@ -0,0 +1,12 @@ +#objdump : -s -j .data -j "\$DATA\$" +#name : .quad tests + +.*: .* + +Contents of section (\.data|\$DATA\$): + 0000 (00000000 76543210 00000000 80000000|10325476 00000000 00000080 00000000|00000000 54761032 00000000 00800000|32107654 00000000 00008000 00000000) .* + 00.. (00000000 87654321 00000000 ffffffff|21436587 00000000 ffffffff 00000000|00000000 65872143 00000000 ffffffff|43218765 00000000 ffffffff 00000000) .* + 00.. (ffffffff 89abcdf0 ffffffff 80000000|f0cdab89 ffffffff 00000080 ffffffff|ffffffff ab89f0cd ffffffff 00800000|cdf089ab ffffffff 00008000 ffffffff) .* + 00.. (ffffffff 789abcdf ffffffff 00000001|dfbc9a78 ffffffff 01000000 ffffffff|ffffffff 9a78dfbc ffffffff 00000100|bcdf789a ffffffff 00010000 ffffffff) .* + 00.. (01234567 89abcdef fedcba98 76543211|efcdab89 67452301 11325476 98badcfe|23016745 ab89efcd dcfe98ba 54761132|cdef89ab 45670123 32117654 ba98fedc) .* +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/quad.s b/binutils-2.25/gas/testsuite/gas/all/quad.s new file mode 100644 index 00000000..af250cda --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/quad.s @@ -0,0 +1,12 @@ + .data + .quad 0x76543210 + .quad 0x80000000 + .quad 0x87654321 + .quad 0xffffffff + .quad -0x76543210 + .quad -0x80000000 + .quad -0x87654321 + .quad -0xffffffff + + .quad 0x123456789abcdef + .quad -0x123456789abcdef diff --git a/binutils-2.25/gas/testsuite/gas/all/redef.d b/binutils-2.25/gas/testsuite/gas/all/redef.d new file mode 100644 index 00000000..33e149ca --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/redef.d @@ -0,0 +1,8 @@ +#objdump: -s -j .data -j "\$DATA\$" +#name: .equ redefinitions + +.*: .* + +Contents of section (\.data|\$DATA\$): + 0000 00000000 0[04]00000[04] 0[08]00000[08] 0[0c]00000[0c][ ]+................[ ]* +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/redef.s b/binutils-2.25/gas/testsuite/gas/all/redef.s new file mode 100644 index 00000000..896c4607 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/redef.s @@ -0,0 +1,11 @@ + .data +_start: + .set x, .-_start + .long x + .balign 4 + .set x, .-_start + .long x + .set x, .-_start + .long x + .set x, .-_start + .long x diff --git a/binutils-2.25/gas/testsuite/gas/all/redef2.d b/binutils-2.25/gas/testsuite/gas/all/redef2.d new file mode 100644 index 00000000..c50cd6c9 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/redef2.d @@ -0,0 +1,16 @@ +#objdump: -rs -j .data -j "\$DATA\$" +#name: .equ redefinitions (2) +#not-target: *-*-darwin* + +.*: .* + +RELOCATION RECORDS FOR .* +.* +0+00.*(here|\.data|\$DATA\$) +0+08.*xtrn +0+10.*(sym|(\.data|\$DATA\$)(\+0x0+10)?) +#... +Contents of section (\.data|\$DATA\$): + 0000 00000000 11111111 00000000 22222222[ ]+................[ ]* + 0010 [01]00000[01]0 .* +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/redef2.s b/binutils-2.25/gas/testsuite/gas/all/redef2.s new file mode 100644 index 00000000..89a29ac1 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/redef2.s @@ -0,0 +1,12 @@ + .data +here: + .set sym, here + .long sym + .set sym, 0x11111111 + .long sym + .set sym, xtrn + .long sym + .set sym, 0x22222222 + .long sym +sym: + .long sym diff --git a/binutils-2.25/gas/testsuite/gas/all/redef3.d b/binutils-2.25/gas/testsuite/gas/all/redef3.d new file mode 100644 index 00000000..a16fac3c --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/redef3.d @@ -0,0 +1,16 @@ +#objdump: -rsj .data +#name: .equ redefinitions (3) +#not-target: arc-*-* *-*darwin* + +.*: .* + +RELOCATION RECORDS FOR .* +.* +0+00.*(here|\.data) +0+08.*xtrn +0+10.*sym +#... +Contents of section \.data: + 0000 00000000 11111111 00000000 22222222[ ]+................[ ]* + 0010 00000000 .* +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/redef3.s b/binutils-2.25/gas/testsuite/gas/all/redef3.s new file mode 100644 index 00000000..2296d744 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/redef3.s @@ -0,0 +1,12 @@ + .data +here: + .set sym, here + .long sym + .set sym, 0x11111111 + .long sym + .set sym, xtrn + .long sym + .set sym, 0x22222222 + .long sym + .comm sym, 1 + .long sym diff --git a/binutils-2.25/gas/testsuite/gas/all/redef4.s b/binutils-2.25/gas/testsuite/gas/all/redef4.s new file mode 100644 index 00000000..8bd39438 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/redef4.s @@ -0,0 +1,3 @@ + .data +sym: + .set sym, 0 diff --git a/binutils-2.25/gas/testsuite/gas/all/redef5.s b/binutils-2.25/gas/testsuite/gas/all/redef5.s new file mode 100644 index 00000000..8a3a67a1 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/redef5.s @@ -0,0 +1,2 @@ + .comm sym, 1 + .set sym, 0 diff --git a/binutils-2.25/gas/testsuite/gas/all/relax.d b/binutils-2.25/gas/testsuite/gas/all/relax.d new file mode 100644 index 00000000..1e581c26 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/relax.d @@ -0,0 +1,13 @@ +#objdump : -s -j .data -j "\$DATA\$" +#name : relax .uleb128 + +.*: .* + +Contents of section .* + 0000 01020381 01000000 00000000 00000000.* +#... + 0080 00000004 ffff0500 06078380 01000000.* +#... + 4080 00000000 00000000 00000008 ffffffff.* + 4090 09090909 09090909 09090909 09090909.* +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/relax.s b/binutils-2.25/gas/testsuite/gas/all/relax.s new file mode 100644 index 00000000..104a8956 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/relax.s @@ -0,0 +1,20 @@ + .data + .byte 1, 2, 3 + .uleb128 L2 - L1 +L1: + .space 128 - 2 + .byte 4 + .p2align 1, 0xff +L2: + .byte 5 + + .p2align 2 + .byte 6, 7 + .uleb128 L4 - L3 +L3: + .space 128*128 - 2 + .byte 8 + .p2align 2, 0xff +L4: + .byte 9 + .p2align 4, 9 diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-2.d b/binutils-2.25/gas/testsuite/gas/all/sleb128-2.d new file mode 100644 index 00000000..cce0b4c0 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-2.d @@ -0,0 +1,7 @@ +#objdump : -s -j .data -j "\$DATA\$" +#name : .sleb128 tests (2) + +.*: .* + +Contents of section (\.data|\$DATA\$): + .* 7d2a.* diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-2.s b/binutils-2.25/gas/testsuite/gas/all/sleb128-2.s new file mode 100644 index 00000000..94f7afef --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-2.s @@ -0,0 +1,10 @@ + .text +_L1: + .byte 0 + .byte 0 + .byte 0 +_L2: + + .data + .sleb128 _L1 - _L2 + .byte 42 diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-3.d b/binutils-2.25/gas/testsuite/gas/all/sleb128-3.d new file mode 100644 index 00000000..deb48a69 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-3.d @@ -0,0 +1,7 @@ +#objdump : -s -j .data -j "\$DATA\$" +#name : .sleb128 tests (3) + +.*: .* + +Contents of section (\.data|\$DATA\$): + .* 9c7f2a.* diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-3.s b/binutils-2.25/gas/testsuite/gas/all/sleb128-3.s new file mode 100644 index 00000000..66d0a257 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-3.s @@ -0,0 +1,3 @@ + .data + .sleb128 100 - 200 + .byte 42 diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-4.d b/binutils-2.25/gas/testsuite/gas/all/sleb128-4.d new file mode 100644 index 00000000..89b95653 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-4.d @@ -0,0 +1,8 @@ +#objdump : -s -j .data -j "\$DATA\$" +#name : .sleb128 tests (4) +#skip: msp430*-*-* + +.*: .* + +Contents of section (\.data|\$DATA\$): + .* 83808080 082a.* diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-4.s b/binutils-2.25/gas/testsuite/gas/all/sleb128-4.s new file mode 100644 index 00000000..1bc561f6 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-4.s @@ -0,0 +1,10 @@ + .text +_L1: + .byte 0 + .byte 0 + .byte 0 +_L2: + + .data + .sleb128 _L2 - _L1 + (1 << 31) + .byte 42 diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-5.d b/binutils-2.25/gas/testsuite/gas/all/sleb128-5.d new file mode 100644 index 00000000..0accfb5a --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-5.d @@ -0,0 +1,7 @@ +#objdump : -s -j .data -j "\$DATA\$" +#name : .sleb128 tests (5) + +.*: .* + +Contents of section (\.data|\$DATA\$): + .* 012a.* diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-5.s b/binutils-2.25/gas/testsuite/gas/all/sleb128-5.s new file mode 100644 index 00000000..b31725ef --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-5.s @@ -0,0 +1,10 @@ + .text +_L1: + .byte 0 + .byte 0 + .byte 0 +_L2: + + .data + .sleb128 _L1 - _L2 + 4 + .byte 42 diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-7.d b/binutils-2.25/gas/testsuite/gas/all/sleb128-7.d new file mode 100644 index 00000000..6fcbdefe --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-7.d @@ -0,0 +1,7 @@ +#objdump : -s -j .data -j "\$DATA\$" +#name : .sleb128 tests (7) + +.*: .* + +Contents of section (\.data|\$DATA\$): + .* cb012ac5 012acb01 2ac5012a.* diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128-7.s b/binutils-2.25/gas/testsuite/gas/all/sleb128-7.s new file mode 100644 index 00000000..090217fd --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128-7.s @@ -0,0 +1,16 @@ + .text +_L1: + .byte 0 + .byte 0 + .byte 0 +_L2: + + .data + .sleb128 200+(_L2 - _L1) + .byte 42 + .sleb128 200+(_L1 - _L2) + .byte 42 + .sleb128 (_L2 - _L1)+200 + .byte 42 + .sleb128 (_L1 - _L2)+200 + .byte 42 diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128.d b/binutils-2.25/gas/testsuite/gas/all/sleb128.d new file mode 100644 index 00000000..993921ef --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128.d @@ -0,0 +1,57 @@ +#objdump : -s -j .data -j "\$DATA\$" +#name : .sleb128 tests + +.*: .* + +Contents of section (\.data|\$DATA\$): +# +# 0x76543210 : 000_0111 0110_010 1_0100_00 11_0010_0 001_0000 +# 0x80000000 : 000_1000 0000_000 0_0000_00 00_0000_0 000_0000 +# 0x87654321 : 000_1000 0111_011 0_0101_01 00_0011_0 010_0001 +# 0xffffffff : ..................................... 111_1111 +# + 0000 90e4d0b2 07808080 8008a186 95bb08ff .* +# +# 0xffffffff : 000_1111 1111_111 1_1111_11 11_1111_1 ........ +# -0x76543210 : 111_1000 1001_101 0_1011_11 00_1101_1 111_0000 +# -0x80000000 : 111_1000 0000_000 0_0000_00 00_0000_0 000_0000 +# -0x87654321 : ........................... 11_1100_1 101_1111 +# + 00.. ffffff0f f09bafcd 78808080 8078dff9 .* +# +# -0x87654321 : 111_0111 1000_100 1_1010_10 .................. +# -0xffffffff : 111_0000 0000_000 0_0000_00 00_0000_0 000_0001 +# 789abcdef : 111_1000 1001_101 0_1011_11 00_1101_1 110_1111 +# 0x123456 : ........ 0010_001 1_0100_01 01_0110_0 +# + 00.. eac47781 80808070 ef9bafcd f8acd191 .* +# +# 0x123456 : 000_0001 ............................ +# 789abcdef : 000_0111 0110_010 1_0100_00 11_0010_0 001_0001 +# -0x123456 : 111_1110 1101_110 0_1011_10 01_1001_1 +# fffffffff : 000_0000 0000_000 0_0000_00 00_0000_0 000_0001 +# -0x7ff : ......... 00_0000_0 +# + 00.. 0191e4d0 b287d3ae ee7e8180 80808080 .* +# +# -0x7ff : 1_1000_00 ......... +# 000000000 : 000_0000 0000_000 0_0000_00 00_0000_0 000_0000 +# -0x800 : 1_1000_00 00_0000_0 +# fffffffff : 000_0000 0000_000 0_0000_00 00_0000_0 000_0001 +# -0x7ffffff : .................. 0000_000 0_0000_00 00_0000_0 +# + 00.. 60808080 80808060 81808080 80808080 .* +# +# -0x7ffffff : 11_1111_1 000_0000 ............................ +# 000000000 : 000_0000 0000_000 0_0000_00 00_0000_0 000_0000 +# -0x8000000 : 11_1111_1 000_0000 0000_000 0_0000_00 00_0000_0 +# -0x100000000 : ........ 0000_000 0_0000_00 00_0000_0 000_0000 +# + 00.. 807f8080 80808080 8080807f 80808080 .* +# +# -0x100000000 : 111_0000 ..................................... +# 000000000 : 000_0000 0000_000 0_0000_00 00_0000_0 000_0000 +# -0x1000 : 1_0000_00 00_0000_0 +# + 00.. 70808080 80808040 00000000 00000000 .* +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/sleb128.s b/binutils-2.25/gas/testsuite/gas/all/sleb128.s new file mode 100644 index 00000000..e8997ca1 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/sleb128.s @@ -0,0 +1,22 @@ + .data + .sleb128 0x76543210 + .sleb128 0x80000000 + .sleb128 0x87654321 + .sleb128 0xffffffff + .sleb128 -0x76543210 + .sleb128 -0x80000000 + .sleb128 -0x87654321 + .sleb128 -0xffffffff + + .sleb128 0x123456789abcdef + .sleb128 -0x123456789abcdef + + .sleb128 -0x7fffffffffff + .sleb128 -0x800000000000 + .sleb128 -0x7fffffffffffffff + .sleb128 -0x8000000000000000 + + .sleb128 -0x100000000 + .sleb128 -0x1000000000000 + + .fill 32 diff --git a/binutils-2.25/gas/testsuite/gas/all/string.d b/binutils-2.25/gas/testsuite/gas/all/string.d new file mode 100644 index 00000000..b8bfd846 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/string.d @@ -0,0 +1,11 @@ +#objdump : -s -j .data -j "\$DATA\$" +#name : .strings tests + +.*: .* + +Contents of section (\.data|\$DATA\$): + 0000 7374726e 65773800 00000000 00000000 strnew8.* + 00.. (73007400 72003100 36000000 00000000|00730074 00720031 00360000 00000000).* + 00.. (33000000 32000000 00000000 00000000|00000033 00000032 00000000 00000000).* + 00.. (36000000 00000000 34000000 00000000|00000000 00000036 00000000 00000034).* +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/string.s b/binutils-2.25/gas/testsuite/gas/all/string.s new file mode 100644 index 00000000..6565a71a --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/string.s @@ -0,0 +1,11 @@ + .data + .string8 "strnew8" + + .balign 16 + .string16 "str16" + + .balign 16 + .string32 "32" + + .balign 16 + .string64 "64" diff --git a/binutils-2.25/gas/testsuite/gas/all/struct.d b/binutils-2.25/gas/testsuite/gas/all/struct.d new file mode 100644 index 00000000..8dc5dd48 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/struct.d @@ -0,0 +1,8 @@ +#nm: --extern-only +#name: struct + +# Test the .struct pseudo-op. + +0+00 A w1 +0+02 A w2 +0+04 A w3 diff --git a/binutils-2.25/gas/testsuite/gas/all/struct.s b/binutils-2.25/gas/testsuite/gas/all/struct.s new file mode 100644 index 00000000..9ecfd0bc --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/struct.s @@ -0,0 +1,10 @@ + .globl w1 + .globl w2 + .globl w3 + .long 0 + .struct 0 +w1: .short 0 +w2: .short 0 +w3: .short 0 + .text + .long 0 diff --git a/binutils-2.25/gas/testsuite/gas/all/test-example.c b/binutils-2.25/gas/testsuite/gas/all/test-example.c new file mode 100644 index 00000000..704dc5db --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/test-example.c @@ -0,0 +1,103 @@ +/* Copyright (C) 2000, 2003, 2005, 2007 Free Software Foundation + Contributed by Alexandre Oliva <aoliva@cygnus.com> + + 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Generator of tests for insns introduced in AM33 2.0. + + See the following file for usage and documentation. */ +#include "../all/test-gen.c" + +/* Define any char*[]s you may need here. */ +char *named_regs[] = { "a", "b", "c", "d" }; + +/* Define helper macros to generate register accesses here. */ +#define namedregs(shift) \ + reg_r (named_regs, shift, 0x3, mk_get_bits (2u)) +#define numberedregs(shift) \ + reg_p ("f", shift, mk_get_bits (2u)) + +/* Define helper functions here. */ +int +jmp_cond (func_arg * arg, insn_data * data) +#define jmp_cond(shift) { jmp_cond, { i1: shift } } +{ + static const char conds[4][2] = { "z", "n", "g", "l" }; + unsigned val = get_bits (2u); + + data->as_in = data->dis_out = strdup (conds[val]); + data->bits = val << arg->i1; + + /* Do not forget to return 0, otherwise the insn will be skipped. */ + return 0; +} + +/* Define convenience wrappers to define_insn. */ +#define cond_jmp_insn(insname, word, funcs...) \ + define_insn (insname, \ + insn_size_bits (insname, 1, word), \ + jmp_cond (4), \ + tab, \ + ## funcs) + +/* Define insns. */ +cond_jmp_insn (j, 0x40, numberedregs(2), comma, namedregs (0)); + +/* Define an insn group. */ +func *jmp_insns[] = + { + insn (j), + 0 + }; + +/* Define the set of all groups. */ +group_t +groups[] = + { + { "jumps", jmp_insns }, + { 0 } + }; + +int +main (int argc, char *argv[]) +{ + FILE *as_in = stdout, *dis_out = stderr; + + /* Check whether we're filtering insns. */ + if (argc > 1) + skip_list = argv + 1; + + /* Output assembler header. */ + fputs ("\t.text\n" + "\t.align\n", + as_in); + /* Output comments for the testsuite-driver and the initial + disassembler output. */ + fputs ("#objdump: -dr --prefix-address --show-raw-insn\n" + "#name: Foo Digital Processor\n" + "#as: -mfood\n" + "\n" + "# Test the instructions of FooD\n" + "\n" + ".*: +file format.*food.*\n" + "\n" + "Disassembly of section .text:\n", + dis_out); + + /* Now emit all (selected) insns. */ + output_groups (groups, as_in, dis_out); + + exit (0); +} diff --git a/binutils-2.25/gas/testsuite/gas/all/test-gen.c b/binutils-2.25/gas/testsuite/gas/all/test-gen.c new file mode 100644 index 00000000..96aaeb81 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/test-gen.c @@ -0,0 +1,744 @@ +#ifndef TEST_GEN_C +#define TEST_GEN_C 1 + +/* Copyright (C) 2000, 2003, 2005, 2007 Free Software Foundation + Contributed by Alexandre Oliva <aoliva@cygnus.com> + + 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* This is a source file with infra-structure to test generators for + assemblers and disassemblers. + + The strategy to generate testcases is as follows. We'll output to + two streams: one will get the assembly source, and the other will + get regexps that match the expected binary patterns. + + To generate each instruction, the functions of a func[] are called, + each with the corresponding func_arg. Each function should set + members of insn_data, to decide what it's going to output to the + assembly source, the corresponding output for the disassembler + tester, and the bits to be set in the instruction word. The + strings to be output must have been allocated with strdup() or + malloc(), so that they can be freed. A function may also modify + insn_size. More details in test-gen.c + + Because this would have generated too many tests, we have chosen to + define ``random'' sequences of numbers/registers, and simply + generate each instruction a couple of times, which should get us + enough coverage. + + In general, test generators should be compiled/run as follows: + + % gcc test.c -o test + % ./test > test.s 2 > test.d + + Please note that this file contains a couple of GCC-isms, such as + macro varargs (also available in C99, but with a difference syntax) + and labeled elements in initializers (so that insn definitions are + simpler and safer). + + It is assumed that the test generator #includes this file after + defining any of the preprocessor macros documented below. The test + generator is supposed to define instructions, at least one group of + instructions, optionally, a sequence of groups. + + It should also define a main() function that outputs the initial + lines of the assembler input and of the test control file, that + also contains the disassembler output. The main() funcion may + optionally set skip_list too, before calling output_groups() or + output_insns(). */ + +/* Define to 1 to avoid repeating instructions and to use a simpler + register/constant generation mechanism. This makes it much easier + to verify that the generated bit patterns are correct. */ +#ifndef SIMPLIFY_OUTPUT +#define SIMPLIFY_OUTPUT 0 +#endif + +/* Define to 0 to avoid generating disassembler tests. */ +#ifndef DISASSEMBLER_TEST +#define DISASSEMBLER_TEST 1 +#endif + +/* Define to the number of times to repeat the generation of each + insn. It's best to use prime numbers, to improve randomization. */ +#ifndef INSN_REPEAT +#define INSN_REPEAT 5 +#endif + +/* Define in order to get randomization_counter printed, as a comment, + in the disassembler output, after each insn is emitted. */ +#ifndef OUTPUT_RANDOMIZATION_COUNTER +#define OUTPUT_RANDOMIZATION_COUNTER 0 +#endif + +/* Other configuration macros are DEFINED_WORD and DEFINED_FUNC_ARG, + see below. */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* It is expected that the main program defines the type `word' before + includeing this. */ +#ifndef DEFINED_WORD +typedef unsigned long long word; +#endif + +/* This struct is used as the output area for each function. It + should store in as_in a pointer to the string to be output to the + assembler; in dis_out, the string to be expected in return from the + disassembler, and in bits the bits of the instruction word that are + enabled by the assembly fragment. */ +typedef struct +{ + char * as_in; + char * dis_out; + word bits; +} insn_data; + +#ifndef DEFINED_FUNC_ARG +/* This is the struct that feeds information to each function. You're + free to extend it, by `typedef'ing it before including this file, + and defining DEFINED_FUNC_ARG. You may even reorder the fields, + but do not remove any of the existing fields. */ +typedef struct +{ + int i1; + int i2; + int i3; + void * p1; + void * p2; + word w; +} func_arg; +#endif + +/* This is the struct whose arrays define insns. Each func in the + array will be called, in sequence, being given a pointer to the + associated arg and a pointer to a zero-initialized output area, + that it may fill in. */ +typedef struct +{ + int (* func) (func_arg *, insn_data *); + func_arg arg; +} func; + +/* Use this to group insns under a name. */ +typedef struct +{ + const char * name; + func ** insns; +} group_t; + +/* This is the size of each instruction. Use `insn_size_bits' instead + of `insn_bits' in an insn defition to modify it. */ +int insn_size = 4; + +/* The offset of the next insn, as expected in the disassembler + output. */ +int current_offset = 0; + +/* The offset and name of the last label to be emitted. */ +int last_label_offset = 0; +const char * last_label_name = 0; + +/* This variable may be initialized in main() to `argv+1', if + `argc>1', so that tests are emitted only for instructions that + match exactly one of the given command-line arguments. If it is + NULL, tests for all instructions are emitted. It must be a + NULL-terminated array of pointers to strings (just like + `argv+1'). */ +char ** skip_list = 0; + +/* This is a counter used to walk the various arrays of ``random'' + operand generation. In simplified output mode, it is zeroed after + each insn, otherwise it just keeps growing. */ +unsigned randomization_counter = 0; + +/* Use `define_insn' to create an array of funcs to define an insn, + then `insn' to refer to that insn when defining an insn group. */ +#define define_insn(insname, funcs...) \ + func i_ ## insname[] = { funcs, { 0 } } +#define insn(insname) (i_ ## insname) + +/* Use these to output a comma followed by an optional space, a single + space, a plus sign, left and right square brackets and parentheses, + all of them properly quoted. */ +#define comma literal_q (", ", ", ?") +#define space literal (" ") +#define tab literal ("\t") +#define plus literal_q ("+", "\\+") +#define lsqbkt literal_q ("[", "\\[") +#define rsqbkt literal_q ("]", "\\]") +#define lparen literal_q ("(", "\\(") +#define rparen literal_q (")", "\\)") + +/* Use this as a placeholder when you define a macro that expects an + argument, but you don't have anything to output there. */ +int +nothing (func_arg *arg, insn_data *data) +#define nothing { nothing } +{ + return 0; +} + +/* This is to be used in the argument list of define_insn, causing a + string to be copied into both the assembly and the expected + disassembler output. It is assumed not to modify the binary + encoding of the insn. */ +int +literal (func_arg *arg, insn_data *data) +#define literal(s) { literal, { p1: (s) } } +{ + data->as_in = data->dis_out = strdup ((char *) arg->p1); + return 0; +} + +/* The characters `[', `]', `\\' and `^' must be quoted in the + disassembler-output matcher. If a literal string contains any of + these characters, use literal_q instead of literal, and specify the + unquoted version (for as input) as the first argument, and the + quoted version (for expected disassembler output) as the second + one. */ +int +literal_q (func_arg *arg, insn_data *data) +#define literal_q(s,q) { literal_q, { p1: (s), p2: (q) } } +{ + data->as_in = strdup ((char *) arg->p1); + data->dis_out = strdup ((char *) arg->p2); + return 0; +} + +/* Given an insn name, check whether it should be skipped or not, + depending on skip_list. Return non-zero if the insn is to be + skipped. */ +int +skip_insn (char *name) +{ + char **test; + + if (! skip_list) + return 0; + + for (test = skip_list; * test; ++ test) + if (strcmp (name, * test) == 0) + return 0; + + return 1; +} + +/* Use this to emit the actual insn name, with its opcode, in + architectures with fixed-length instructions. */ +int +insn_bits (func_arg *arg, insn_data *data) +#define insn_bits(name,bits) \ + { insn_bits, { p1: # name, w: bits } } +{ + if (skip_insn ((char *) arg->p1)) + return 1; + data->as_in = data->dis_out = strdup ((char *) arg->p1); + data->bits = arg->w; + return 0; +} + +/* Use this to emit the insn name and its opcode in architectures + without a variable instruction length. */ +int +insn_size_bits (func_arg *arg, insn_data *data) +#define insn_size_bits(name,size,bits) \ + { insn_size_bits, { p1: # name, i1: size, w: bits } } +{ + if (skip_insn ((char *) arg->p1)) + return 1; + data->as_in = data->dis_out = strdup ((char *) arg->p1); + data->bits = arg->w; + insn_size = arg->i1; + return 0; +} + +/* Use this to advance the random generator by one, in case it is + generating repetitive patterns. It is usually good to arrange that + each insn consumes a prime number of ``random'' numbers, or, at + least, that it does not consume an exact power of two ``random'' + numbers. */ +int +tick_random (func_arg *arg, insn_data *data) +#define tick_random { tick_random } +{ + ++ randomization_counter; + return 0; +} + +/* Select the next ``random'' number from the array V of size S, and + advance the counter. */ +#define get_bits_from_size(V,S) \ + ((V)[randomization_counter ++ % (S)]) + +/* Utility macros. `_get_bits_var', used in some macros below, assume + the names of the arrays used to define the ``random'' orders start + with `random_order_'. */ +#define _get_bits_var(N) (random_order_ ## N) +#define _get_bits_size(V) (sizeof (V) / sizeof * (V)) + +/* Use this within a `func_arg' to select one of the arrays below (or + any other array that starts with random_order_N. */ +#define mk_get_bits(N) \ + p2: _get_bits_var (N), i3: _get_bits_size (_get_bits_var (N)) + +/* Simplified versions of get_bits_from_size for when you have access + to the array, so that its size can be implicitly calculated. */ +#define get_bits_from(V) get_bits_from_size ((V),_get_bits_size ((V))) +#define get_bits(N) get_bits_from (_get_bits_var (N)) + + +/* Use `2u' to generate 2-bit unsigned values. Good for selecting + registers randomly from a set of 4 registers. */ +unsigned random_order_2u[] = + { + /* This sequence was generated by hand so that no digit appers more + than once in any horizontal or vertical line. */ + 0, 1, 3, 2, + 2, 0, 1, 3, + 1, 3, 2, 0, + 3, 2, 0, 1 + }; + +/* Use `3u' to generate 3-bit unsigned values. Good for selecting + registers randomly from a set of 8 registers. */ +unsigned random_order_3u[] = + { + /* This sequence was generated by: + f(k) = 3k mod 8 + except that the middle pairs were swapped. */ + 0, 6, 3, 1, 4, 2, 7, 5, + /* This sequence was generated by: + f(k) = 5k mod 8 + except that the middle pairs were swapped. */ + 0, 2, 5, 7, 4, 6, 1, 3, + }; + +/* Use `4u' to generate 4-bit unsigned values. Good for selecting + registers randomly from a set of 16 registers. */ +unsigned random_order_4u[] = + { + /* This sequence was generated by: + f(k) = 5k mod 16 + except that the middle pairs were swapped. */ + 0, 5, 15, 10, 9, 4, 14, 3, + 8, 13, 7, 2, 1, 12, 6, 11, + /* This sequence was generated by: + f(k) = 7k mod 16 + except that the middle pairs were swapped. */ + 0, 7, 5, 14, 3, 12, 10, 1, + 8, 15, 13, 6, 11, 4, 2, 9, + }; + +/* Use `5u' to generate 5-bit unsigned values. Good for selecting + registers randomly from a set of 32 registers. */ +unsigned random_order_5u[] = + { + /* This sequence was generated by: + f(k) = (13k) mod 32 + except that the middle pairs were swapped. */ + 0, 26, 13, 7, 20, 14, 1, 27, + 8, 2, 21, 15, 28, 22, 9, 3, + 16, 10, 29, 23, 4, 30, 17, 11, + 24, 18, 5, 31, 12, 6, 25, 19 + }; + +/* Use `7s' to generate 7-bit signed values. Good for selecting + ``interesting'' constants from -64 to +63. */ +int random_order_7s[] = + { + /* Sequence generated by hand, to explore limit values and a few + intermediate values selected by chance. Keep the number of + intermediate values low, to ensure that the limit values are + generated often enough. */ + 0, -1, -64, 63, -32, 32, 24, -20, + 9, -27, -31, 33, 40, -2, -5, 1 + }; + +/* Use `8s' to generate 8-bit signed values. Good for selecting + ``interesting'' constants from -128 to +127. */ +int random_order_8s[] = + { + /* Sequence generated by hand, to explore limit values and a few + intermediate values selected by chance. Keep the number of + intermediate values low, to ensure that the limit values are + generated often enough. */ + 0, -1, -128, 127, -32, 32, 24, -20, + 73, -27, -95, 33, 104, -2, -69, 1 + }; + +/* Use `9s' to generate 9-bit signed values. Good for selecting + ``interesting'' constants from -256 to +255. */ +int random_order_9s[] = + { + /* Sequence generated by hand, to explore limit values and a few + intermediate values selected by chance. Keep the number of + intermediate values low, to ensure that the limit values are + generated often enough. */ + 0, -1, -256, 255, -64, 64, 72, -40, + 73, -137, -158, 37, 104, -240, -69, 1 + }; + +/* Use `16s' to generate 16-bit signed values. Good for selecting + ``interesting'' constants from -32768 to +32767. */ +int random_order_16s[] = + { + /* Sequence generated by hand, to explore limit values and a few + intermediate values selected by chance. Keep the number of + intermediate values low, to ensure that the limit values are + generated often enough. */ + -32768, + 32767, + (-1 << 15) | (64 << 8) | 32, + (64 << 8) | 32, + 0x1234, + (-1 << 15) | 0x8765, + 0x0180, + (-1 << 15) | 0x8001 +}; + +/* Use `24s' to generate 24-bit signed values. Good for selecting + ``interesting'' constants from -2^23 to 2^23-1. */ +int random_order_24s[] = + { + /* Sequence generated by hand, to explore limit values and a few + intermediate values selected by chance. Keep the number of + intermediate values low, to ensure that the limit values are + generated often enough. */ + -1 << 23, + 1 << 23 -1, + (-1 << 23) | (((64 << 8) | 32) << 8) | 16, + (((64 << 8) | 32) << 8) | 16, + 0x123456, + (-1 << 23) | 0x876543, + 0x01ff80, + (-1 << 23) | 0x80ff01 +}; + +/* Use `32s' to generate 32-bit signed values. Good for selecting + ``interesting'' constants from -2^31 to 2^31-1. */ +int random_order_32s[] = + { + /* Sequence generated by hand, to explore limit values and a few + intermediate values selected by chance. Keep the number of + intermediate values low, to ensure that the limit values are + generated often enough. */ + -1 << 31, + 1 << 31 - 1, + (-1 << 31) | (((((64 << 8) | 32) << 8) | 16) << 8) | 8, + (((((64 << 8) | 32) << 8) | 16) << 8) | 8, + 0x12345678, + (-1 << 31) | 0x87654321, + 0x01ffff80, + (-1 << 31) | 0x80ffff01 + }; + +/* This function computes the number of digits needed to represent a + given number. */ +unsigned long +ulen (unsigned long i, unsigned base) +{ + int count = 0; + + if (i == 0) + return 1; + for (; i > 0; ++ count) + i /= base; + return count; +} + +/* Use this to generate a signed constant of the given size, shifted + by the given amount, with the specified endianness. */ +int +signed_constant (func_arg * arg, insn_data * data) +#define signed_constant(bits, shift, revert) \ + { signed_constant, { i1: shift, i2: bits * (revert ? -1 : 1), \ + mk_get_bits (bits ## s) } } +{ + long val = get_bits_from_size ((unsigned *) arg->p2, arg->i3); + int len = (val >= 0 ? ulen (val, 10) : (1 + ulen (-val, 10))); + int nbits = (arg->i2 >= 0 ? arg->i2 : -arg->i2); + word bits = ((word) val) & (((((word) 1) << (nbits - 1)) << 1) - 1); + + data->as_in = data->dis_out = malloc (len + 1); + sprintf (data->as_in, "%ld", val); + if (arg->i2 < 0) + { + word rbits = 0; + + do + { + rbits <<= 8; + rbits |= bits & 0xff; + bits >>= 8; + nbits -= 8; + } + while (nbits > 0); + + bits = rbits; + } + data->bits = bits << arg->i1; + + return 0; +} + +/* Use this to generate a unsigned constant of the given size, shifted + by the given amount, with the specified endianness. */ +int +unsigned_constant (func_arg * arg, insn_data * data) +#define unsigned_constant(bits, shift, revert) \ + { unsigned_constant, { i1: shift, i2: bits * (revert ? -1 : 1), \ + mk_get_bits (bits ## s) } } +{ + int nbits = (arg->i2 >= 0 ? arg->i2 : -arg->i2); + unsigned long val = + get_bits_from_size ((unsigned *) arg->p2, arg->i3) + & (((((word) 1) << (nbits - 1)) << 1) - 1); + int len = ulen (val, 10); + word bits = val; + + data->as_in = data->dis_out = malloc (len + 1); + sprintf (data->as_in, "%lu", val); + if (arg->i2 < 0) + { + word rbits = 0; + + do + { + rbits <<= 8; + rbits |= bits & 0xff; + bits >>= 8; + nbits -= 8; + } + while (nbits > 0); + + bits = rbits; + } + data->bits = bits << arg->i1; + + return 0; +} + +/* Use this to generate an absolute address of the given size, shifted + by the given amount, with the specified endianness. */ +int +absolute_address (func_arg *arg, insn_data *data) +#define absolute_address (bits, shift, revert) \ + { absolute_address, { i1: shift, i2: bits * (revert ? -1 : 1), \ + mk_get_bits (bits ## s) } } +{ + int nbits = (arg->i2 >= 0 ? arg->i2 : -arg->i2); + unsigned long val = + get_bits_from_size ((unsigned *) arg->p2, arg->i3) + & (((((word) 1) << (nbits - 1)) << 1) - 1); + word bits = val; + + data->as_in = malloc (ulen (val, 10) + 1); + sprintf (data->as_in, "%lu", val); + data->dis_out = malloc (nbits / 4 + 11); + sprintf (data->dis_out, "0*%0*lx <[^>]*>", nbits / 4, val); + if (arg->i2 < 0) + { + word rbits = 0; + + do + { + rbits <<= 8; + rbits |= bits & 0xff; + bits >>= 8; + nbits -= 8; + } + while (nbits > 0); + + bits = rbits; + } + data->bits = bits << arg->i1; + + return 0; +} + +/* Use this to generate a register name that starts with a given + prefix, and is followed by a number generated by `gen' (see + mk_get_bits below). The register number is shifted `shift' bits + left before being stored in the binary insn. */ +int +reg_p (func_arg *arg, insn_data *data) +#define reg_p(prefix,shift,gen) \ + { reg_p, { i1: (shift), p1: (prefix), gen } } +{ + unsigned reg = get_bits_from_size ((unsigned *) arg->p2, arg->i3); + char *regname = (char *) arg->p1; + + data->as_in = data->dis_out = malloc (strlen (regname) + ulen (reg, 10) + 1); + sprintf (data->as_in, "%s%u", regname, reg); + data->bits = reg; + data->bits <<= arg->i1; + return 0; +} + +/* Use this to generate a register name taken from an array. The + index into the array `names' is to be produced by `gen', but `mask' + may be used to filter out some of the bits before choosing the + disassembler output and the bits for the binary insn, shifted left + by `shift'. For example, if registers have canonical names, but + can also be referred to by aliases, the array can be n times larger + than the actual number of registers, and the mask is then used to + pick the canonical name for the disassembler output, and to + eliminate the extra bits from the binary output. */ +int +reg_r (func_arg *arg, insn_data *data) +#define reg_r(names,shift,mask,gen) \ + { reg_r, { i1: (shift), i2: (mask), p1: (names), gen } } +{ + unsigned reg = get_bits_from_size ((unsigned *) arg->p2, arg->i3); + + data->as_in = strdup (((const char **) arg->p1)[reg]); + reg &= arg->i2; + data->dis_out = strdup (((const char **) arg->p1)[reg]); + data->bits = reg; + data->bits <<= arg->i1; + return 0; +} + +/* Given a NULL-terminated array of insns-definitions (pointers to + arrays of funcs), output test code for the insns to as_in (assembly + input) and dis_out (expected disassembler output). */ +void +output_insns (func **insn, FILE *as_in, FILE *dis_out) +{ + for (; *insn; ++insn) + { + insn_data *data; + func *parts = *insn; + int part_count = 0, r; + + /* Figure out how many funcs have to be called. */ + while (parts[part_count].func) + ++part_count; + + /* Allocate storage for the output area of each func. */ + data = (insn_data*) malloc (part_count * sizeof (insn_data)); + +#if SIMPLIFY_OUTPUT + randomization_counter = 0; +#else + /* Repeat each insn several times. */ + for (r = 0; r < INSN_REPEAT; ++r) +#endif + { + unsigned saved_rc = randomization_counter; + int part; + word bits = 0; + + for (part = 0; part < part_count; ++part) + { + /* Zero-initialize the storage. */ + data[part].as_in = data[part].dis_out = 0; + data[part].bits = 0; + /* If a func returns non-zero, skip this line. */ + if (parts[part].func (&parts[part].arg, &data[part])) + goto skip; + /* Otherwise, get its output bit pattern into the total + bit pattern. */ + bits |= data[part].bits; + } + + if (as_in) + { + /* Output the whole assembly line. */ + fputc ('\t', as_in); + for (part = 0; part < part_count; ++part) + if (data[part].as_in) + fputs (data[part].as_in, as_in); + fputc ('\n', as_in); + } + + if (dis_out) + { + /* Output the disassembler expected output line, + starting with the offset and the insn binary pattern, + just like objdump outputs. Because objdump sometimes + inserts spaces between each byte in the insn binary + pattern, make the space optional. */ + fprintf (dis_out, "0*%x <", current_offset); + if (last_label_name) + if (current_offset == last_label_offset) + fputs (last_label_name, dis_out); + else + fprintf (dis_out, "%s\\+0x%x", last_label_name, + current_offset - last_label_offset); + else + fputs ("[^>]*", dis_out); + fputs ("> ", dis_out); + for (part = insn_size; part-- > 0; ) + fprintf (dis_out, "%02x ?", (int)(bits >> (part * 8)) & 0xff); + fputs (" *\t", dis_out); + +#if DISASSEMBLER_TEST + for (part = 0; part < part_count; ++part) + if (data[part].dis_out) + fputs (data[part].dis_out, dis_out); +#else + /* If we're not testing the DISASSEMBLER, just match + anything. */ + fputs (".*", dis_out); +#endif + fputc ('\n', dis_out); +#if OUTPUT_RANDOMIZATION_COUNTER + fprintf (dis_out, "# %i\n", randomization_counter); +#endif + } + + /* Account for the insn_size bytes we've just output. */ + current_offset += insn_size; + + /* Release the memory that each func may have allocated. */ + for (; part-- > 0;) + { + skip: + if (data[part].as_in) + free (data[part].as_in); + if (data[part].dis_out + && data[part].dis_out != data[part].as_in) + free (data[part].dis_out); + } + + /* There's nothing random here, don't repeat this insn. */ + if (randomization_counter == saved_rc) + break; + } + + free (data); + } +} + +/* For each group, output an asm label and the insns of the group. */ +void +output_groups (group_t group[], FILE *as_in, FILE *dis_out) +{ + for (; group->name; ++group) + { + fprintf (as_in, "%s:\n", group->name); + fprintf (dis_out, "# %s:\n", group->name); + last_label_offset = current_offset; + last_label_name = group->name; + output_insns (group->insns, as_in, dis_out); + } +} + +#endif diff --git a/binutils-2.25/gas/testsuite/gas/all/warn-1.s b/binutils-2.25/gas/testsuite/gas/all/warn-1.s new file mode 100644 index 00000000..873f2308 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/warn-1.s @@ -0,0 +1,7 @@ +;# Test .warning directive. +;# { dg-do assemble } + .warning "a warning message" ;# { dg-warning "Warning: a warning message" } + .warning a warning message ;# { dg-error "Error: .warning argument must be a string" } + .warning ;# { dg-warning "Warning: .warning directive invoked in source file" } + .warning ".warning directive invoked in source file" ;# { dg-warning "Warning: .warning directive invoked in source file" } + .warning "" ;# { dg-warning "Warning: " } diff --git a/binutils-2.25/gas/testsuite/gas/all/weakref1.d b/binutils-2.25/gas/testsuite/gas/all/weakref1.d new file mode 100644 index 00000000..d1167077 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/weakref1.d @@ -0,0 +1,97 @@ +#objdump: -r +#name: weakref tests, relocations +# ecoff (OSF/alpha) lacks .weak support +# pdp11 lacks .long +# darwin (mach-o) reverses the order of relocs. +# the following must be present in all weakref1*.d +#not-target: alpha*-*-osf* *-*-ecoff pdp11-*-aout *-*-darwin* + +#... +RELOCATION RECORDS FOR \[(\.text|\$CODE\$)\]: +OFFSET +TYPE +VALUE * +# the rest of this file is generated with the following script: +# # script begin +# echo \#... +# sed -n 's:^[ ]*\.long \(W\|\)\(.*[^a-z]\)[a-z]*\(\| - .*\)$:\2:p' weakref1.s | sed -e 's,^[lg].*,(&|\\.text)(\\+0x[0-9a-f]+)?,' | sed 's,^,[0-9a-f]+ [^ ]* +,' +# # script output: +#... +[0-9a-f]+ [^ ]* +wa1 +[0-9a-f]+ [^ ]* +ua2 +[0-9a-f]+ [^ ]* +ua3 +[0-9a-f]+ [^ ]* +ua3 +[0-9a-f]+ [^ ]* +ua4 +[0-9a-f]+ [^ ]* +ua4 +[0-9a-f]+ [^ ]* +wb1 +[0-9a-f]+ [^ ]* +ub2 +[0-9a-f]+ [^ ]* +ub3 +[0-9a-f]+ [^ ]* +ub3 +[0-9a-f]+ [^ ]* +ub4 +[0-9a-f]+ [^ ]* +ub4 +[0-9a-f]+ [^ ]* +wc1 +[0-9a-f]+ [^ ]* +wc1 +[0-9a-f]+ [^ ]* +uc2 +[0-9a-f]+ [^ ]* +uc2 +[0-9a-f]+ [^ ]* +uc3 +[0-9a-f]+ [^ ]* +uc3 +[0-9a-f]+ [^ ]* +uc3 +[0-9a-f]+ [^ ]* +uc3 +[0-9a-f]+ [^ ]* +uc4 +[0-9a-f]+ [^ ]* +uc4 +[0-9a-f]+ [^ ]* +uc4 +[0-9a-f]+ [^ ]* +uc4 +[0-9a-f]+ [^ ]* +uc5 +[0-9a-f]+ [^ ]* +uc5 +[0-9a-f]+ [^ ]* +uc5 +[0-9a-f]+ [^ ]* +uc5 +[0-9a-f]+ [^ ]* +uc6 +[0-9a-f]+ [^ ]* +uc6 +[0-9a-f]+ [^ ]* +uc6 +[0-9a-f]+ [^ ]* +uc6 +[0-9a-f]+ [^ ]* +uc7 +[0-9a-f]+ [^ ]* +uc7 +[0-9a-f]+ [^ ]* +uc8 +[0-9a-f]+ [^ ]* +uc8 +[0-9a-f]+ [^ ]* +uc9 +[0-9a-f]+ [^ ]* +uc9 +[0-9a-f]+ [^ ]* +uc9 +[0-9a-f]+ [^ ]* +ww1 +[0-9a-f]+ [^ ]* +ww2 +[0-9a-f]+ [^ ]* +ww3 +[0-9a-f]+ [^ ]* +ww3 +[0-9a-f]+ [^ ]* +ww4 +[0-9a-f]+ [^ ]* +ww4 +[0-9a-f]+ [^ ]* +ww5 +[0-9a-f]+ [^ ]* +ww5 +[0-9a-f]+ [^ ]* +ww6 +[0-9a-f]+ [^ ]* +ww7 +[0-9a-f]+ [^ ]* +ww8 +[0-9a-f]+ [^ ]* +ww8 +[0-9a-f]+ [^ ]* +ww9 +[0-9a-f]+ [^ ]* +ww9 +[0-9a-f]+ [^ ]* +ww10 +[0-9a-f]+ [^ ]* +ww10 +[0-9a-f]+ [^ ]* +um5 +[0-9a-f]+ [^ ]* +wm6 +[0-9a-f]+ [^ ]* +wm7 +[0-9a-f]+ [^ ]* +wm8 +[0-9a-f]+ [^ ]* +wh2 +[0-9a-f]+ [^ ]* +wh3 +[0-9a-f]+ [^ ]* +wh4 +[0-9a-f]+ [^ ]* +wh5 +[0-9a-f]+ [^ ]* +wh6 +[0-9a-f]+ [^ ]* +wh7 +[0-9a-f]+ [^ ]* +uh8 +[0-9a-f]+ [^ ]* +uh8 +[0-9a-f]+ [^ ]* +uh9 +[0-9a-f]+ [^ ]* +uh9 +[0-9a-f]+ [^ ]* +(ld1|\.text|\$CODE\$)(\+0x[0-9a-f]+)? +[0-9a-f]+ [^ ]* +(ld2|\.text|\$CODE\$)(\+0x[0-9a-f]+)? +[0-9a-f]+ [^ ]* +(ld3|\.text|\$CODE\$)(\+0x[0-9a-f]+)? +[0-9a-f]+ [^ ]* +(ld4|\.text|\$CODE\$)(\+0x[0-9a-f]+)? +[0-9a-f]+ [^ ]* +ud5 +[0-9a-f]+ [^ ]* +(gd6|\.text|\$CODE\$)((\+|-)0x[0-9a-f]+)? +[0-9a-f]+ [^ ]* +(gd7|\.text|\$CODE\$)((\+|-)0x[0-9a-f]+)? +[0-9a-f]+ [^ ]* +(ld8|\.text|\$CODE\$)(\+0x[0-9a-f]+)? +[0-9a-f]+ [^ ]* +(ld8|\.text|\$CODE\$)(\+0x[0-9a-f]+)? +[0-9a-f]+ [^ ]* +(ld9|\.text|\$CODE\$)(\+0x[0-9a-f]+)? +[0-9a-f]+ [^ ]* +(ld9|\.text|\$CODE\$)(\+0x[0-9a-f]+)? diff --git a/binutils-2.25/gas/testsuite/gas/all/weakref1.s b/binutils-2.25/gas/testsuite/gas/all/weakref1.s new file mode 100644 index 00000000..142b778f --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/weakref1.s @@ -0,0 +1,232 @@ + .text +l: +/* a# test references after weakref. */ + .weakref Wwa1, wa1 + .long Wwa1 + + .weakref Wua2, ua2 + .long ua2 + + .weakref Wua3, ua3 + .long Wua3 + .long ua3 + + .weakref Wua4, ua4 + .long ua4 + .long Wua4 + + .weakref Wna5, na5 + +/* b# test references before weakref. */ + .long Wwb1 + .weakref Wwb1, wb1 + + .long ub2 + .weakref Wub2, ub2 + + .long Wub3 + .long ub3 + .weakref Wub3, ub3 + + .long ub4 + .long Wub4 + .weakref Wub4, ub4 + +/* c# test combinations of references before and after weakref. */ + .long Wwc1 + .weakref Wwc1, wc1 + .long Wwc1 + + .long uc2 + .weakref Wuc2, uc2 + .long uc2 + + .long Wuc3 + .long uc3 + .weakref Wuc3, uc3 + .long Wuc3 + .long uc3 + + .long uc4 + .long Wuc4 + .weakref Wuc4, uc4 + .long uc4 + .long Wuc4 + + .long Wuc5 + .long uc5 + .weakref Wuc5, uc5 + .long uc5 + .long Wuc5 + + .long uc6 + .long Wuc6 + .weakref Wuc6, uc6 + .long uc6 + .long Wuc6 + + .long uc7 + .weakref Wuc7, uc7 + .long Wuc7 + + .long Wuc8 + .weakref Wuc8, uc8 + .long uc8 + + .long Wuc9 + .weakref Wuc9, uc9 + .long Wuc9 + .long uc9 + +/* w# test that explicitly weak target don't lose the weak status */ + .weakref Www1, ww1 + .weak ww1 + .long ww1 + + .weak ww2 + .weakref Www2, ww2 + .long ww2 + + .weak ww3 + .long ww3 + .weakref Www3, ww3 + .long ww3 + + .long ww4 + .weakref Www4, ww4 + .weak ww4 + .long ww4 + + .long ww5 + .weakref Www5, ww5 + .long ww5 + .weak ww5 + + .weakref Www6, ww6 + .weak ww6 + .long Www6 + + .weak ww7 + .weakref Www7, ww7 + .long Www7 + + .weak ww8 + .long Www8 + .weakref Www8, ww8 + .long Www8 + + .long Www9 + .weakref Www9, ww9 + .weak ww9 + .long Www9 + + .long Www10 + .weakref Www10, ww10 + .long Www10 + .weak ww10 + +/* m# test multiple weakrefs */ + .weakref Wnm4a, nm4 + .weakref Wnm4b, nm4 + + .weakref Wum5a, um5 + .weakref Wum5b, um5 + .long um5 + + .weakref Wwm6a, wm6 + .weakref Wwm6b, wm6 + .long Wwm6a + + .weakref Wwm7a, wm7 + .weakref Wwm7b, wm7 + .long Wwm7b + + .weakref Wwm8a, wm8 + .long Wwm8b + .weakref Wwm8b, wm8 + +/* h# test weakref chain */ + .weakref Wnh1a, nh1 + .weakref Wnh1b, Wnh1a + .weakref Wnh1c, Wnh1b + + .weakref Wwh2a, wh2 + .weakref Wwh2b, Wwh2a + .long Wwh2b + + .weakref Wwh3a, wh3 + .weakref Wwh3b, Wwh3a + .long Wwh3a + + .weakref Wwh4b, Wwh4a + .weakref Wwh4a, wh4 + .long Wwh4b + + .long Wwh5b + .weakref Wwh5a, wh5 + .weakref Wwh5b, Wwh5a + + .long Wwh6b + .weakref Wwh6b, Wwh6a + .weakref Wwh6a, wh6 + + .weakref Wwh7b, Wwh7a + .long Wwh7b + .weakref Wwh7a, wh7 + + .long Wuh8c + .weakref Wuh8a, uh8 + .weakref Wuh8b, Wuh8a + .weakref Wuh8c, Wuh8b + .long uh8 + + .long Wuh9c + .weakref Wuh9c, Wuh9b + .weakref Wuh9b, Wuh9a + .weakref Wuh9a, uh9 + .long uh9 + +/* d# target symbol definitions */ + .weakref Wld1, ld1 + .long Wld1 + ld1 == l + + .weakref Wld2, ld2 + .long Wld2 +ld2: + +ld3: + .weakref Wld3, ld3 + .long Wld3 + +ld4: + .long Wld4 + .weakref Wld4, ld4 + + .global ud5 + .weakref Wud5, ud5 + .long Wud5 + + .global gd6 + .weakref Wgd6, gd6 + .long Wgd6 +gd6: + + .weakref Wgd7, gd7 + .long Wgd7 + .global gd7 +gd7: + + .long Wld8c + .weakref Wld8a, ld8 + .weakref Wld8b, Wld8a + .weakref Wld8c, Wld8b + .long ld8 +ld8: + + .long Wld9c + .weakref Wld9c, Wld9b + .weakref Wld9b, Wld9a + .weakref Wld9a, ld9 + .long ld9 +ld9: diff --git a/binutils-2.25/gas/testsuite/gas/all/weakref1g.d b/binutils-2.25/gas/testsuite/gas/all/weakref1g.d new file mode 100644 index 00000000..039c5997 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/weakref1g.d @@ -0,0 +1,18 @@ +#nm: --defined-only --extern-only +#name: weakref tests, global syms +#source: weakref1.s +# see weakref1.d for comments on the not-targets +# ecoff (OSF/alpha) lacks .weak support +# pdp11 lacks .long +#not-target: alpha*-*-osf* *-*-ecoff pdp11-*-aout + +# the rest of this file is generated with the following script: +# # script begin +# echo \#... +# sed -n 's,^[ ]*\.global \(g.*\),.* T \1,p' weakref1.s | uniq +# echo \#pass +# # script output: +#... +.* T gd6 +.* T gd7 +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/weakref1l.d b/binutils-2.25/gas/testsuite/gas/all/weakref1l.d new file mode 100644 index 00000000..05ba4583 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/weakref1l.d @@ -0,0 +1,27 @@ +#nm: --defined-only +#name: weakref tests, local syms +#source: weakref1.s +# aix drops local symbols +# see weakref1.d for comments on the other not-targets +#not-target: *-*-aix* alpha*-*-osf* *-*-ecoff pdp11-*-aout + +# the rest of this file is generated with the following script: +# # script begin +# sed -n 's,^\(l[^ ]*\)[ ]*:.*,.* t \1,p;s:^[ ]*\.set[ ][ ]*\(l[^ ]*\)[ ]*,.*:.* t \1:p' weakref1.s | uniq | while read line; do echo "#..."; echo "$line"; done +# echo \#pass +# # script output: +#... +.* t l +#... +.* t ld1 +#... +.* t ld2 +#... +.* t ld3 +#... +.* t ld4 +#... +.* t ld8 +#... +.* t ld9 +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/weakref1u.d b/binutils-2.25/gas/testsuite/gas/all/weakref1u.d new file mode 100644 index 00000000..179567f7 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/weakref1u.d @@ -0,0 +1,49 @@ +#nm: --undefined-only +#name: weakref tests, strong undefined syms +#source: weakref1.s +# aout turns undefined into *ABS* symbols. +# see weakref1.d for comments on the other not-targets +#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* ns32k-*-netbsd alpha*-*-osf* *-*-ecoff + +# the rest of this file is generated with the following script: +# # script begin +# sed -n 's:^[ ]*\.weakref .*, \(u.*\)$:.* U \1:p' weakref1.s | uniq | while read line; do echo "#..."; echo "$line"; done +# echo \#pass +# # script output: +#... +.* U ua2 +#... +.* U ua3 +#... +.* U ua4 +#... +.* U ub2 +#... +.* U ub3 +#... +.* U ub4 +#... +.* U uc2 +#... +.* U uc3 +#... +.* U uc4 +#... +.* U uc5 +#... +.* U uc6 +#... +.* U uc7 +#... +.* U uc8 +#... +.* U uc9 +#... +.* U ud5 +#... +.* U uh8 +#... +.* U uh9 +#... +.* U um5 +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/weakref1w.d b/binutils-2.25/gas/testsuite/gas/all/weakref1w.d new file mode 100644 index 00000000..45987761 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/weakref1w.d @@ -0,0 +1,56 @@ +#nm: --undefined-only +#name: weakref tests, weak undefined syms +#source: weakref1.s +# see weakref1.d for comments on the not-targets +#not-target: alpha*-*-osf* *-*-ecoff pdp11-*-aout + +# the rest of this file is generated with the following script: +# # script begin +# sed -n 's:^[ ]*\.weakref .*, \(w.*\)$:.* w \1:p' weakref1.s | uniq | while read line; do echo "#..."; echo "$line"; done +# echo \#pass +# # script output: +#... +.* w wa1 +#... +.* w wb1 +#... +.* w wc1 +#... +.* w wh2 +#... +.* w wh3 +#... +.* w wh4 +#... +.* w wh5 +#... +.* w wh6 +#... +.* w wh7 +#... +.* w wm6 +#... +.* w wm7 +#... +.* w wm8 +#... +.* w ww1 +#... +.* w ww10 +#... +.* w ww2 +#... +.* w ww3 +#... +.* w ww4 +#... +.* w ww5 +#... +.* w ww6 +#... +.* w ww7 +#... +.* w ww8 +#... +.* w ww9 +#pass diff --git a/binutils-2.25/gas/testsuite/gas/all/weakref2.s b/binutils-2.25/gas/testsuite/gas/all/weakref2.s new file mode 100644 index 00000000..049f1ec8 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/weakref2.s @@ -0,0 +1,5 @@ + .weakref a,b + .weakref b,c + .weakref c,d + .weakref d,e + .weakref e,a diff --git a/binutils-2.25/gas/testsuite/gas/all/weakref3.s b/binutils-2.25/gas/testsuite/gas/all/weakref3.s new file mode 100644 index 00000000..48f69877 --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/weakref3.s @@ -0,0 +1,5 @@ + .weakref e,a + .weakref d,e + .weakref c,d + .weakref b,c + .weakref a,b diff --git a/binutils-2.25/gas/testsuite/gas/all/weakref4.s b/binutils-2.25/gas/testsuite/gas/all/weakref4.s new file mode 100644 index 00000000..b984c64d --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/weakref4.s @@ -0,0 +1,45 @@ +/* m# test multiple weakrefs */ + .weakref Wnm1, nm1 + .weakref Wnm1, nm1 + + .weakref Wum2, um2 + .weakref Wum2, um2 + .long um2 + + .weakref Wwm3, wm3 + .weakref Wwm3, wm3 + .long Wwm3 + +/* r# weakref redefinitions, to and from */ + .weakref lr1, nr1 + .long lr1 + .set lr1, l + .long lr1 + + .long lr2 + .weakref lr2, nr2 + .set lr2, l + .long lr2 + + .set Wwr3, l + .long Wwr3 + .weakref Wwr3, wr3 + .long Wwr3 + + .set Wwr4, l + .weakref Wwr4, wr4 + .long Wwr4 + + .set Wwr5, l + .long Wwr5 + .weakref Wwr5, wr5 + + .weakref lr6, ur6 + .long lr6 + .set lr6, l + .long ur6 + + .weakref lr7, nr7 + .long lr7 +lr7: + .long lr7 diff --git a/binutils-2.25/gas/testsuite/gas/all/x930509.s b/binutils-2.25/gas/testsuite/gas/all/x930509.s new file mode 100644 index 00000000..1299991b --- /dev/null +++ b/binutils-2.25/gas/testsuite/gas/all/x930509.s @@ -0,0 +1,3 @@ + .long L2-L1 +L1: .long 0x1234 +L2: .long 0x5678 |