From cd49c7be0f05ac20ec76176f921936b00e1b2e8f Mon Sep 17 00:00:00 2001 From: John Bowler Date: Thu, 22 Sep 2005 19:40:39 +0000 Subject: gcc_3.4.4: updated thumb patches The four previous thumb related patch files have been combined into one and simplified. Additional problems with call_via_rX functions being called via the PLT have been fixed (the functions can no longer be called this way - they are hidden). Unnecessary adds of exports of these functions from libgcc have been removed. --- packages/gcc/gcc-3.4.4/gcc34-thumb-clearinsn.patch | 26 ---- packages/gcc/gcc-3.4.4/gcc34-thumb-div0.patch | 11 -- packages/gcc/gcc-3.4.4/gcc34-thumb-interwork.patch | 51 ------- .../gcc/gcc-3.4.4/gcc34-thumb-lib1asmfuncs.patch | 10 -- packages/gcc/gcc-3.4.4/gcc34-thumb-support.patch | 156 +++++++++++++++++++++ packages/gcc/gcc-cross_3.4.4.bb | 5 +- packages/gcc/gcc_3.4.4.bb | 10 +- 7 files changed, 159 insertions(+), 110 deletions(-) delete mode 100644 packages/gcc/gcc-3.4.4/gcc34-thumb-clearinsn.patch delete mode 100644 packages/gcc/gcc-3.4.4/gcc34-thumb-div0.patch delete mode 100644 packages/gcc/gcc-3.4.4/gcc34-thumb-interwork.patch delete mode 100644 packages/gcc/gcc-3.4.4/gcc34-thumb-lib1asmfuncs.patch create mode 100644 packages/gcc/gcc-3.4.4/gcc34-thumb-support.patch (limited to 'packages/gcc') diff --git a/packages/gcc/gcc-3.4.4/gcc34-thumb-clearinsn.patch b/packages/gcc/gcc-3.4.4/gcc34-thumb-clearinsn.patch deleted file mode 100644 index 57ccb85361..0000000000 --- a/packages/gcc/gcc-3.4.4/gcc34-thumb-clearinsn.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- gcc-3.4.4/gcc/config/arm/linux-gas.h.orig 2005-08-09 08:10:22.809195204 -0700 -+++ gcc-3.4.4/gcc/config/arm/linux-gas.h 2005-08-09 08:13:06.539498102 -0700 -@@ -56,6 +56,7 @@ - - /* Clear the instruction cache from `beg' to `end'. This makes an - inline system call to SYS_cacheflush. */ -+#if !defined(__thumb__) - #define CLEAR_INSN_CACHE(BEG, END) \ - { \ - register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ -@@ -65,3 +66,15 @@ - : "=r" (_beg) \ - : "0" (_beg), "r" (_end), "r" (_flg)); \ - } -+#else -+#define CLEAR_INSN_CACHE(BEG, END) \ -+{ \ -+ register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ -+ register unsigned long _end __asm ("a2") = (unsigned long) (END); \ -+ register unsigned long _flg __asm ("a3") = 0; \ -+ register unsigned long _swi __asm ("r7") = 0x9f0002; \ -+ __asm __volatile ("swi 0 @ sys_cacheflush" \ -+ : "=r" (_beg) \ -+ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_swi)); \ -+} -+#endif diff --git a/packages/gcc/gcc-3.4.4/gcc34-thumb-div0.patch b/packages/gcc/gcc-3.4.4/gcc34-thumb-div0.patch deleted file mode 100644 index d57a420053..0000000000 --- a/packages/gcc/gcc-3.4.4/gcc34-thumb-div0.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-3.4.4/gcc/config/arm/lib1funcs.asm.orig 2005-08-09 07:58:42.717141188 -0700 -+++ gcc-3.4.4/gcc/config/arm/lib1funcs.asm 2005-08-09 07:58:45.425311603 -0700 -@@ -816,7 +816,7 @@ - #define __NR_kill (__NR_SYSCALL_BASE+ 37) - - .code 32 -- FUNC_START div0 -+ ARM_FUNC_START div0 - - stmfd sp!, {r1, lr} - swi __NR_getpid diff --git a/packages/gcc/gcc-3.4.4/gcc34-thumb-interwork.patch b/packages/gcc/gcc-3.4.4/gcc34-thumb-interwork.patch deleted file mode 100644 index ee3a25c7ef..0000000000 --- a/packages/gcc/gcc-3.4.4/gcc34-thumb-interwork.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- gcc-3.4.4/gcc/config/arm/interwork.ver.orig 2005-09-08 21:59:26.000000000 -0700 -+++ gcc-3.4.4/gcc/config/arm/interwork.ver 2005-09-08 22:11:10.211617698 -0700 -@@ -0,0 +1,37 @@ -+# We need to add the _call_via_rX and _interwork... calls, follow -+# the same test as in the lib1funcs.asm file (note that this is -+# evaluated by gcc -E) -+%if (defined __ARM_ARCH_4T__ || defined __ARM_ARCH_5T__ || defined __ARM_ARCH_5TE__) -+GCC_3.4.4 { -+ _call_via_r0 -+ _call_via_r1 -+ _call_via_r2 -+ _call_via_r3 -+ _call_via_r4 -+ _call_via_r5 -+ _call_via_r6 -+ _call_via_r7 -+ _call_via_r8 -+ _call_via_r9 -+ _call_via_sl -+ _call_via_fp -+ _call_via_ip -+ _call_via_sp -+ _call_via_lr -+ _interwork_call_via_r0 -+ _interwork_call_via_r1 -+ _interwork_call_via_r2 -+ _interwork_call_via_r3 -+ _interwork_call_via_r4 -+ _interwork_call_via_r5 -+ _interwork_call_via_r6 -+ _interwork_call_via_r7 -+ _interwork_call_via_r8 -+ _interwork_call_via_r9 -+ _interwork_call_via_sl -+ _interwork_call_via_fp -+ _interwork_call_via_ip -+ _interwork_call_via_sp -+ _interwork_call_via_lr -+} -+%endif ---- gcc-3.4.4/gcc/config/arm/t-linux.orig 2005-09-08 22:31:32.448528218 -0700 -+++ gcc-3.4.4/gcc/config/arm/t-linux 2005-09-08 21:59:34.651848882 -0700 -@@ -10,6 +10,8 @@ - _call_via_rX _interwork_call_via_rX \ - _fixsfsi _fixunssfsi - -+SHLIB_MAPFILES += $(srcdir)/config/arm/interwork.ver -+ - # MULTILIB_OPTIONS = mhard-float/msoft-float - # MULTILIB_DIRNAMES = hard-float soft-float - diff --git a/packages/gcc/gcc-3.4.4/gcc34-thumb-lib1asmfuncs.patch b/packages/gcc/gcc-3.4.4/gcc34-thumb-lib1asmfuncs.patch deleted file mode 100644 index c3972d7ece..0000000000 --- a/packages/gcc/gcc-3.4.4/gcc34-thumb-lib1asmfuncs.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- gcc-3.4.4/gcc/config/arm/t-linux.orig 2005-08-09 08:55:02.181797492 -0700 -+++ gcc-3.4.4/gcc/config/arm/t-linux 2005-08-09 08:58:22.766419486 -0700 -@@ -7,6 +7,7 @@ - LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ - _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ - _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ -+ _call_via_rX _interwork_call_via_rX \ - _fixsfsi _fixunssfsi - - # MULTILIB_OPTIONS = mhard-float/msoft-float diff --git a/packages/gcc/gcc-3.4.4/gcc34-thumb-support.patch b/packages/gcc/gcc-3.4.4/gcc34-thumb-support.patch new file mode 100644 index 0000000000..a4f156f8db --- /dev/null +++ b/packages/gcc/gcc-3.4.4/gcc34-thumb-support.patch @@ -0,0 +1,156 @@ +# This patch contains various fixes for the thumb code handling in GCC 3.4.4 +# +# Most of these are minor fixes to code which is either missing (Linux thumb +# div0, thumb clear instruction cache) or uses the wrong return mechanism +# (libffi) +# +# There is also a significant design problem with the _call_via_rx code - +# it cannot be in a shared library because a call via PLT simply won't +# work (for _call_via_ip) and is very inefficient anyway. +# +# This is fixed in uclibc simply by incorporating the code into crti.S +# (an extra 30 bytes for the 15 functions) even though not all link units +# require all the code - there is so little of it. That doesn't work with +# the crti.asm here because it is linked with libgcc.a which already defines +# these symbols +# +--- gcc-3.4.4/gcc/config/arm/t-linux.orig 2005-08-09 08:55:02.181797492 -0700 ++++ gcc-3.4.4/gcc/config/arm/t-linux 2005-08-09 08:58:22.766419486 -0700 +@@ -7,6 +7,7 @@ + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ + _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ + _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _call_via_rX \ + _fixsfsi _fixunssfsi + + # MULTILIB_OPTIONS = mhard-float/msoft-float +--- gcc-3.4.4/.pc/gcc34-thumb-support.patch/gcc/config/arm/lib1funcs.asm 2004-01-15 08:56:34.000000000 -0800 ++++ gcc-3.4.4/gcc/config/arm/lib1funcs.asm 2005-09-21 21:32:03.376927755 -0700 +@@ -811,13 +811,18 @@ + + /* Constants taken from and */ + #define SIGFPE 8 ++#if !defined __thumb__ + #define __NR_SYSCALL_BASE 0x900000 ++#else ++#define __NR_SYSCALL_BASE 0 ++#endif + #define __NR_getpid (__NR_SYSCALL_BASE+ 20) + #define __NR_kill (__NR_SYSCALL_BASE+ 37) + + .code 32 + FUNC_START div0 + ++#if ! defined __thumb__ + stmfd sp!, {r1, lr} + swi __NR_getpid + cmn r0, #1000 +@@ -825,6 +830,28 @@ + mov r1, #SIGFPE + swi __NR_kill + RETLDM r1 ++#else ++ push {r1, r7, lr} ++ mov r7, #__NR_getpid ++ swi 0 ++ @ above the compare is with -1000, but the standard syscall ++ @ macro checks for -1..-125 ++ add r0, #125 ++ bcs 90f ++ sub r0, #125 ++ mov r1, #SIGFPE ++ mov r7, #__NR_kill ++ swi 0 ++90: ++#if __ARM_ARCH__ > 4 ++ pop {r1, r7, pc} ++#else ++ @ on 4T that won't work ++ pop {r1, r7} ++ pop {r3} ++ bx r3 ++#endif ++#endif + + FUNC_END div0 + +@@ -845,14 +872,14 @@ + code here switches to the correct mode before executing the function. */ + + .text +- .align 0 ++ .align 1 + .force_thumb + + .macro call_via register + THUMB_FUNC_START _call_via_\register ++ .hidden SYM (_call_via_\register) + + bx \register +- nop + + SIZE (_call_via_\register) + .endm +@@ -903,6 +930,7 @@ + .code 16 + + THUMB_FUNC_START _interwork_call_via_\register ++ .hidden SYM (_interwork_call_via_\register) + + bx pc + nop +--- gcc-3.4.4/.pc/gcc34-thumb-support.patch/gcc/config/arm/linux-gas.h 2003-06-19 14:47:06.000000000 -0700 ++++ gcc-3.4.4/gcc/config/arm/linux-gas.h 2005-09-20 16:09:55.027862200 -0700 +@@ -56,6 +56,7 @@ + + /* Clear the instruction cache from `beg' to `end'. This makes an + inline system call to SYS_cacheflush. */ ++#if !defined(__thumb__) + #define CLEAR_INSN_CACHE(BEG, END) \ + { \ + register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ +@@ -65,3 +66,18 @@ + : "=r" (_beg) \ + : "0" (_beg), "r" (_end), "r" (_flg)); \ + } ++#else ++#define CLEAR_INSN_CACHE(BEG, END) \ ++{ \ ++ register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ ++ register unsigned long _end __asm ("a2") = (unsigned long) (END); \ ++ register unsigned long _flg __asm ("a3") = 0; \ ++ register unsigned long _swi __asm ("a4") = 0xf0002; \ ++ __asm __volatile ("push {r7}\n" \ ++ " mov r7,a4\n" \ ++ " swi 0 @ sys_cacheflush\n" \ ++ " pop {r7}\n" \ ++ : "=r" (_beg) \ ++ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_swi)); \ ++} ++#endif +--- gcc-3.4.4/.pc/gcc34-thumb-support.patch/libffi/src/arm/sysv.S 2003-10-21 12:01:55.000000000 -0700 ++++ gcc-3.4.4/libffi/src/arm/sysv.S 2005-09-20 16:09:55.027862200 -0700 +@@ -41,6 +41,14 @@ + #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): + #endif + ++/* Get the correct return instruction */ ++#if defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5__) \ ++ || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) ++#define RET bx r ++#else ++#define RET mov pc, ++#endif ++ + .text + + # a1: ffi_prep_args +@@ -66,7 +74,7 @@ + + # And call + mov lr, pc +- mov pc, ip ++ RET ip + + # move first 4 parameters in registers + ldr a1, [sp, #0] diff --git a/packages/gcc/gcc-cross_3.4.4.bb b/packages/gcc/gcc-cross_3.4.4.bb index 9e8ebd51f5..d965e5b399 100644 --- a/packages/gcc/gcc-cross_3.4.4.bb +++ b/packages/gcc/gcc-cross_3.4.4.bb @@ -5,10 +5,7 @@ inherit cross FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}" # NOTE: split PR. If the main .oe changes something that affects its *build* # remember to increment this one too. -PR = "r2" - -# At present the thumb implementation is non-functional -ARM_INSTRUCTION_SET = "" +PR = "r3" DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc" PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" diff --git a/packages/gcc/gcc_3.4.4.bb b/packages/gcc/gcc_3.4.4.bb index e34eaf717c..5be603f2ca 100644 --- a/packages/gcc/gcc_3.4.4.bb +++ b/packages/gcc/gcc_3.4.4.bb @@ -1,4 +1,4 @@ -PR = "r4" +PR = "r5" DESCRIPTION = "The GNU cc and gcc C compilers." HOMEPAGE = "http://www.gnu.org/software/gcc/" SECTION = "devel" @@ -9,9 +9,6 @@ inherit autotools gettext include gcc-package.inc -# At present the thumb implementation is non-functional -ARM_INSTRUCTION_SET = "" - SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \ file://gcc34-reverse-compare.patch;patch=1 \ file://gcc34-arm-ldm.patch;patch=1 \ @@ -27,10 +24,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \ file://15342.patch;patch=1 \ file://always-fixincperm.patch;patch=1" -SRC_URI += "file://gcc34-thumb-div0.patch;patch=1" -SRC_URI += "file://gcc34-thumb-clearinsn.patch;patch=1" -SRC_URI += "file://gcc34-thumb-lib1asmfuncs.patch;patch=1" -SRC_URI += "file://gcc34-thumb-interwork.patch;patch=1" SRC_URI += "file://gcc34-configure.in.patch;patch=1" +SRC_URI += "file://gcc34-thumb-support.patch;patch=1" include gcc3-build.inc -- cgit v1.2.3