diff options
Diffstat (limited to 'tools/asm-processor/tests')
46 files changed, 2752 insertions, 0 deletions
diff --git a/tools/asm-processor/tests/ascii.c b/tools/asm-processor/tests/ascii.c new file mode 100644 index 0000000..bb27d25 --- /dev/null +++ b/tools/asm-processor/tests/ascii.c @@ -0,0 +1,19 @@ +void foo(void) { "abcdef"; } + +GLOBAL_ASM( +.rdata + .ascii "AB" + .ascii "CD", "EF" + .ascii "GH\n\n\n\0\11\222\3333\44444\x1234567\n\nIJK" +) + +void bar(void) { "hello"; } + +GLOBAL_ASM( +.rdata + .asciiz "12" + .asciiz "34", "56" + .asciiz "78\n\n\n\0\11\222\3333\44444\x1234567\n\n9A" +) + +void baz(void) { "ghijkl"; } diff --git a/tools/asm-processor/tests/ascii.objdump b/tools/asm-processor/tests/ascii.objdump new file mode 100644 index 0000000..bf42638 --- /dev/null +++ b/tools/asm-processor/tests/ascii.objdump @@ -0,0 +1,29 @@ + +tests/ascii.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000030 .text +00000000 l d .rodata 00000050 .rodata +00000000 g F .text 00000010 foo +00000010 g F .text 00000010 bar +00000020 g F .text 00000010 baz + + +Contents of section .text: + 0000 03e00008 00000000 03e00008 00000000 ................ + 0010 03e00008 00000000 03e00008 00000000 ................ + 0020 03e00008 00000000 03e00008 00000000 ................ +Contents of section .rodata: + 0000 61626364 65660000 41424344 45464748 abcdef..ABCDEFGH + 0010 0a0a0a00 0992db33 24343467 0a0a494a .......3$44g..IJ + 0020 4b000000 68656c6c 6f000000 31320033 K...hello...12.3 + 0030 34003536 0037380a 0a0a0009 92db3324 4.56.78.......3$ + 0040 3434670a 0a394100 6768696a 6b6c0000 44g..9A.ghijkl.. +Contents of section .options: + 0000 01200000 00000000 80000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000000 00000000 00000000 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/comments.c b/tools/asm-processor/tests/comments.c new file mode 100644 index 0000000..4c93669 --- /dev/null +++ b/tools/asm-processor/tests/comments.c @@ -0,0 +1,6 @@ +const char before[] = "^"; +GLOBAL_ASM( +.rdata +.asciz "aaaa /* bbbb */ # cccc", /**//**//**//**/ /*/ "xxxx" /*/ /* dddd " eeee */ "# ffff" # gggg "hhhh" /* iiii */ +) +const char after[] = "$"; diff --git a/tools/asm-processor/tests/comments.objdump b/tools/asm-processor/tests/comments.objdump new file mode 100644 index 0000000..246df20 --- /dev/null +++ b/tools/asm-processor/tests/comments.objdump @@ -0,0 +1,21 @@ + +tests/comments.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .rodata 00000030 .rodata +00000000 g O .rodata 00000002 before +00000024 g O .rodata 00000002 after + + +Contents of section .rodata: + 0000 5e000000 61616161 202f2a20 62626262 ^...aaaa /* bbbb + 0010 202a2f20 23206363 63630023 20666666 */ # cccc.# fff + 0020 66000000 24000000 00000000 00000000 f...$........... +Contents of section .options: + 0000 01200000 00000000 00000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/force.c b/tools/asm-processor/tests/force.c new file mode 100644 index 0000000..03b630c --- /dev/null +++ b/tools/asm-processor/tests/force.c @@ -0,0 +1,17 @@ +// COMPILE-FLAGS: -O2 +// ASMP-FLAGS: --convert-statics=global-with-filename --force +static int xtext(int a, int b, int c); +const int rodata1[] = {1}; +static const int rodata2[] = {2}; +int data1[] = {3}; +static int data2[] = {4}; +int bss1; +static int bss2; + +static int xtext(int a, int b, int c) { + return 1; +} + +void baz(void) { + xtext(bss2, rodata2[0], data2[0]); +} diff --git a/tools/asm-processor/tests/force.objdump b/tools/asm-processor/tests/force.objdump new file mode 100644 index 0000000..7ef7024 --- /dev/null +++ b/tools/asm-processor/tests/force.objdump @@ -0,0 +1,47 @@ + +tests/force.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000050 .text +00000000 l d .rodata 00000010 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000000 g O .rodata 00000004 rodata1 +00000000 g O .data 00000004 data1 +00000000 g O .bss 00000004 bss1 +00000014 g F .text 00000034 baz +00000004 g O .rodata 00000000 tests/force.o:rodata2 +00000004 g O .data 00000000 tests/force.o:data2 +00000004 g O .bss 00000000 tests/force.o:bss2 +00000000 g F .text 00000000 tests/force.o:xtext + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000001c R_MIPS_HI16 .bss +00000034 R_MIPS_LO16 .bss +00000020 R_MIPS_HI16 .rodata +0000002c R_MIPS_LO16 .rodata +00000024 R_MIPS_HI16 .data +00000028 R_MIPS_LO16 .data +00000030 R_MIPS_26 .text + + +Contents of section .text: + 0000 afa40000 afa50004 afa60008 03e00008 ................ + 0010 24020001 27bdffe8 afbf0014 3c040000 $...'.......<... + 0020 3c050000 3c060000 8cc60004 8ca50004 <...<........... + 0030 0c000000 8c840004 8fbf0014 27bd0018 ............'... + 0040 03e00008 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 00000001 00000002 00000000 00000000 ................ +Contents of section .data: + 0000 00000003 00000004 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 a0000074 00000000 . .........t.... + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a0000074 00000000 00000000 00000000 ...t............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/kpic-o1.c b/tools/asm-processor/tests/kpic-o1.c new file mode 100644 index 0000000..4d3346d --- /dev/null +++ b/tools/asm-processor/tests/kpic-o1.c @@ -0,0 +1,93 @@ +// COMPILE-FLAGS: -O1 -KPIC +GLOBAL_ASM( +glabel foo +addiu $a0, $a0, 1 +addiu $a0, $a0, 2 +addiu $a0, $a0, 3 +addiu $a0, $a0, 4 +addiu $a0, $a0, 5 +addiu $a0, $a0, 6 +addiu $a0, $a0, 7 +addiu $a0, $a0, 8 +addiu $a0, $a0, 9 +addiu $a0, $a0, 10 +addiu $a0, $a0, 11 +addiu $a0, $a0, 12 +) +GLOBAL_ASM( +.late_rodata +.float 1 +.text +glabel float_fn +addiu $a0, $a0, 13 +addiu $a0, $a0, 14 +addiu $a0, $a0, 15 +addiu $a0, $a0, 16 +addiu $a0, $a0, 17 +addiu $a0, $a0, 18 +addiu $a0, $a0, 19 +addiu $a0, $a0, 20 +addiu $a0, $a0, 21 +addiu $a0, $a0, 22 +addiu $a0, $a0, 23 +addiu $a0, $a0, 24 +addiu $a0, $a0, 25 +addiu $a0, $a0, 26 +addiu $a0, $a0, 27 +addiu $a0, $a0, 28 +addiu $a0, $a0, 29 +addiu $a0, $a0, 30 +) +GLOBAL_ASM( +.late_rodata +.late_rodata_alignment 4 +.float 2 +.double 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.text +glabel doubles +addiu $a0, $a0, 31 +addiu $a0, $a0, 32 +addiu $a0, $a0, 33 +addiu $a0, $a0, 34 +addiu $a0, $a0, 35 +addiu $a0, $a0, 36 +addiu $a0, $a0, 37 +addiu $a0, $a0, 38 +addiu $a0, $a0, 39 +addiu $a0, $a0, 40 +addiu $a0, $a0, 41 +addiu $a0, $a0, 42 +addiu $a0, $a0, 43 +addiu $a0, $a0, 44 +addiu $a0, $a0, 45 +addiu $a0, $a0, 46 +addiu $a0, $a0, 47 +addiu $a0, $a0, 48 +addiu $a0, $a0, 49 +addiu $a0, $a0, 50 +addiu $a0, $a0, 51 +addiu $a0, $a0, 52 +addiu $a0, $a0, 53 +addiu $a0, $a0, 54 +addiu $a0, $a0, 55 +addiu $a0, $a0, 56 +addiu $a0, $a0, 57 +addiu $a0, $a0, 58 +addiu $a0, $a0, 59 +addiu $a0, $a0, 60 +addiu $a0, $a0, 61 +addiu $a0, $a0, 62 +addiu $a0, $a0, 63 +addiu $a0, $a0, 64 +addiu $a0, $a0, 65 +addiu $a0, $a0, 66 +addiu $a0, $a0, 67 +addiu $a0, $a0, 68 +) diff --git a/tools/asm-processor/tests/kpic-o1.objdump b/tools/asm-processor/tests/kpic-o1.objdump new file mode 100644 index 0000000..6e33675 --- /dev/null +++ b/tools/asm-processor/tests/kpic-o1.objdump @@ -0,0 +1,46 @@ + +tests/kpic-o1.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000110 .text +00000000 l d .rodata 00000050 .rodata +00000000 g F .text 00000030 foo +00000030 g F .text 00000048 float_fn +00000078 g F .text 00000098 doubles +00000000 O *UND* 00000000 _gp_disp + + +RELOCATION RECORDS FOR [.text]: (none) + +Contents of section .text: + 0000 24840001 24840002 24840003 24840004 $...$...$...$... + 0010 24840005 24840006 24840007 24840008 $...$...$...$... + 0020 24840009 2484000a 2484000b 2484000c $...$...$...$... + 0030 2484000d 2484000e 2484000f 24840010 $...$...$...$... + 0040 24840011 24840012 24840013 24840014 $...$...$...$... + 0050 24840015 24840016 24840017 24840018 $...$...$...$... + 0060 24840019 2484001a 2484001b 2484001c $...$...$...$... + 0070 2484001d 2484001e 2484001f 24840020 $...$...$...$.. + 0080 24840021 24840022 24840023 24840024 $..!$.."$..#$..$ + 0090 24840025 24840026 24840027 24840028 $..%$..&$..'$..( + 00a0 24840029 2484002a 2484002b 2484002c $..)$..*$..+$.., + 00b0 2484002d 2484002e 2484002f 24840030 $..-$...$../$..0 + 00c0 24840031 24840032 24840033 24840034 $..1$..2$..3$..4 + 00d0 24840035 24840036 24840037 24840038 $..5$..6$..7$..8 + 00e0 24840039 2484003a 2484003b 2484003c $..9$..:$..;$..< + 00f0 2484003d 2484003e 2484003f 24840040 $..=$..>$..?$..@ + 0100 24840041 24840042 24840043 24840044 $..A$..B$..C$..D +Contents of section .rodata: + 0000 3f800000 40000000 3ff00000 00000000 ?...@...?....... + 0010 40000000 00000000 40080000 00000000 @.......@....... + 0020 40100000 00000000 40140000 00000000 @.......@....... + 0030 40180000 00000000 401c0000 00000000 @.......@....... + 0040 40200000 00000000 00000000 00000000 @ .............. +Contents of section .options: + 0000 01200000 00000000 92000002 00000000 . .............. + 0010 000f0ff0 00000000 00000000 00000000 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 92000012 00000000 000f0ff0 00000000 ................ + 0010 00000000 00000000 ........ diff --git a/tools/asm-processor/tests/kpic-o2.c b/tools/asm-processor/tests/kpic-o2.c new file mode 100644 index 0000000..f037341 --- /dev/null +++ b/tools/asm-processor/tests/kpic-o2.c @@ -0,0 +1,92 @@ +// COMPILE-FLAGS: -O2 -KPIC +GLOBAL_ASM( +glabel foo +addiu $a0, $a0, 1 +addiu $a0, $a0, 2 +addiu $a0, $a0, 3 +addiu $a0, $a0, 4 +addiu $a0, $a0, 5 +addiu $a0, $a0, 6 +addiu $a0, $a0, 7 +addiu $a0, $a0, 8 +addiu $a0, $a0, 9 +addiu $a0, $a0, 10 +addiu $a0, $a0, 11 +addiu $a0, $a0, 12 +) +GLOBAL_ASM( +.late_rodata +.float 1 +.text +glabel float_fn +addiu $a0, $a0, 13 +addiu $a0, $a0, 14 +addiu $a0, $a0, 15 +addiu $a0, $a0, 16 +addiu $a0, $a0, 17 +addiu $a0, $a0, 18 +addiu $a0, $a0, 19 +addiu $a0, $a0, 20 +addiu $a0, $a0, 21 +addiu $a0, $a0, 22 +addiu $a0, $a0, 23 +addiu $a0, $a0, 24 +addiu $a0, $a0, 25 +addiu $a0, $a0, 26 +addiu $a0, $a0, 27 +addiu $a0, $a0, 28 +addiu $a0, $a0, 29 +addiu $a0, $a0, 30 +) +GLOBAL_ASM( +.late_rodata +.float 2 +.double 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.text +glabel doubles +addiu $a0, $a0, 31 +addiu $a0, $a0, 32 +addiu $a0, $a0, 33 +addiu $a0, $a0, 34 +addiu $a0, $a0, 35 +addiu $a0, $a0, 36 +addiu $a0, $a0, 37 +addiu $a0, $a0, 38 +addiu $a0, $a0, 39 +addiu $a0, $a0, 40 +addiu $a0, $a0, 41 +addiu $a0, $a0, 42 +addiu $a0, $a0, 43 +addiu $a0, $a0, 44 +addiu $a0, $a0, 45 +addiu $a0, $a0, 46 +addiu $a0, $a0, 47 +addiu $a0, $a0, 48 +addiu $a0, $a0, 49 +addiu $a0, $a0, 50 +addiu $a0, $a0, 51 +addiu $a0, $a0, 52 +addiu $a0, $a0, 53 +addiu $a0, $a0, 54 +addiu $a0, $a0, 55 +addiu $a0, $a0, 56 +addiu $a0, $a0, 57 +addiu $a0, $a0, 58 +addiu $a0, $a0, 59 +addiu $a0, $a0, 60 +addiu $a0, $a0, 61 +addiu $a0, $a0, 62 +addiu $a0, $a0, 63 +addiu $a0, $a0, 64 +addiu $a0, $a0, 65 +addiu $a0, $a0, 66 +addiu $a0, $a0, 67 +addiu $a0, $a0, 68 +) diff --git a/tools/asm-processor/tests/kpic-o2.objdump b/tools/asm-processor/tests/kpic-o2.objdump new file mode 100644 index 0000000..abf87ae --- /dev/null +++ b/tools/asm-processor/tests/kpic-o2.objdump @@ -0,0 +1,46 @@ + +tests/kpic-o2.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000110 .text +00000000 l d .rodata 00000050 .rodata +00000000 g F .text 00000030 foo +00000030 g F .text 00000048 float_fn +00000078 g F .text 00000098 doubles +00000000 O *UND* 00000000 _gp_disp + + +RELOCATION RECORDS FOR [.text]: (none) + +Contents of section .text: + 0000 24840001 24840002 24840003 24840004 $...$...$...$... + 0010 24840005 24840006 24840007 24840008 $...$...$...$... + 0020 24840009 2484000a 2484000b 2484000c $...$...$...$... + 0030 2484000d 2484000e 2484000f 24840010 $...$...$...$... + 0040 24840011 24840012 24840013 24840014 $...$...$...$... + 0050 24840015 24840016 24840017 24840018 $...$...$...$... + 0060 24840019 2484001a 2484001b 2484001c $...$...$...$... + 0070 2484001d 2484001e 2484001f 24840020 $...$...$...$.. + 0080 24840021 24840022 24840023 24840024 $..!$.."$..#$..$ + 0090 24840025 24840026 24840027 24840028 $..%$..&$..'$..( + 00a0 24840029 2484002a 2484002b 2484002c $..)$..*$..+$.., + 00b0 2484002d 2484002e 2484002f 24840030 $..-$...$../$..0 + 00c0 24840031 24840032 24840033 24840034 $..1$..2$..3$..4 + 00d0 24840035 24840036 24840037 24840038 $..5$..6$..7$..8 + 00e0 24840039 2484003a 2484003b 2484003c $..9$..:$..;$..< + 00f0 2484003d 2484003e 2484003f 24840040 $..=$..>$..?$..@ + 0100 24840041 24840042 24840043 24840044 $..A$..B$..C$..D +Contents of section .rodata: + 0000 3f800000 40000000 3ff00000 00000000 ?...@...?....... + 0010 40000000 00000000 40080000 00000000 @.......@....... + 0020 40100000 00000000 40140000 00000000 @.......@....... + 0030 40180000 00000000 401c0000 00000000 @.......@....... + 0040 40200000 00000000 00000000 00000000 @ .............. +Contents of section .options: + 0000 01200000 00000000 92000002 00000000 . .............. + 0010 000f0ff0 00000000 00000000 00000000 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 92000012 00000000 000f0ff0 00000000 ................ + 0010 00000000 00000000 ........ diff --git a/tools/asm-processor/tests/label-sameline.c b/tools/asm-processor/tests/label-sameline.c new file mode 100644 index 0000000..a35b43d --- /dev/null +++ b/tools/asm-processor/tests/label-sameline.c @@ -0,0 +1,7 @@ +GLOBAL_ASM( +.rdata +.word 0x12345678 +glabel blah +.word blah2 + /*a*/ blah2: /*b*/ .word blah /*c*/ +) diff --git a/tools/asm-processor/tests/label-sameline.objdump b/tools/asm-processor/tests/label-sameline.objdump new file mode 100644 index 0000000..1f1aacf --- /dev/null +++ b/tools/asm-processor/tests/label-sameline.objdump @@ -0,0 +1,25 @@ + +tests/label-sameline.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .rodata 00000010 .rodata +00000000 l d .rodata 00000000 +00000004 g .rodata 00000000 blah + + +RELOCATION RECORDS FOR [.rodata]: +OFFSET TYPE VALUE +00000004 R_MIPS_32 +00000008 R_MIPS_32 blah + + +Contents of section .rodata: + 0000 12345678 00000008 00000000 00000000 .4Vx............ +Contents of section .options: + 0000 01200000 00000000 00000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/large.c b/tools/asm-processor/tests/large.c new file mode 100644 index 0000000..4ffb4ac --- /dev/null +++ b/tools/asm-processor/tests/large.c @@ -0,0 +1,164 @@ + +GLOBAL_ASM( +glabel test + +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 + +) + +void foo(void) {} diff --git a/tools/asm-processor/tests/large.objdump b/tools/asm-processor/tests/large.objdump new file mode 100644 index 0000000..17409a7 --- /dev/null +++ b/tools/asm-processor/tests/large.objdump @@ -0,0 +1,58 @@ + +tests/large.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000280 .text +00000270 g F .text 00000010 foo +00000000 g F .text 00000270 test + + +Contents of section .text: + 0000 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0010 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0020 afb90004 00000000 03e00008 27bd0018 ............'... + 0030 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0040 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0050 afb90004 00000000 03e00008 27bd0018 ............'... + 0060 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0070 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0080 afb90004 00000000 03e00008 27bd0018 ............'... + 0090 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 00a0 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 00b0 afb90004 00000000 03e00008 27bd0018 ............'... + 00c0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 00d0 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 00e0 afb90004 00000000 03e00008 27bd0018 ............'... + 00f0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0100 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0110 afb90004 00000000 03e00008 27bd0018 ............'... + 0120 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0130 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0140 afb90004 00000000 03e00008 27bd0018 ............'... + 0150 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0160 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0170 afb90004 00000000 03e00008 27bd0018 ............'... + 0180 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0190 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 01a0 afb90004 00000000 03e00008 27bd0018 ............'... + 01b0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 01c0 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 01d0 afb90004 00000000 03e00008 27bd0018 ............'... + 01e0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 01f0 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0200 afb90004 00000000 03e00008 27bd0018 ............'... + 0210 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0220 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0230 afb90004 00000000 03e00008 27bd0018 ............'... + 0240 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0250 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0260 afb90004 00000000 03e00008 27bd0018 ............'... + 0270 03e00008 00000000 03e00008 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 80000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a300c032 00000000 00000000 00000000 ...2............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_align.c b/tools/asm-processor/tests/late_rodata_align.c new file mode 100644 index 0000000..7367c79 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_align.c @@ -0,0 +1,80 @@ +GLOBAL_ASM( +.late_rodata + .float 4.1 + .float 4.2 + .float 4.3 + .float 4.4 +.text +glabel a + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float foo(void) { "foo"; return 1.1f; } + +GLOBAL_ASM( +.late_rodata +.late_rodata_alignment 4 + .float 5.1 + .float 5.2 + .float 5.3 + .float 5.4 +.text +glabel b + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float bar(void) { "bar"; return 1.2f; } + +GLOBAL_ASM( +.late_rodata +.late_rodata_alignment 8 + .float 6.1 + .float 6.2 + .float 6.3 + .float 6.4 + .float 6.5 +.text +glabel c + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + diff --git a/tools/asm-processor/tests/late_rodata_align.objdump b/tools/asm-processor/tests/late_rodata_align.objdump new file mode 100644 index 0000000..87c05e8 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_align.objdump @@ -0,0 +1,51 @@ + +tests/late_rodata_align.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000f0 .text +00000000 l d .rodata 00000050 .rodata +00000040 g F .text 0000001c foo +00000090 g F .text 0000001c bar +00000000 g F .text 00000040 a +0000005c g F .text 00000034 b +000000ac g F .text 00000038 c + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000040 R_MIPS_HI16 .rodata +00000048 R_MIPS_LO16 .rodata +00000090 R_MIPS_HI16 .rodata +00000098 R_MIPS_LO16 .rodata + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 3c010000 03e00008 c4200018 03e00008 <........ ...... + 0050 00000000 03e00008 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 3c010000 03e00008 c420002c 03e00008 <........ .,.... + 00a0 00000000 03e00008 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00000000 00000000 ................ + 00d0 00000000 00000000 00000000 00000000 ................ + 00e0 00000000 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 666f6f00 62617200 40833333 40866666 foo.bar.@.33@.ff + 0010 4089999a 408ccccd 3f8ccccd 40a33333 @...@...?...@.33 + 0020 40a66666 40a9999a 40accccd 3f99999a @.ff@...@...?... + 0030 40c33333 40c66666 40c9999a 40cccccd @.33@.ff@...@... + 0040 40d00000 00000000 00000000 00000000 @............... +Contents of section .options: + 0000 01200000 00000000 80000002 00000000 . .............. + 0010 000005f1 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000002 00000000 000005f1 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_doubles.c b/tools/asm-processor/tests/late_rodata_doubles.c new file mode 100644 index 0000000..0a27b41 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_doubles.c @@ -0,0 +1,83 @@ +GLOBAL_ASM( +.late_rodata + .float 4.1 +.text +glabel a + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float foo(void) { + return 4.15f; +} + +GLOBAL_ASM( +.late_rodata + .float 4.2 + .word 0 + .double 4.3 +.text +glabel b + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float bar(void) { + return 4.4f; +} + +GLOBAL_ASM( +.late_rodata + .float 4.55 + .double 4.6 +.text +glabel c + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float baz(void) { + return 4.6f; +} diff --git a/tools/asm-processor/tests/late_rodata_doubles.objdump b/tools/asm-processor/tests/late_rodata_doubles.objdump new file mode 100644 index 0000000..84d7e67 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_doubles.objdump @@ -0,0 +1,55 @@ + +tests/late_rodata_doubles.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000120 .text +00000000 l d .rodata 00000030 .rodata +00000040 g F .text 0000001c foo +0000009c g F .text 0000001c bar +000000f8 g F .text 0000001c baz +00000000 g F .text 00000040 a +0000005c g F .text 00000040 b +000000b8 g F .text 00000040 c + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000040 R_MIPS_HI16 .rodata +00000048 R_MIPS_LO16 .rodata +0000009c R_MIPS_HI16 .rodata +000000a4 R_MIPS_LO16 .rodata +000000f8 R_MIPS_HI16 .rodata +00000100 R_MIPS_LO16 .rodata + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 3c010000 03e00008 c4200004 03e00008 <........ ...... + 0050 00000000 03e00008 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 3c010000 ............<... + 00a0 03e00008 c4200018 03e00008 00000000 ..... .......... + 00b0 03e00008 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00000000 00000000 ................ + 00d0 00000000 00000000 00000000 00000000 ................ + 00e0 00000000 00000000 00000000 00000000 ................ + 00f0 00000000 00000000 3c010000 03e00008 ........<....... + 0100 c4200028 03e00008 00000000 03e00008 . .(............ + 0110 00000000 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 40833333 4084cccd 40866666 00000000 @.33@...@.ff.... + 0010 40113333 33333333 408ccccd 4091999a @.333333@...@... + 0020 40126666 66666666 40933333 00000000 @.ffffff@.33.... +Contents of section .options: + 0000 01200000 00000000 80000002 00000000 . .............. + 0010 000000f1 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000002 00000000 000000f1 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_doubles_mips1.c b/tools/asm-processor/tests/late_rodata_doubles_mips1.c new file mode 100644 index 0000000..b97261f --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_doubles_mips1.c @@ -0,0 +1,86 @@ +// COMPILE-FLAGS: -O2 +// COMPILE-ISET: -mips1 +// exact copy of late_rodata_doubles.c except for the -mips1 -O2 additions +GLOBAL_ASM( +.late_rodata + .float 4.1 +.text +glabel a + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float foo(void) { + return 4.15f; +} + +GLOBAL_ASM( +.late_rodata + .float 4.2 + .word 0 + .double 4.3 +.text +glabel b + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float bar(void) { + return 4.4f; +} + +GLOBAL_ASM( +.late_rodata + .float 4.55 + .double 4.6 +.text +glabel c + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float baz(void) { + return 4.6f; +} diff --git a/tools/asm-processor/tests/late_rodata_doubles_mips1.objdump b/tools/asm-processor/tests/late_rodata_doubles_mips1.objdump new file mode 100644 index 0000000..8fac85f --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_doubles_mips1.objdump @@ -0,0 +1,52 @@ + +tests/late_rodata_doubles_mips1.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000f0 .text +00000000 l d .rodata 00000030 .rodata +00000040 g F .text 00000010 foo +00000090 g F .text 00000010 bar +000000e0 g F .text 00000010 baz +00000000 g F .text 00000040 a +00000050 g F .text 00000040 b +000000a0 g F .text 00000040 c + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000040 R_MIPS_HI16 .rodata +00000044 R_MIPS_LO16 .rodata +00000090 R_MIPS_HI16 .rodata +00000094 R_MIPS_LO16 .rodata +000000e0 R_MIPS_HI16 .rodata +000000e4 R_MIPS_LO16 .rodata + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 3c010000 c4200004 03e00008 00000000 <.... .......... + 0050 00000000 00000000 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 3c010000 c4200018 03e00008 00000000 <.... .......... + 00a0 00000000 00000000 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00000000 00000000 ................ + 00d0 00000000 00000000 00000000 00000000 ................ + 00e0 3c010000 c4200028 03e00008 00000000 <.... .(........ +Contents of section .rodata: + 0000 40833333 4084cccd 40866666 00000000 @.33@...@.ff.... + 0010 40113333 33333333 408ccccd 4091999a @.333333@...@... + 0020 40126666 66666666 40933333 00000000 @.ffffff@.33.... +Contents of section .options: + 0000 01200000 00000000 80000002 00000000 . .............. + 0010 000c0011 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000002 00000000 000c0011 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_jtbl.c b/tools/asm-processor/tests/late_rodata_jtbl.c new file mode 100644 index 0000000..3c2a5bb --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_jtbl.c @@ -0,0 +1,153 @@ +// COMPILE-FLAGS: -O2 +GLOBAL_ASM( +.late_rodata +.double 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.text +glabel doubles1 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +float a(void) { return 1.1f; } + +GLOBAL_ASM( +.late_rodata +.float 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.double 9 +.float 10 +.text +glabel doubles2 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +GLOBAL_ASM( +glabel a2 +move $a0, $a0 +nop +nop +nop +jr $ra +move $a0, $a0 +) + +GLOBAL_ASM( +.late_rodata + +glabel jtbl +.word case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10 +.word case11, case12, case13, case14, case15, case16, case17, case18, case19, case20 +.word case21, case22, case23, case24, case25, case26 + +.text +glabel foo +sltiu $at, $a0, 0xa +beqz $at, .L756E659B + sll $t7, $a0, 2 +lui $at, %hi(jtbl) +addu $at, $at, $t7 +lw $t7, %lo(jtbl)($at) +jr $t7 + nop +case0: addiu $a0, $a0, 1 +case1: addiu $a0, $a0, 1 +case2: addiu $a0, $a0, 1 +case3: addiu $a0, $a0, 1 +case4: addiu $a0, $a0, 1 +case5: addiu $a0, $a0, 1 +case6: addiu $a0, $a0, 1 +case7: addiu $a0, $a0, 1 +case8: addiu $a0, $a0, 1 +case9: addiu $a0, $a0, 1 +case10: addiu $a0, $a0, 1 +case11: addiu $a0, $a0, 1 +case12: addiu $a0, $a0, 1 +case13: addiu $a0, $a0, 1 +case14: addiu $a0, $a0, 1 +case15: addiu $a0, $a0, 1 +case16: addiu $a0, $a0, 1 +case17: addiu $a0, $a0, 1 +case18: addiu $a0, $a0, 1 +case19: addiu $a0, $a0, 1 +case20: addiu $a0, $a0, 1 +case21: addiu $a0, $a0, 1 +case22: addiu $a0, $a0, 1 +case23: addiu $a0, $a0, 1 +case24: addiu $a0, $a0, 1 +case25: addiu $a0, $a0, 1 +case26: +jr $ra + addiu $v0, $a0, 1 + +.L756E659B: +addiu $v0, $zero, 2 +jr $ra + nop +) + +GLOBAL_ASM( +glabel b2 +move $a0, $a0 +nop +nop +jr $ra +move $a0, $a0 +) + +float b(void) { return 1.2f; } diff --git a/tools/asm-processor/tests/late_rodata_jtbl.objdump b/tools/asm-processor/tests/late_rodata_jtbl.objdump new file mode 100644 index 0000000..44bb6e8 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_jtbl.objdump @@ -0,0 +1,110 @@ + +tests/late_rodata_jtbl.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000001a0 .text +00000000 l d .rodata 00000100 .rodata +00000000 l d .text 00000000 +0000005c g F .text 0000000c a +0000018c g F .text 0000000c b +00000000 g F .text 0000005c doubles1 +00000068 g F .text 0000005c doubles2 +000000c4 g F .text 00000018 a2 +000000dc g F .text 0000009c foo +0000008c g .rodata 00000000 jtbl +00000178 g F .text 00000014 b2 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000005c R_MIPS_HI16 .rodata +00000064 R_MIPS_LO16 .rodata +0000018c R_MIPS_HI16 .rodata +00000194 R_MIPS_LO16 .rodata +000000e8 R_MIPS_HI16 jtbl +000000f0 R_MIPS_LO16 jtbl + + +RELOCATION RECORDS FOR [.rodata]: +OFFSET TYPE VALUE +0000008c R_MIPS_32 +00000090 R_MIPS_32 +00000094 R_MIPS_32 +00000098 R_MIPS_32 +0000009c R_MIPS_32 +000000a0 R_MIPS_32 +000000a4 R_MIPS_32 +000000a8 R_MIPS_32 +000000ac R_MIPS_32 +000000b0 R_MIPS_32 +000000b4 R_MIPS_32 +000000b8 R_MIPS_32 +000000bc R_MIPS_32 +000000c0 R_MIPS_32 +000000c4 R_MIPS_32 +000000c8 R_MIPS_32 +000000cc R_MIPS_32 +000000d0 R_MIPS_32 +000000d4 R_MIPS_32 +000000d8 R_MIPS_32 +000000dc R_MIPS_32 +000000e0 R_MIPS_32 +000000e4 R_MIPS_32 +000000e8 R_MIPS_32 +000000ec R_MIPS_32 +000000f0 R_MIPS_32 +000000f4 R_MIPS_32 + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 00000000 00000000 00000000 00000000 ................ + 0050 00000000 00000000 00000000 3c010000 ............<... + 0060 03e00008 c4200040 00000000 00000000 ..... .@........ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 00000000 ................ + 00a0 00000000 00000000 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00802025 00000000 00000000 ...... %........ + 00d0 00000000 03e00008 00802025 2c81000a .......... %,... + 00e0 10200022 00047880 3c010000 002f0821 . ."..x.<..../.! + 00f0 8c2f0000 01e00008 00000000 24840001 ./..........$... + 0100 24840001 24840001 24840001 24840001 $...$...$...$... + 0110 24840001 24840001 24840001 24840001 $...$...$...$... + 0120 24840001 24840001 24840001 24840001 $...$...$...$... + 0130 24840001 24840001 24840001 24840001 $...$...$...$... + 0140 24840001 24840001 24840001 24840001 $...$...$...$... + 0150 24840001 24840001 24840001 24840001 $...$...$...$... + 0160 24840001 03e00008 24820001 24020002 $.......$...$... + 0170 03e00008 00000000 00802025 00000000 .......... %.... + 0180 00000000 03e00008 00802025 3c010000 .......... %<... + 0190 03e00008 c42000f8 00000000 00000000 ..... .......... +Contents of section .rodata: + 0000 3ff00000 00000000 40000000 00000000 ?.......@....... + 0010 40080000 00000000 40100000 00000000 @.......@....... + 0020 40140000 00000000 40180000 00000000 @.......@....... + 0030 401c0000 00000000 40200000 00000000 @.......@ ...... + 0040 3f8ccccd 3f800000 40000000 00000000 ?...?...@....... + 0050 40080000 00000000 40100000 00000000 @.......@....... + 0060 40140000 00000000 40180000 00000000 @.......@....... + 0070 401c0000 00000000 40200000 00000000 @.......@ ...... + 0080 40220000 00000000 41200000 000000fc @"......A ...... + 0090 00000100 00000104 00000108 0000010c ................ + 00a0 00000110 00000114 00000118 0000011c ................ + 00b0 00000120 00000124 00000128 0000012c ... ...$...(..., + 00c0 00000130 00000134 00000138 0000013c ...0...4...8...< + 00d0 00000140 00000144 00000148 0000014c ...@...D...H...L + 00e0 00000150 00000154 00000158 0000015c ...P...T...X...\ + 00f0 00000160 00000164 3f99999a 00000000 ...`...d?....... +Contents of section .options: + 0000 01200000 00000000 80004002 00000000 . ........@..... + 0010 000000f1 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 8000c016 00000000 000000f1 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_jtbl_mips1.c b/tools/asm-processor/tests/late_rodata_jtbl_mips1.c new file mode 100644 index 0000000..505f4c1 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_jtbl_mips1.c @@ -0,0 +1,155 @@ +// COMPILE-FLAGS: -O2 +// COMPILE-ISET: -mips1 +// exact copy of late_rodata_jtbl.c except for the -mips1 addition +GLOBAL_ASM( +.late_rodata +.double 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.text +glabel doubles1 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +float a(void) { return 1.1f; } + +GLOBAL_ASM( +.late_rodata +.float 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.double 9 +.float 10 +.text +glabel doubles2 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +GLOBAL_ASM( +glabel a2 +move $a0, $a0 +nop +nop +nop +jr $ra +move $a0, $a0 +) + +GLOBAL_ASM( +.late_rodata + +glabel jtbl +.word case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10 +.word case11, case12, case13, case14, case15, case16, case17, case18, case19, case20 +.word case21, case22, case23, case24, case25, case26 + +.text +glabel foo +sltiu $at, $a0, 0xa +beqz $at, .L756E659B + sll $t7, $a0, 2 +lui $at, %hi(jtbl) +addu $at, $at, $t7 +lw $t7, %lo(jtbl)($at) +jr $t7 + nop +case0: addiu $a0, $a0, 1 +case1: addiu $a0, $a0, 1 +case2: addiu $a0, $a0, 1 +case3: addiu $a0, $a0, 1 +case4: addiu $a0, $a0, 1 +case5: addiu $a0, $a0, 1 +case6: addiu $a0, $a0, 1 +case7: addiu $a0, $a0, 1 +case8: addiu $a0, $a0, 1 +case9: addiu $a0, $a0, 1 +case10: addiu $a0, $a0, 1 +case11: addiu $a0, $a0, 1 +case12: addiu $a0, $a0, 1 +case13: addiu $a0, $a0, 1 +case14: addiu $a0, $a0, 1 +case15: addiu $a0, $a0, 1 +case16: addiu $a0, $a0, 1 +case17: addiu $a0, $a0, 1 +case18: addiu $a0, $a0, 1 +case19: addiu $a0, $a0, 1 +case20: addiu $a0, $a0, 1 +case21: addiu $a0, $a0, 1 +case22: addiu $a0, $a0, 1 +case23: addiu $a0, $a0, 1 +case24: addiu $a0, $a0, 1 +case25: addiu $a0, $a0, 1 +case26: +jr $ra + addiu $v0, $a0, 1 + +.L756E659B: +addiu $v0, $zero, 2 +jr $ra + nop +) + +GLOBAL_ASM( +glabel b2 +move $a0, $a0 +nop +nop +jr $ra +move $a0, $a0 +) + +float b(void) { return 1.2f; } diff --git a/tools/asm-processor/tests/late_rodata_jtbl_mips1.objdump b/tools/asm-processor/tests/late_rodata_jtbl_mips1.objdump new file mode 100644 index 0000000..d37c8bb --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_jtbl_mips1.objdump @@ -0,0 +1,110 @@ + +tests/late_rodata_jtbl_mips1.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000001a0 .text +00000000 l d .rodata 00000100 .rodata +00000000 l d .text 00000000 +0000005c g F .text 00000010 a +00000190 g F .text 00000010 b +00000000 g F .text 0000005c doubles1 +0000006c g F .text 0000005c doubles2 +000000c8 g F .text 00000018 a2 +000000e0 g F .text 0000009c foo +0000008c g .rodata 00000000 jtbl +0000017c g F .text 00000014 b2 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000005c R_MIPS_HI16 .rodata +00000060 R_MIPS_LO16 .rodata +00000190 R_MIPS_HI16 .rodata +00000194 R_MIPS_LO16 .rodata +000000ec R_MIPS_HI16 jtbl +000000f4 R_MIPS_LO16 jtbl + + +RELOCATION RECORDS FOR [.rodata]: +OFFSET TYPE VALUE +0000008c R_MIPS_32 +00000090 R_MIPS_32 +00000094 R_MIPS_32 +00000098 R_MIPS_32 +0000009c R_MIPS_32 +000000a0 R_MIPS_32 +000000a4 R_MIPS_32 +000000a8 R_MIPS_32 +000000ac R_MIPS_32 +000000b0 R_MIPS_32 +000000b4 R_MIPS_32 +000000b8 R_MIPS_32 +000000bc R_MIPS_32 +000000c0 R_MIPS_32 +000000c4 R_MIPS_32 +000000c8 R_MIPS_32 +000000cc R_MIPS_32 +000000d0 R_MIPS_32 +000000d4 R_MIPS_32 +000000d8 R_MIPS_32 +000000dc R_MIPS_32 +000000e0 R_MIPS_32 +000000e4 R_MIPS_32 +000000e8 R_MIPS_32 +000000ec R_MIPS_32 +000000f0 R_MIPS_32 +000000f4 R_MIPS_32 + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 00000000 00000000 00000000 00000000 ................ + 0050 00000000 00000000 00000000 3c010000 ............<... + 0060 c4200040 03e00008 00000000 00000000 . .@............ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 00000000 ................ + 00a0 00000000 00000000 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00802025 00000000 .......... %.... + 00d0 00000000 00000000 03e00008 00802025 .............. % + 00e0 2c81000a 10200022 00047880 3c010000 ,.... ."..x.<... + 00f0 002f0821 8c2f0000 01e00008 00000000 ./.!./.......... + 0100 24840001 24840001 24840001 24840001 $...$...$...$... + 0110 24840001 24840001 24840001 24840001 $...$...$...$... + 0120 24840001 24840001 24840001 24840001 $...$...$...$... + 0130 24840001 24840001 24840001 24840001 $...$...$...$... + 0140 24840001 24840001 24840001 24840001 $...$...$...$... + 0150 24840001 24840001 24840001 24840001 $...$...$...$... + 0160 24840001 24840001 03e00008 24820001 $...$.......$... + 0170 24020002 03e00008 00000000 00802025 $............. % + 0180 00000000 00000000 03e00008 00802025 .............. % + 0190 3c010000 c42000f8 03e00008 00000000 <.... .......... +Contents of section .rodata: + 0000 3ff00000 00000000 40000000 00000000 ?.......@....... + 0010 40080000 00000000 40100000 00000000 @.......@....... + 0020 40140000 00000000 40180000 00000000 @.......@....... + 0030 401c0000 00000000 40200000 00000000 @.......@ ...... + 0040 3f8ccccd 3f800000 40000000 00000000 ?...?...@....... + 0050 40080000 00000000 40100000 00000000 @.......@....... + 0060 40140000 00000000 40180000 00000000 @.......@....... + 0070 401c0000 00000000 40200000 00000000 @.......@ ...... + 0080 40220000 00000000 41200000 00000100 @"......A ...... + 0090 00000104 00000108 0000010c 00000110 ................ + 00a0 00000114 00000118 0000011c 00000120 ............... + 00b0 00000124 00000128 0000012c 00000130 ...$...(...,...0 + 00c0 00000134 00000138 0000013c 00000140 ...4...8...<...@ + 00d0 00000144 00000148 0000014c 00000150 ...D...H...L...P + 00e0 00000154 00000158 0000015c 00000160 ...T...X...\...` + 00f0 00000164 00000168 3f99999a 00000000 ...d...h?....... +Contents of section .options: + 0000 01200000 00000000 80004002 00000000 . ........@..... + 0010 000000f1 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 8000c016 00000000 000000f1 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_misaligned_doubles.c b/tools/asm-processor/tests/late_rodata_misaligned_doubles.c new file mode 100644 index 0000000..a453dbd --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_misaligned_doubles.c @@ -0,0 +1,77 @@ +GLOBAL_ASM( +.late_rodata + .float 4.01 + .word 0 + .double 4.02 +.text +glabel a + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +double foo(void) { return 4.03; } + +GLOBAL_ASM( +.late_rodata + .float 4.04 + .double 4.05 +.text +glabel b + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +double bar(void) { return 4.06; } +float baz(void) { return 4.07f; } + +GLOBAL_ASM( +.late_rodata + .double 4.08 +.text +glabel c + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + diff --git a/tools/asm-processor/tests/late_rodata_misaligned_doubles.objdump b/tools/asm-processor/tests/late_rodata_misaligned_doubles.objdump new file mode 100644 index 0000000..cdba84d --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_misaligned_doubles.objdump @@ -0,0 +1,56 @@ + +tests/late_rodata_misaligned_doubles.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000120 .text +00000000 l d .rodata 00000040 .rodata +00000040 g F .text 0000001c foo +0000009c g F .text 0000001c bar +000000b8 g F .text 0000001c baz +00000000 g F .text 00000040 a +0000005c g F .text 00000040 b +000000d4 g F .text 00000040 c + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000040 R_MIPS_HI16 .rodata +00000048 R_MIPS_LO16 .rodata +0000009c R_MIPS_HI16 .rodata +000000a4 R_MIPS_LO16 .rodata +000000b8 R_MIPS_HI16 .rodata +000000c0 R_MIPS_LO16 .rodata + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 3c010000 03e00008 d4200010 03e00008 <........ ...... + 0050 00000000 03e00008 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 3c010000 ............<... + 00a0 03e00008 d4200028 03e00008 00000000 ..... .(........ + 00b0 03e00008 00000000 3c010000 03e00008 ........<....... + 00c0 c4200030 03e00008 00000000 03e00008 . .0............ + 00d0 00000000 00000000 00000000 00000000 ................ + 00e0 00000000 00000000 00000000 00000000 ................ + 00f0 00000000 00000000 00000000 00000000 ................ + 0100 00000000 00000000 00000000 00000000 ................ + 0110 00000000 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 408051ec 00000000 4010147a e147ae14 @.Q.....@..z.G.. + 0010 40101eb8 51eb851f 00000000 408147ae @...Q.......@.G. + 0020 40103333 33333333 40103d70 a3d70a3d @.333333@.=p...= + 0030 40823d71 00000000 401051eb 851eb852 @.=q....@.Q....R +Contents of section .options: + 0000 01200000 00000000 80000002 00000000 . .............. + 0010 000000f3 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000002 00000000 000000f3 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/line-continuation-separate-file.s b/tools/asm-processor/tests/line-continuation-separate-file.s new file mode 100644 index 0000000..e130180 --- /dev/null +++ b/tools/asm-processor/tests/line-continuation-separate-file.s @@ -0,0 +1,4 @@ +.rdata + label: .asciiz "1\n\ +2", \ + "34", "56" diff --git a/tools/asm-processor/tests/line-continuation.asmproc.d b/tools/asm-processor/tests/line-continuation.asmproc.d new file mode 100644 index 0000000..687dd1a --- /dev/null +++ b/tools/asm-processor/tests/line-continuation.asmproc.d @@ -0,0 +1,3 @@ +tests/line-continuation.o: tests/line-continuation-separate-file.s + +tests/line-continuation-separate-file.s: diff --git a/tools/asm-processor/tests/line-continuation.c b/tools/asm-processor/tests/line-continuation.c new file mode 100644 index 0000000..d5ab093 --- /dev/null +++ b/tools/asm-processor/tests/line-continuation.c @@ -0,0 +1,22 @@ +void foo(void) { "abcdef"; } + +GLOBAL_ASM( +.rdata + .ascii "AB" \ + "CD", "EF" + .ascii "GH\n\n\n\0\11\222\3333\44444\x1234567\n\nIJK" +) + +void bar(void) { "hello"; } + +GLOBAL_ASM( +.rdata + .asciiz "1\ +2" + .asciiz "34", "56" + .asciiz "78\n\n\n\0\11\222\3333\44444\x1234567\n\n9A" +) + +void baz(void) { "ghijkl"; } + +GLOBAL_ASM("tests/line-continuation-separate-file.s") diff --git a/tools/asm-processor/tests/line-continuation.objdump b/tools/asm-processor/tests/line-continuation.objdump new file mode 100644 index 0000000..038766f --- /dev/null +++ b/tools/asm-processor/tests/line-continuation.objdump @@ -0,0 +1,30 @@ + +tests/line-continuation.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000030 .text +00000000 l d .rodata 00000060 .rodata +00000000 g F .text 00000010 foo +00000010 g F .text 00000010 bar +00000020 g F .text 00000010 baz + + +Contents of section .text: + 0000 03e00008 00000000 03e00008 00000000 ................ + 0010 03e00008 00000000 03e00008 00000000 ................ + 0020 03e00008 00000000 03e00008 00000000 ................ +Contents of section .rodata: + 0000 61626364 65660000 41424344 45464748 abcdef..ABCDEFGH + 0010 0a0a0a00 0992db33 24343467 0a0a494a .......3$44g..IJ + 0020 4b000000 68656c6c 6f000000 31320033 K...hello...12.3 + 0030 34003536 0037380a 0a0a0009 92db3324 4.56.78.......3$ + 0040 3434670a 0a394100 6768696a 6b6c0000 44g..9A.ghijkl.. + 0050 310a3200 33340035 36000000 00000000 1.2.34.56....... +Contents of section .options: + 0000 01200000 00000000 80000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000000 00000000 00000000 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/o0.c b/tools/asm-processor/tests/o0.c new file mode 100644 index 0000000..6f8e5e4 --- /dev/null +++ b/tools/asm-processor/tests/o0.c @@ -0,0 +1,28 @@ +// COMPILE-FLAGS: -O0 + +int a(void) { return 1; } +GLOBAL_ASM( +glabel foo +addiu $a0, $a0, 1 +addiu $a0, $a0, 2 +addiu $a0, $a0, 3 +jr $ra +addiu $a0, $a0, 4 +) +float b(void) { return 1.2f; } +GLOBAL_ASM( +.late_rodata +glabel float1 +.float 12.34 + +.text +glabel bar +addiu $a0, $a0, 5 +addiu $a0, $a0, 6 +addiu $a0, $a0, 7 +addiu $a0, $a0, 8 +lui $v0, %hi(float1 + 1) +jr $ra +addiu $v0, $v0, %lo(float1 + 1) +) +float c(void) { return 1.3f; } diff --git a/tools/asm-processor/tests/o0.objdump b/tools/asm-processor/tests/o0.objdump new file mode 100644 index 0000000..f94ec7a --- /dev/null +++ b/tools/asm-processor/tests/o0.objdump @@ -0,0 +1,44 @@ + +tests/o0.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000090 .text +00000000 l d .rodata 00000010 .rodata +00000000 g F .text 0000001c a +00000030 g F .text 00000020 b +0000006c g F .text 00000020 c +0000001c g F .text 00000014 foo +00000050 g F .text 0000001c bar +00000004 g .rodata 00000000 float1 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000030 R_MIPS_HI16 .rodata +00000034 R_MIPS_LO16 .rodata +0000006c R_MIPS_HI16 .rodata +00000070 R_MIPS_LO16 .rodata +00000060 R_MIPS_HI16 float1 +00000068 R_MIPS_LO16 float1 + + +Contents of section .text: + 0000 24020001 03e00008 00000000 03e00008 $............... + 0010 00000000 03e00008 00000000 24840001 ............$... + 0020 24840002 24840003 03e00008 24840004 $...$.......$... + 0030 3c010000 c4200000 03e00008 00000000 <.... .......... + 0040 03e00008 00000000 03e00008 00000000 ................ + 0050 24840005 24840006 24840007 24840008 $...$...$...$... + 0060 3c020000 03e00008 24420001 3c010000 <.......$B..<... + 0070 c4200008 03e00008 00000000 03e00008 . .............. + 0080 00000000 03e00008 00000000 00000000 ................ +Contents of section .rodata: + 0000 3f99999a 414570a4 3fa66666 00000000 ?...AEp.?.ff.... +Contents of section .options: + 0000 01200000 00000000 80000006 00000000 . .............. + 0010 00000011 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000016 00000000 00000011 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/o2.c b/tools/asm-processor/tests/o2.c new file mode 100644 index 0000000..144a604 --- /dev/null +++ b/tools/asm-processor/tests/o2.c @@ -0,0 +1,26 @@ +// COMPILE-FLAGS: -O2 + +int a(void) { return 1; } +GLOBAL_ASM( +glabel foo +addiu $a0, $a0, 1 +addiu $a0, $a0, 2 +addiu $a0, $a0, 3 +jr $ra +addiu $a0, $a0, 4 +) +float b(void) { return 1.2f; } +GLOBAL_ASM( +.late_rodata +glabel float1 +.float 12.34 + +.text +glabel bar +addiu $a0, $a0, 5 +addiu $a0, $a0, 6 +lui $v0, %hi(float1 + 1) +jr $ra +addiu $v0, $v0, %lo(float1 + 1) +) +float c(void) { return 1.3f; } diff --git a/tools/asm-processor/tests/o2.objdump b/tools/asm-processor/tests/o2.objdump new file mode 100644 index 0000000..61e3fb0 --- /dev/null +++ b/tools/asm-processor/tests/o2.objdump @@ -0,0 +1,40 @@ + +tests/o2.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000050 .text +00000000 l d .rodata 00000010 .rodata +00000000 g F .text 00000008 a +0000001c g F .text 0000000c b +0000003c g F .text 0000000c c +00000008 g F .text 00000014 foo +00000028 g F .text 00000014 bar +00000004 g .rodata 00000000 float1 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000001c R_MIPS_HI16 .rodata +00000024 R_MIPS_LO16 .rodata +0000003c R_MIPS_HI16 .rodata +00000044 R_MIPS_LO16 .rodata +00000030 R_MIPS_HI16 float1 +00000038 R_MIPS_LO16 float1 + + +Contents of section .text: + 0000 03e00008 24020001 24840001 24840002 ....$...$...$... + 0010 24840003 03e00008 24840004 3c010000 $.......$...<... + 0020 03e00008 c4200000 24840005 24840006 ..... ..$...$... + 0030 3c020000 03e00008 24420001 3c010000 <.......$B..<... + 0040 03e00008 c4200008 00000000 00000000 ..... .......... +Contents of section .rodata: + 0000 3f99999a 414570a4 3fa66666 00000000 ?...AEp.?.ff.... +Contents of section .options: + 0000 01200000 00000000 80000006 00000000 . .............. + 0010 00000011 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000016 00000000 00000011 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/pascal.objdump b/tools/asm-processor/tests/pascal.objdump new file mode 100644 index 0000000..cb3740f --- /dev/null +++ b/tools/asm-processor/tests/pascal.objdump @@ -0,0 +1,137 @@ + +tests/pascal.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000e0 .text +00000000 l d .rodata 00000030 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000000 l O .bss 00000000 $dat +00000000 g F .text 0000000c foo +000000d0 g F .text 0000000c bar +0000000c g F .text 00000004 test +00000048 g F .text 00000004 test2 +0000008c g F .text 00000044 test3 +00000000 *UND* 00000000 get +00000000 *UND* 00000000 put +00000000 *UND* 00000000 pascal_close +00000000 *UND* 00000000 fflush +00000000 *UND* 00000000 filesize +00000000 *UND* 00000000 curpos +00000000 *UND* 00000000 seek +00000000 *UND* 00000000 eof +00000000 *UND* 00000000 eoln +00000000 *UND* 00000000 page +00000000 *UND* 00000000 reset +00000000 *UND* 00000000 rewrite +00000000 *UND* 00000000 cos +00000000 *UND* 00000000 exp +00000000 *UND* 00000000 sqrt +00000000 *UND* 00000000 log +00000000 *UND* 00000000 atan +00000000 *UND* 00000000 sin +00000000 *UND* 00000000 __random_float +00000000 *UND* 00000000 clock +00000000 *UND* 00000000 exit +00000000 *UND* 00000000 __date +00000000 *UND* 00000000 __time +00000000 *UND* 00000000 get_arg +00000000 *UND* 00000000 new +00000000 *UND* 00000000 dispose +00000000 *UND* 00000000 initfile +00000000 *UND* 00000000 peek_char +00000000 *UND* 00000000 next_char +00000000 *UND* 00000000 readln +00000000 *UND* 00000000 read_int64 +00000000 *UND* 00000000 read_card64 +00000000 *UND* 00000000 read_integer +00000000 *UND* 00000000 read_cardinal +00000000 *UND* 00000000 read_integer_range +00000000 *UND* 00000000 read_real +00000000 *UND* 00000000 read_double +00000000 *UND* 00000000 read_extended +00000000 *UND* 00000000 read_string +00000000 *UND* 00000000 read_enum +00000000 *UND* 00000000 read_char +00000000 *UND* 00000000 read_char_range +00000000 *UND* 00000000 read_boolean +00000000 *UND* 00000000 read_set +00000000 *UND* 00000000 writeln +00000000 *UND* 00000000 write_int64 +00000000 *UND* 00000000 write_card64 +00000000 *UND* 00000000 write_integer +00000000 *UND* 00000000 write_cardinal +00000000 *UND* 00000000 write_boolean +00000000 *UND* 00000000 write_char +00000000 *UND* 00000000 write_real +00000000 *UND* 00000000 write_double +00000000 *UND* 00000000 write_extended +00000000 *UND* 00000000 write_string +00000000 *UND* 00000000 write_enum +00000000 *UND* 00000000 write_set +00000000 *UND* 00000000 caseerror +00000000 *UND* 00000000 __pc_nloc_goto +00000000 *UND* 00000000 memcpy +00000000 *UND* 00000000 __in_range +00000000 *UND* 00000000 __ll_mul +00000000 *UND* 00000000 __ll_div +00000000 *UND* 00000000 __ull_div +00000000 *UND* 00000000 __ll_mod +00000000 *UND* 00000000 __ll_rem +00000000 *UND* 00000000 __ull_rem +00000000 *UND* 00000000 __ll_lshift +00000000 *UND* 00000000 __ll_rshift +00000000 *UND* 00000000 __ll_to_f +00000000 *UND* 00000000 __ull_to_f +00000000 *UND* 00000000 __ll_to_d +00000000 *UND* 00000000 __ull_to_d +00000000 *UND* 00000000 __f_ll_ll +00000000 *UND* 00000000 __f_to_ull +00000000 *UND* 00000000 __d_to_ll +00000000 *UND* 00000000 __d_to_ull +00000000 *UND* 00000000 round64 +00000000 *UND* 00000000 trunc64 +00000000 *UND* 00000000 max64 +00000000 *UND* 00000000 min64 +00000000 *UND* 00000000 abs64 +00000000 *UND* 00000000 odd64 +00000000 *UND* 00000000 trapNaN +00000000 *UND* 00000008 input +00000000 *UND* 00000008 output +00000000 *UND* 00000008 err +00000000 *UND* 00000008 __Argc + + +RELOCATION RECORDS FOR [.text]: (none) + +RELOCATION RECORDS FOR [.rodata]: (none) + +Contents of section .text: + 0000 00041080 03e00008 00441023 27bdffe8 .........D.#'... + 0010 18a00009 afa00004 8fae0004 008e7821 ..............x! + 0020 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0030 1420fff9 afb90004 10000001 00000000 . .............. + 0040 03e00008 27bd0018 00000000 00000000 ....'........... + 0050 00000000 00000000 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 00000000 ................ + 00a0 00000000 00000000 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00000000 00000000 ................ + 00d0 00041080 03e00008 00441023 00000000 .........D.#.... +Contents of section .rodata: + 0000 00123123 00456456 00789789 00000001 ..1#.EdV.x...... + 0010 3ff19999 9999999a 00000002 00000003 ?............... + 0020 4000cccc cccccccd 00000000 00000000 @............... +Contents of section .data: + 0000 00002323 00003434 00000000 00000000 ..##..44........ +Contents of section .options: + 0000 01200000 00000000 80004016 00000000 . ........@..... + 0010 000000f0 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a300c036 00000000 000000f0 00000000 ...6............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/pascal.p b/tools/asm-processor/tests/pascal.p new file mode 100644 index 0000000..0886126 --- /dev/null +++ b/tools/asm-processor/tests/pascal.p @@ -0,0 +1,95 @@ +{ COMPILE-FLAGS: -O2 } + +function foo(x: integer): integer; +begin + foo := x * 3 +end; + +GLOBAL_ASM( +.section .data +.word 0x2323 + +.late_rodata +.word 0x123123 +.word 0x456456 +.word 0x789789 +.text +glabel test +/* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24 +/* 000094 00400094 18A00009 */ blez $a1, .L004000BC +/* 000098 00400098 AFA00004 */ sw $zero, 4($sp) +.L0040009C: +/* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp) +/* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6 +/* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7) +/* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp) +/* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1 +/* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1 +/* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C +/* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp) +.L004000BC: +/* 0000BC 004000BC 10000001 */ b .L004000C4 +/* 0000C0 004000C0 00000000 */ nop +.L004000C4: +/* 0000C4 004000C4 03E00008 */ jr $ra +/* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24 +) + +GLOBAL_ASM( +.section .data +.word 0x3434 + +.late_rodata +.word 0x1 +.double 1.1 +.word 0x2, 0x3 +.text +glabel test2 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +GLOBAL_ASM( +.late_rodata +.double 2.1 +.text +glabel test3 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +function bar(x: integer): integer; +begin + return x * 3 +end; + diff --git a/tools/asm-processor/tests/static-global.c b/tools/asm-processor/tests/static-global.c new file mode 100644 index 0000000..a7f6169 --- /dev/null +++ b/tools/asm-processor/tests/static-global.c @@ -0,0 +1,33 @@ +// COMPILE-FLAGS: -O2 +// ASMP-FLAGS: --convert-statics=global +static int xtext(int a, int b, int c); +const int rodata1[] = {1}; +static const int rodata2[] = {2}; +int data1[] = {3}; +static int data2[] = {4}; +int bss1; +static int bss2; + +GLOBAL_ASM( +glabel bar +lui $a0, %hi(rodata2) +lw $a0, %lo(rodata2)($a0) +lui $a1, %hi(data2) +lw $a1, %lo(data2)($a0) +lui $a2, %hi(bss2) +lw $a2, %lo(bss2)($a0) +jal xtext +nop +jr $ra +nop +nop +nop +) + +static int xtext(int a, int b, int c) { + return 1; +} + +void baz(void) { + xtext(bss2, rodata2[0], data2[0]); +} diff --git a/tools/asm-processor/tests/static-global.objdump b/tools/asm-processor/tests/static-global.objdump new file mode 100644 index 0000000..a519e4f --- /dev/null +++ b/tools/asm-processor/tests/static-global.objdump @@ -0,0 +1,58 @@ + +tests/static-global.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000080 .text +00000000 l d .rodata 00000010 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000000 g O .rodata 00000004 rodata1 +00000000 g O .data 00000004 data1 +00000000 g O .bss 00000004 bss1 +00000044 g F .text 00000034 baz +00000000 g F .text 00000030 bar +00000004 g O .rodata 00000000 rodata2 +00000004 g O .data 00000000 data2 +00000004 g O .bss 00000000 bss2 +00000030 g F .text 00000000 xtext + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000004c R_MIPS_HI16 .bss +00000064 R_MIPS_LO16 .bss +00000050 R_MIPS_HI16 .rodata +0000005c R_MIPS_LO16 .rodata +00000054 R_MIPS_HI16 .data +00000058 R_MIPS_LO16 .data +00000060 R_MIPS_26 .text +00000000 R_MIPS_HI16 rodata2 +00000004 R_MIPS_LO16 rodata2 +00000008 R_MIPS_HI16 data2 +0000000c R_MIPS_LO16 data2 +00000010 R_MIPS_HI16 bss2 +00000014 R_MIPS_LO16 bss2 +00000018 R_MIPS_26 xtext + + +Contents of section .text: + 0000 3c040000 8c840000 3c050000 8c850000 <.......<....... + 0010 3c060000 8c860000 0c000000 00000000 <............... + 0020 03e00008 00000000 00000000 00000000 ................ + 0030 afa40000 afa50004 afa60008 03e00008 ................ + 0040 24020001 27bdffe8 afbf0014 3c040000 $...'.......<... + 0050 3c050000 3c060000 8cc60004 8ca50004 <...<........... + 0060 0c00000c 8c840004 8fbf0014 27bd0018 ............'... + 0070 03e00008 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 00000001 00000002 00000000 00000000 ................ +Contents of section .data: + 0000 00000003 00000004 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 a0000074 00000000 . .........t.... + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a0000074 00000000 00000000 00000000 ...t............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/static.c b/tools/asm-processor/tests/static.c new file mode 100644 index 0000000..c265021 --- /dev/null +++ b/tools/asm-processor/tests/static.c @@ -0,0 +1,32 @@ +// COMPILE-FLAGS: -O2 +static int xtext(int a, int b, int c); +const int rodata1[] = {1}; +static const int rodata2[] = {2}; +int data1[] = {3}; +static int data2[] = {4}; +int bss1; +static int bss2; + +GLOBAL_ASM( +glabel bar +lui $a0, %hi(rodata2) +lw $a0, %lo(rodata2)($a0) +lui $a1, %hi(data2) +lw $a1, %lo(data2)($a0) +lui $a2, %hi(bss2) +lw $a2, %lo(bss2)($a0) +jal xtext +nop +jr $ra +nop +nop +nop +) + +static int xtext(int a, int b, int c) { + return 1; +} + +void baz(void) { + xtext(bss2, rodata2[0], data2[0]); +} diff --git a/tools/asm-processor/tests/static.objdump b/tools/asm-processor/tests/static.objdump new file mode 100644 index 0000000..dd62c94 --- /dev/null +++ b/tools/asm-processor/tests/static.objdump @@ -0,0 +1,58 @@ + +tests/static.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000080 .text +00000000 l d .rodata 00000010 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000004 l O .rodata 00000000 rodata2 +00000004 l O .data 00000000 data2 +00000004 l O .bss 00000000 bss2 +00000030 l F .text 00000000 xtext +00000000 g O .rodata 00000004 rodata1 +00000000 g O .data 00000004 data1 +00000000 g O .bss 00000004 bss1 +00000044 g F .text 00000034 baz +00000000 g F .text 00000030 bar + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000004c R_MIPS_HI16 .bss +00000064 R_MIPS_LO16 .bss +00000050 R_MIPS_HI16 .rodata +0000005c R_MIPS_LO16 .rodata +00000054 R_MIPS_HI16 .data +00000058 R_MIPS_LO16 .data +00000060 R_MIPS_26 .text +00000000 R_MIPS_HI16 rodata2 +00000004 R_MIPS_LO16 rodata2 +00000008 R_MIPS_HI16 data2 +0000000c R_MIPS_LO16 data2 +00000010 R_MIPS_HI16 bss2 +00000014 R_MIPS_LO16 bss2 +00000018 R_MIPS_26 xtext + + +Contents of section .text: + 0000 3c040000 8c840000 3c050000 8c850000 <.......<....... + 0010 3c060000 8c860000 0c000000 00000000 <............... + 0020 03e00008 00000000 00000000 00000000 ................ + 0030 afa40000 afa50004 afa60008 03e00008 ................ + 0040 24020001 27bdffe8 afbf0014 3c040000 $...'.......<... + 0050 3c050000 3c060000 8cc60004 8ca50004 <...<........... + 0060 0c00000c 8c840004 8fbf0014 27bd0018 ............'... + 0070 03e00008 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 00000001 00000002 00000000 00000000 ................ +Contents of section .data: + 0000 00000003 00000004 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 a0000074 00000000 . .........t.... + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a0000074 00000000 00000000 00000000 ...t............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/test1.c b/tools/asm-processor/tests/test1.c new file mode 100644 index 0000000..475555a --- /dev/null +++ b/tools/asm-processor/tests/test1.c @@ -0,0 +1,71 @@ + +GLOBAL_ASM( +.rdata +.word 0x1212 +) + +GLOBAL_ASM( +.late_rodata +.word 0x123123 +.text +glabel test +/* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24 +/* 000094 00400094 18A00009 */ blez $a1, .L004000BC +/* 000098 00400098 AFA00004 */ sw $zero, 4($sp) +.L0040009C: +/* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp) +/* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6 +/* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7) +/* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp) +/* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1 +/* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1 +/* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C +/* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp) +.L004000BC: +/* 0000BC 004000BC 10000001 */ b .L004000C4 +/* 0000C0 004000C0 00000000 */ nop +.L004000C4: +/* 0000C4 004000C4 03E00008 */ jr $ra +/* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24 +) + +char bss1[3]; +GLOBAL_ASM( +.bss +bss2: +.space 3 +) +char bss3[3]; +char bss4[3]; +const int rodata1[2] = {1}; +extern int some_rodata; + +unsigned g(float, int); +unsigned f(void) { + return g(1.1f, some_rodata); +} + +GLOBAL_ASM( +.rdata +glabel some_rodata +.word 0x1313 +.text +.late_rodata +.word 0x321321 +.text +glabel g +/* 0000C0 004000C0 27BDFFE8 */ addiu $sp, $sp, -0x18 +/* 0000C4 004000C4 AFBF0014 */ sw $ra, 0x14($sp) +/* 0000C8 004000C8 240E0004 */ addiu $t6, $zero, 4 +/* 0000CC 004000CC 3C010041 */ lui $at, %hi(D_410100) +/* 0000D0 004000D0 AC2E0100 */ sw $t6, %lo(D_410100)($at) +/* 0000D4 004000D4 0C10002C */ jal func_004000B0 +/* 0000D8 004000D8 00000000 */ nop +/* 0000DC 004000DC 10000001 */ b .L004000E4 +/* 0000E0 004000E0 00000000 */ nop +.L004000E4: +/* 0000E4 004000E4 8FBF0014 */ lw $ra, 0x14($sp) +/* 0000E8 004000E8 27BD0018 */ addiu $sp, $sp, 0x18 +/* 0000EC 004000EC 03E00008 */ jr $ra +/* 0000F0 004000F0 00000000 */ nop +) diff --git a/tools/asm-processor/tests/test1.objdump b/tools/asm-processor/tests/test1.objdump new file mode 100644 index 0000000..b97ae46 --- /dev/null +++ b/tools/asm-processor/tests/test1.objdump @@ -0,0 +1,54 @@ + +tests/test1.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000b0 .text +00000000 l d .rodata 00000020 .rodata +00000000 l d .bss 00000010 .bss +00000000 g O .bss 00000003 bss1 +00000008 g O .bss 00000003 bss3 +0000000c g O .bss 00000003 bss4 +00000004 g O .rodata 00000008 rodata1 +0000003c g F .text 0000003c f +00000000 g F .text 0000003c test +0000000c g .rodata 00000000 some_rodata +00000078 g F .text 00000004 g +00000000 *UND* 00000000 D_410100 +00000000 *UND* 00000000 func_004000B0 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000044 R_MIPS_HI16 .rodata +00000054 R_MIPS_LO16 .rodata +00000048 R_MIPS_HI16 some_rodata +0000004c R_MIPS_LO16 some_rodata +00000050 R_MIPS_26 g +00000084 R_MIPS_HI16 D_410100 +00000088 R_MIPS_LO16 D_410100 +0000008c R_MIPS_26 func_004000B0 + + +Contents of section .text: + 0000 27bdffe8 18a00009 afa00004 8fae0004 '............... + 0010 008e7821 a1e00000 8fb80004 27190001 ..x!........'... + 0020 0325082a 1420fff9 afb90004 10000001 .%.*. .......... + 0030 00000000 03e00008 27bd0018 27bdffe8 ........'...'... + 0040 afbf0014 3c010000 3c050000 8ca50000 ....<...<....... + 0050 0c000000 c42c0014 10000003 00000000 .....,.......... + 0060 10000001 00000000 8fbf0014 27bd0018 ............'... + 0070 03e00008 00000000 27bdffe8 afbf0014 ........'....... + 0080 240e0004 3c010000 ac2e0000 0c000000 $...<........... + 0090 00000000 10000001 00000000 8fbf0014 ................ + 00a0 27bd0018 03e00008 00000000 00000000 '............... +Contents of section .rodata: + 0000 00001212 00000001 00000000 00001313 ................ + 0010 00123123 3f8ccccd 00321321 00000000 ..1#?....2.!.... +Contents of section .options: + 0000 01200000 00000000 a0000022 00000000 . .........".... + 0010 00001010 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a300c032 00000000 00001010 00000000 ...2............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/test2.c b/tools/asm-processor/tests/test2.c new file mode 100644 index 0000000..15969fe --- /dev/null +++ b/tools/asm-processor/tests/test2.c @@ -0,0 +1,69 @@ +const char buf1[1] = {1}; +float func1(void) { + "func1"; + return 0.1f; +} +const char buf2[1] = {2}; +void func2(void) { + *(volatile float*)0 = -3.5792360305786133f; + *(volatile float*)0 = -3.5792362689971924f; + // "func2"; + // return 0.2f; +} +const char buf3[1] = {3}; +int func3(int x) { + switch(x) { + case 0: + return 1; + case 1: + return 2; + case 2: + return 3; + case 3: + return 4; + case 4: + return 5; + case 5: + return 4; + case 6: + return 4; + case 7: + return 4; + default: + return 3; + } +} + +#if 1 +GLOBAL_ASM( +.rdata +.word 0x66756e63 # func +.word 0x34000000 # 4\0\0\0 +.word jumptarget + 4 + +.late_rodata +glabel rv +.word 0x3e4ccccd # 0.2f +.word jumptarget + 8 + +.text +glabel func4 +lui $at, %hi(rv) +glabel jumptarget +jr $ra +lwc1 $f0, %lo(rv)($at) +jr $ra +nop +jr $ra +nop +jr $ra +nop +jr $ra +nop +) +#else +float func4(void) { + "func4"; + return 0.2f; +} +#endif diff --git a/tools/asm-processor/tests/test2.objdump b/tools/asm-processor/tests/test2.objdump new file mode 100644 index 0000000..276ed9f --- /dev/null +++ b/tools/asm-processor/tests/test2.objdump @@ -0,0 +1,76 @@ + +tests/test2.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000f0 .text +00000000 l d .rodata 00000060 .rodata +00000000 g O .rodata 00000001 buf1 +00000000 g F .text 0000001c func1 +0000000c g O .rodata 00000001 buf2 +0000001c g F .text 00000028 func2 +00000010 g O .rodata 00000001 buf3 +00000044 g F .text 0000007c func3 +000000c4 g F .text 00000000 jumptarget +000000c0 g F .text 0000000c func4 +0000004c g .rodata 00000000 rv + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000000 R_MIPS_HI16 .rodata +00000008 R_MIPS_LO16 .rodata +0000001c R_MIPS_HI16 .rodata +00000020 R_MIPS_LO16 .rodata +00000028 R_MIPS_HI16 .rodata +0000002c R_MIPS_LO16 .rodata +00000054 R_MIPS_HI16 .rodata +0000005c R_MIPS_LO16 .rodata +000000c0 R_MIPS_HI16 rv +000000c8 R_MIPS_LO16 rv + + +RELOCATION RECORDS FOR [.rodata]: +OFFSET TYPE VALUE +0000002c R_MIPS_32 .text +00000030 R_MIPS_32 .text +00000034 R_MIPS_32 .text +00000038 R_MIPS_32 .text +0000003c R_MIPS_32 .text +00000040 R_MIPS_32 .text +00000044 R_MIPS_32 .text +00000048 R_MIPS_32 .text +0000001c R_MIPS_32 jumptarget +00000050 R_MIPS_32 jumptarget + + +Contents of section .text: + 0000 3c010000 03e00008 c4200020 03e00008 <........ . .... + 0010 00000000 03e00008 00000000 3c010000 ............<... + 0020 c4240024 e4040000 3c010000 c4260028 .$.$....<....&.( + 0030 e4060000 03e00008 00000000 03e00008 ................ + 0040 00000000 2c810008 10200017 00000000 ....,.... ...... + 0050 00047080 3c010000 002e0821 8c2e002c ..p.<......!..., + 0060 01c00008 00000000 03e00008 24020001 ............$... + 0070 03e00008 24020002 03e00008 24020003 ....$.......$... + 0080 03e00008 24020004 03e00008 24020005 ....$.......$... + 0090 03e00008 24020004 03e00008 24020004 ....$.......$... + 00a0 03e00008 24020004 03e00008 24020003 ....$.......$... + 00b0 03e00008 00000000 03e00008 00000000 ................ + 00c0 3c010000 03e00008 c4200000 03e00008 <........ ...... + 00d0 00000000 03e00008 00000000 03e00008 ................ + 00e0 00000000 03e00008 00000000 00000000 ................ +Contents of section .rodata: + 0000 01000000 66756e63 31000000 02000000 ....func1....... + 0010 03000000 66756e63 34000000 00000004 ....func4....... + 0020 3dcccccd c0651234 c0651235 00000068 =....e.4.e.5...h + 0030 00000070 00000078 00000080 00000088 ...p...x........ + 0040 00000090 00000098 000000a0 3e4ccccd ............>L.. + 0050 00000008 00000000 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 80004016 00000000 . ........@..... + 0010 00000051 00000000 00000000 00007ff0 ...Q............ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80004016 00000000 00000051 00000000 ..@........Q.... + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/test3.c b/tools/asm-processor/tests/test3.c new file mode 100644 index 0000000..d74bb4c --- /dev/null +++ b/tools/asm-processor/tests/test3.c @@ -0,0 +1,70 @@ + +GLOBAL_ASM( +.rdata +.word 321321 +.text +glabel test +/* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24 +/* 000094 00400094 18A00009 */ blez $a1, .L004000BC +/* 000098 00400098 AFA00004 */ sw $zero, 4($sp) +.L0040009C: +/* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp) +/* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6 +/* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7) +/* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp) +/* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1 +/* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1 +/* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C +/* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp) +.L004000BC: +/* 0000BC 004000BC 10000001 */ b .L004000C4 +/* 0000C0 004000C0 00000000 */ nop +.L004000C4: +/* 0000C4 004000C4 03E00008 */ jr $ra +/* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24 +) + +// static -> no symbols +// bss +char globalBuf[4]; +const char constBuf[4]; + +// data +char globalBufInit[4] = {1}; + +// rodata +const char constBufInit[4] = {1}; +const char constBufInit2[1] = {2}; +const char constBufInit3[1] = {3}; + +unsigned g(void); +unsigned f(void) { + // aligns to 4 or 8 byte boundary (char -> 4, double -> 8) + double x = 5.1; + float y = 5.2f; + float z = 5.3f; + "Hello "; + "World"; + return g(); +} + +GLOBAL_ASM( +.rdata +.word 123123 +.text +glabel g +/* 0000C0 004000C0 27BDFFE8 */ addiu $sp, $sp, -0x18 +/* 0000C4 004000C4 AFBF0014 */ sw $ra, 0x14($sp) +/* 0000C8 004000C8 240E0004 */ addiu $t6, $zero, 4 +/* 0000CC 004000CC 3C010041 */ lui $at, %hi(D_410100) +/* 0000D0 004000D0 AC2E0100 */ sw $t6, %lo(D_410100)($at) +/* 0000D4 004000D4 0C10002C */ jal func_004000B0 +/* 0000D8 004000D8 00000000 */ nop +/* 0000DC 004000DC 10000001 */ b .L004000E4 +/* 0000E0 004000E0 00000000 */ nop +.L004000E4: +/* 0000E4 004000E4 8FBF0014 */ lw $ra, 0x14($sp) +/* 0000E8 004000E8 27BD0018 */ addiu $sp, $sp, 0x18 +/* 0000EC 004000EC 03E00008 */ jr $ra +/* 0000F0 004000F0 00000000 */ nop +) diff --git a/tools/asm-processor/tests/test3.objdump b/tools/asm-processor/tests/test3.objdump new file mode 100644 index 0000000..bfa7f6e --- /dev/null +++ b/tools/asm-processor/tests/test3.objdump @@ -0,0 +1,64 @@ + +tests/test3.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000d0 .text +00000000 l d .rodata 00000040 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000000 g O .bss 00000004 globalBuf +00000004 g O .bss 00000004 constBuf +00000000 g O .data 00000004 globalBufInit +00000004 g O .rodata 00000004 constBufInit +00000008 g O .rodata 00000001 constBufInit2 +0000000c g O .rodata 00000001 constBufInit3 +0000003c g F .text 00000054 f +00000000 g F .text 00000004 test +00000090 g F .text 00000004 g +00000000 *UND* 00000000 D_410100 +00000000 *UND* 00000000 func_004000B0 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000044 R_MIPS_HI16 .rodata +00000048 R_MIPS_LO16 .rodata +00000050 R_MIPS_HI16 .rodata +00000054 R_MIPS_LO16 .rodata +0000005c R_MIPS_HI16 .rodata +00000060 R_MIPS_LO16 .rodata +00000068 R_MIPS_26 g +0000009c R_MIPS_HI16 D_410100 +000000a0 R_MIPS_LO16 D_410100 +000000a4 R_MIPS_26 func_004000B0 + + +Contents of section .text: + 0000 27bdffe8 18a00009 afa00004 8fae0004 '............... + 0010 008e7821 a1e00000 8fb80004 27190001 ..x!........'... + 0020 0325082a 1420fff9 afb90004 10000001 .%.*. .......... + 0030 00000000 03e00008 27bd0018 27bdffd8 ........'...'... + 0040 afbf0014 3c010000 d4240028 f7a40020 ....<....$.(... + 0050 3c010000 c4260030 e7a6001c 3c010000 <....&.0....<... + 0060 c4280034 e7a80018 0c000000 00000000 .(.4............ + 0070 10000003 00000000 10000001 00000000 ................ + 0080 8fbf0014 27bd0028 03e00008 00000000 ....'..(........ + 0090 27bdffe8 afbf0014 240e0004 3c010000 '.......$...<... + 00a0 ac2e0000 0c000000 00000000 10000001 ................ + 00b0 00000000 8fbf0014 27bd0018 03e00008 ........'....... + 00c0 00000000 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 0004e729 01000000 02000000 03000000 ...)............ + 0010 48656c6c 6f202000 576f726c 64000000 Hello .World... + 0020 0001e0f3 00000000 40146666 66666666 ........@.ffffff + 0030 40a66666 40a9999a 00000000 00000000 @.ff@........... +Contents of section .data: + 0000 01000000 00000000 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 a0000002 00000000 . .............. + 0010 00000170 00000000 00000000 00007ff0 ...p............ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a300c032 00000000 00000170 00000000 ...2.......p.... + 0010 00000000 00007ff0 ........ |
