1 # This patch contains various fixes for the thumb code handling in GCC 3.4.4
3 # Most of these are minor fixes to code which is either missing (Linux thumb
4 # div0, thumb clear instruction cache) or uses the wrong return mechanism
7 # There is also a significant design problem with the _call_via_rx code -
8 # it cannot be in a shared library because a call via PLT simply won't
9 # work (for _call_via_ip) and is very inefficient anyway.
11 # This is fixed in uclibc simply by incorporating the code into crti.S
12 # (an extra 30 bytes for the 15 functions) even though not all link units
13 # require all the code - there is so little of it. That doesn't work with
14 # the crti.asm here because it is linked with libgcc.a which already defines
17 --- gcc-3.4.4/gcc/config/arm/t-linux.orig 2005-08-09 08:55:02.181797492 -0700
18 +++ gcc-3.4.4/gcc/config/arm/t-linux 2005-08-09 08:58:22.766419486 -0700
20 LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
21 _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
22 _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
26 # MULTILIB_OPTIONS = mhard-float/msoft-float
27 --- gcc-3.4.4/.pc/gcc34-thumb-support.patch/gcc/config/arm/lib1funcs.asm 2004-01-15 08:56:34.000000000 -0800
28 +++ gcc-3.4.4/gcc/config/arm/lib1funcs.asm 2005-09-21 21:32:03.376927755 -0700
31 /* Constants taken from <asm/unistd.h> and <asm/signal.h> */
33 +#if !defined __thumb__
34 #define __NR_SYSCALL_BASE 0x900000
36 +#define __NR_SYSCALL_BASE 0
38 #define __NR_getpid (__NR_SYSCALL_BASE+ 20)
39 #define __NR_kill (__NR_SYSCALL_BASE+ 37)
44 +#if ! defined __thumb__
54 + mov r7, #__NR_getpid
56 + @ above the compare is with -1000, but the standard syscall
57 + @ macro checks for -1..-125
68 + @ on 4T that won't work
78 code here switches to the correct mode before executing the function. */
85 .macro call_via register
86 THUMB_FUNC_START _call_via_\register
87 + .hidden SYM (_call_via_\register)
92 SIZE (_call_via_\register)
97 THUMB_FUNC_START _interwork_call_via_\register
98 + .hidden SYM (_interwork_call_via_\register)
102 --- gcc-3.4.4/.pc/gcc34-thumb-support.patch/gcc/config/arm/linux-gas.h 2003-06-19 14:47:06.000000000 -0700
103 +++ gcc-3.4.4/gcc/config/arm/linux-gas.h 2005-09-20 16:09:55.027862200 -0700
106 /* Clear the instruction cache from `beg' to `end'. This makes an
107 inline system call to SYS_cacheflush. */
108 +#if !defined(__thumb__)
109 #define CLEAR_INSN_CACHE(BEG, END) \
111 register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
114 : "0" (_beg), "r" (_end), "r" (_flg)); \
117 +#define CLEAR_INSN_CACHE(BEG, END) \
119 + register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
120 + register unsigned long _end __asm ("a2") = (unsigned long) (END); \
121 + register unsigned long _flg __asm ("a3") = 0; \
122 + register unsigned long _swi __asm ("a4") = 0xf0002; \
123 + __asm __volatile ("push {r7}\n" \
125 + " swi 0 @ sys_cacheflush\n" \
128 + : "0" (_beg), "r" (_end), "r" (_flg), "r" (_swi)); \
131 --- gcc-3.4.4/.pc/gcc34-thumb-support.patch/libffi/src/arm/sysv.S 2003-10-21 12:01:55.000000000 -0700
132 +++ gcc-3.4.4/libffi/src/arm/sysv.S 2005-09-20 16:09:55.027862200 -0700
134 #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
137 +/* Get the correct return instruction */
138 +#if defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5__) \
139 + || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__)
155 # move first 4 parameters in registers