summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorThomas Chou <thomas@wytron.com.tw>2010-05-21 11:08:03 +0800
committerScott McNutt <smcnutt@psyent.com>2010-05-28 10:56:03 -0400
commit0df01fd3d71481b5cc7aeea6a741b9fc3be15178 (patch)
treea5eb637453d7f400eb1f9709b376ad247905e265 /examples
parent661ba14051db6766932fcb50ba1ec7c67f230054 (diff)
nios2: fix r15 issue for gcc4
The "-ffixed-r15" option doesn't work well for gcc4. Since we don't use gp for small data with option "-G0", we can use gp as global data pointer. This allows compiler to use r15. It is necessary for gcc4 to work properly. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/standalone/stubs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index ce3371d9122..0187708e0bd 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -84,7 +84,7 @@ gd_t *global_data;
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x) : "r0");
#elif defined(CONFIG_NIOS2)
/*
- * r15 holds the pointer to the global_data, r8 is call-clobbered
+ * gp holds the pointer to the global_data, r8 is call-clobbered
*/
#define EXPORT_FUNC(x) \
asm volatile ( \
@@ -92,11 +92,11 @@ gd_t *global_data;
#x ":\n" \
" movhi r8, %%hi(%0)\n" \
" ori r8, r0, %%lo(%0)\n" \
-" add r8, r8, r15\n" \
+" add r8, r8, gp\n" \
" ldw r8, 0(r8)\n" \
" ldw r8, %1(r8)\n" \
" jmp r8\n" \
- : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r15");
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "gp");
#elif defined(CONFIG_M68K)
/*
* d7 holds the pointer to the global_data, a0 is a call-clobbered