diff options
author | John Bowler <jbowler@nslu2-linux.org> | 2005-09-22 19:44:38 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-09-22 19:44:38 +0000 |
commit | 4ab3322bcc988a6a0c0c1d2236d73e20b01dcf2e (patch) | |
tree | cb8ec7dcda091bcbce203d551fb80f2e4132be3e /packages/uclibc/uclibc-0.9.28/thumb-swi-r7.patch | |
parent | cd49c7be0f05ac20ec76176f921936b00e1b2e8f (diff) |
uclibc_0.9.28: fix thumb support to allow thumb uclibc
This, together with the fixes in gcc and binutils, allows a system to
be build with thumb libgcc and libuClibc (etc). ucslugc is changed to
release 2 and to use thumb compilation of these modules.
Diffstat (limited to 'packages/uclibc/uclibc-0.9.28/thumb-swi-r7.patch')
-rw-r--r-- | packages/uclibc/uclibc-0.9.28/thumb-swi-r7.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/uclibc/uclibc-0.9.28/thumb-swi-r7.patch b/packages/uclibc/uclibc-0.9.28/thumb-swi-r7.patch new file mode 100644 index 0000000000..330ceb6869 --- /dev/null +++ b/packages/uclibc/uclibc-0.9.28/thumb-swi-r7.patch @@ -0,0 +1,48 @@ +# This is a work round for a fairly serious GCC compiler bug - when +# the syscall assembler overwrites r7 (required on thumb) the +# compiler fails to protect the register when it is using it as a +# frame pointer. +# +--- uClibc-0.9.28/libc/sysdeps/linux/arm/bits/syscalls.h 2005-09-12 17:51:26.062205918 -0700 ++++ uClibc-0.9.28/libc/sysdeps/linux/arm/bits/syscalls.h 2005-09-12 18:16:15.507930828 -0700 +@@ -111,6 +111,11 @@ + } \ + (int) _sys_result; }) + #else ++#if 0 ++/* This doesn't work because GCC uses r7 as a frame pointer in ++ * some cases and doesn't notice that the _r7 value changes ++ * it, resulting in mysterious crashes after the SWI. ++ */ + #define INTERNAL_SYSCALL(name, err, nr, args...) \ + ({ unsigned int _sys_result; \ + { \ +@@ -124,6 +129,28 @@ + _sys_result = _a1; \ + } \ + (int) _sys_result; }) ++#else ++/* So hide the use of r7 from the compiler, this would be a lot ++ * easier but for the fact that the syscalls can exceed 255. ++ * For the moment the LOAD_ARG_7 is sacrificed. ++ */ ++#define INTERNAL_SYSCALL(name, err, nr, args...) \ ++ ({ unsigned int _sys_result; \ ++ { \ ++ register int _a1 asm ("a1"); \ ++ LOAD_ARGS_##nr (args) \ ++ register int _v3 asm ("v3") = (int) (SYS_ify(name)); \ ++ asm volatile ("push {r7}\n" \ ++ "\tmov r7, v3\n" \ ++ "\tswi 0 @ syscall " #name "\n" \ ++ "\tpop {r7}" \ ++ : "=r" (_a1) \ ++ : "r" (_v3) ASM_ARGS_##nr \ ++ : "memory"); \ ++ _sys_result = _a1; \ ++ } \ ++ (int) _sys_result; }) ++#endif + #endif + + #undef INTERNAL_SYSCALL_ERROR_P |