summaryrefslogtreecommitdiff
path: root/testcase
diff options
context:
space:
mode:
authorPeng Fan <van.freenix@gmail.com>2013-07-24 15:47:47 +0800
committerPeng Fan <van.freenix@gmail.com>2013-07-24 15:47:47 +0800
commitf21aa4dbcab097e6972f2a50461b96312c269084 (patch)
tree19429a70f8baa6bb6f8c85817ca97dab91537318 /testcase
parent20cac2e624ce8f2bc55af38b2b030c92a4aac6d1 (diff)
Mips Support
Diffstat (limited to 'testcase')
-rw-r--r--testcase/1.c32
-rw-r--r--testcase/2.c8
-rw-r--r--testcase/wscript13
3 files changed, 53 insertions, 0 deletions
diff --git a/testcase/1.c b/testcase/1.c
index 98d4453..bfb8d24 100644
--- a/testcase/1.c
+++ b/testcase/1.c
@@ -137,6 +137,38 @@ int rtems(int argc, char **argv)
"lwz 3, 4(1)\r\n"
"addi 1, 1, 4\r\n"
);
+#elif defined (__mips__)
+ __asm__ volatile (
+ "addiu $29, $29, -8\n\t"
+ "sw $24,4($29)\n\t"
+ "sw $25,0($29)\n\t"
+ "la $24, 1f\n\t"
+ "lw $24, 0($24)\n\t"
+ "li $25, 32\t\n"
+ "sw $25, 0($24)\n\t"
+ "j 3f\n\t"
+ "1:\n\t"
+ ".word global\n\t"
+ "3:\n\t"
+ "lw $24,4($29)\n\t"
+ "lw $25,0($29)\n\t"
+ "addiu $29, $29, 8\n\t"
+ );
+
+ if (global == 32)
+ printf("R_MIPS_32: '.word global' pass \n");
+#if 1
+ printf("R_MIPS_32: '.word global' pass \n");
+#endif
+
+ __asm__ volatile (
+ "la $31, 1f\n\t"
+ "b tst_pc16\n\t" /* R_MIPS_PC16 */
+ "j tst_pc16\n\t"
+ "1:\n\t"
+ "nop\n\t"
+ );
+
#else
/* other archs */
#endif
diff --git a/testcase/2.c b/testcase/2.c
index a63c1c7..cac20fa 100644
--- a/testcase/2.c
+++ b/testcase/2.c
@@ -1,6 +1,14 @@
extern int global;
extern void hello(int);
+#if defined (__mips__)
+void tst_pc16(void)
+{
+ printf("R_MIPS_PC16: 'b tst_pc16' \n");
+ return;
+}
+#endif
+
int test(int argc, char **argv)
{
global = 1; //inter-module data access
diff --git a/testcase/wscript b/testcase/wscript
index 0eacc2f..8ece186 100644
--- a/testcase/wscript
+++ b/testcase/wscript
@@ -38,6 +38,19 @@ def build(bld):
'--entry', 'my_main'],
source = ['1.c', '2.c'])
+ elif arch == 'mips':
+# cflags = '-fno-common -mlong-calls'
+ bld(target = 'test.rap',
+ features = 'c rap',
+ xxxx = 'hello',
+
+ cflags = '-fno-common',
+
+ rtems_linkflags = ['--base', 'rtld.prelink',
+ '--entry', 'my_main', '-a', 'mips'],
+ source = ['1.c', '2.c'])
+
+
bld(target = '../test.rap',
source = ['test.rap'],
rule = 'cp ${SRC} ${TGT}')