summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2005-08-11 20:03:56 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-08-11 20:03:56 +0000
commit122c43cb0589c423749b9f046ceed1ab53bee9f6 (patch)
treef4381920fc7e84bf5eabd3cd37bf6adeee33fbec
parent5f016dabf20ee6196f7e141e7f499a09b7342f91 (diff)
This set of changes ensures that TARGET_CC_ARCH is passed reliably to all
packages in a build. The change fixes problems in the following packages: binutils{,-cross}_2.15.94.0.1 HOST_CC_ARCH was not being passed to HOST_CC. The problem does not seem to be present in binutils* 2.16, however this version is still used for uClibc builds. gcc{,-cross,-cross-initial}_3.4.4 HOST/TARGET_CC_ARCH was not used in the appropriate places, plus this was not sufficient - FLAGS_FOR_TARGET (a gcc make variable) is now preloaded with the target CC_ARCH values, which causes all the builds (gcc, g++, gcj, fortran) to get the correct values. gcc OTHER *NOT* fixed - other versions of gcc will still need the _CC_ARCH fix in the same lines (CC_FOR_TARGET, GCC_FOR_TARGET, CXX_FOR_TARGET), however so long as these builds use gcc3-*.inc the FLAGS_FOR_TARGET fixx will be there. uclibc{,-initial}_0.9.27 TARGET_CC_ARCH added to the do_compile. For the do_stage step the build actually compiles target code (make utils), but this will not accept a CC with whitespace. The TARGET_CC_ARCH flags have therefore been added to CFLAGS (a bit ugly, but it works). These changes have been tested for both cross and target builds, the changes should be fine on self-hosted (i.e. target-hosted) builds, if anyone actually does these, but note that the gcc build specifically tests for build==host and does *not* do certain _FOR_TARGET settings in this case (this was the case before this change too) - if you are seeing strange settings on self-hosted gcc builds (before and after this change) check the do_compile environment variable settings.
-rw-r--r--packages/binutils/binutils_2.15.94.0.1.bb8
-rw-r--r--packages/gcc/gcc-3.4.4/gcc34-configure.in.patch22
-rw-r--r--packages/gcc/gcc-3.4.4/gcc34-thumb-clearinsn.patch26
-rw-r--r--packages/gcc/gcc-3.4.4/gcc34-thumb-div0.patch11
-rw-r--r--packages/gcc/gcc-3.4.4/gcc34-thumb-lib1asmfuncs.patch10
-rw-r--r--packages/gcc/gcc-cross_3.4.4.bb2
-rw-r--r--packages/gcc/gcc3-build-cross.inc2
-rw-r--r--packages/gcc/gcc3-build.inc17
-rw-r--r--packages/gcc/gcc_3.4.4.bb7
-rw-r--r--packages/uclibc/uclibc-0.9.27/arm-thumb-defined.patch84
-rw-r--r--packages/uclibc/uclibc-0.9.27/thumb-swi.patch82
-rw-r--r--packages/uclibc/uclibc-0.9.27/thumb-swp.patch102
-rw-r--r--packages/uclibc/uclibc.inc8
-rw-r--r--packages/uclibc/uclibc_0.9.27.bb5
14 files changed, 374 insertions, 12 deletions
diff --git a/packages/binutils/binutils_2.15.94.0.1.bb b/packages/binutils/binutils_2.15.94.0.1.bb
index f8d39b1720..5edf4548a3 100644
--- a/packages/binutils/binutils_2.15.94.0.1.bb
+++ b/packages/binutils/binutils_2.15.94.0.1.bb
@@ -3,7 +3,7 @@ HOMEPAGE = "http://www.gnu.org/software/binutils/"
SECTION = "devel"
LICENSE = "GPL"
MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
-PR = "r0"
+PR = "r1"
inherit autotools gettext
@@ -69,14 +69,14 @@ export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
-export CC_FOR_HOST = "${CCACHE} ${HOST_PREFIX}gcc"
-export CXX_FOR_HOST = "${CCACHE} ${HOST_PREFIX}gcc"
+export CC_FOR_HOST = "${CCACHE} ${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
+export CXX_FOR_HOST = "${CCACHE} ${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
export CC_FOR_BUILD = "${BUILD_CC}"
export CPP_FOR_BUILD = "${BUILD_CPP}"
export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
-export CC = "${CCACHE} ${HOST_PREFIX}gcc"
+export CC = "${CCACHE} ${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
do_configure () {
(cd ${S}; gnu-configize) || die "Failed to run gnu-configize"
diff --git a/packages/gcc/gcc-3.4.4/gcc34-configure.in.patch b/packages/gcc/gcc-3.4.4/gcc34-configure.in.patch
new file mode 100644
index 0000000000..3d33bcb978
--- /dev/null
+++ b/packages/gcc/gcc-3.4.4/gcc34-configure.in.patch
@@ -0,0 +1,22 @@
+--- gcc-3.4.4/configure.in.orig 2005-08-09 19:57:51.504323183 -0700
++++ gcc-3.4.4/configure.in 2005-08-09 20:00:12.073168623 -0700
+@@ -1907,7 +1907,7 @@
+ *) gxx_include_dir=${with_gxx_include_dir} ;;
+ esac
+
+-FLAGS_FOR_TARGET=
++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
+ case " $target_configdirs " in
+ *" newlib "*)
+ case " $target_configargs " in
+--- gcc-3.4.4/configure.orig 2005-08-09 21:02:29.668360660 -0700
++++ gcc-3.4.4/configure 2005-08-09 21:02:50.157649970 -0700
+@@ -2669,7 +2669,7 @@
+ *) gxx_include_dir=${with_gxx_include_dir} ;;
+ esac
+
+-FLAGS_FOR_TARGET=
++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
+ case " $target_configdirs " in
+ *" newlib "*)
+ case " $target_configargs " in
diff --git a/packages/gcc/gcc-3.4.4/gcc34-thumb-clearinsn.patch b/packages/gcc/gcc-3.4.4/gcc34-thumb-clearinsn.patch
new file mode 100644
index 0000000000..57ccb85361
--- /dev/null
+++ b/packages/gcc/gcc-3.4.4/gcc34-thumb-clearinsn.patch
@@ -0,0 +1,26 @@
+--- 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
new file mode 100644
index 0000000000..d57a420053
--- /dev/null
+++ b/packages/gcc/gcc-3.4.4/gcc34-thumb-div0.patch
@@ -0,0 +1,11 @@
+--- 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-lib1asmfuncs.patch b/packages/gcc/gcc-3.4.4/gcc34-thumb-lib1asmfuncs.patch
new file mode 100644
index 0000000000..c3972d7ece
--- /dev/null
+++ b/packages/gcc/gcc-3.4.4/gcc34-thumb-lib1asmfuncs.patch
@@ -0,0 +1,10 @@
+--- 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-cross_3.4.4.bb b/packages/gcc/gcc-cross_3.4.4.bb
index b261db4c1f..c111ac00b7 100644
--- a/packages/gcc/gcc-cross_3.4.4.bb
+++ b/packages/gcc/gcc-cross_3.4.4.bb
@@ -5,7 +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 = "r0"
+PR = "r1"
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/gcc3-build-cross.inc b/packages/gcc/gcc3-build-cross.inc
index 0893e4b97c..a41ae11d64 100644
--- a/packages/gcc/gcc3-build-cross.inc
+++ b/packages/gcc/gcc3-build-cross.inc
@@ -13,7 +13,7 @@ do_compile_prepend () {
export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
export LD_FOR_TARGET="${TARGET_SYS}-ld"
export NM_FOR_TARGET="${TARGET_SYS}-nm"
- export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc"
+ export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
}
do_stage_append () {
diff --git a/packages/gcc/gcc3-build.inc b/packages/gcc/gcc3-build.inc
index 09e0b31910..a09c6cf1f5 100644
--- a/packages/gcc/gcc3-build.inc
+++ b/packages/gcc/gcc3-build.inc
@@ -44,6 +44,12 @@ EXTRA_OECONF_glibc = "--enable-__cxa_atexit"
EXTRA_OECONF += "${@get_gcc_fpu_setting(bb, d)}"
CPPFLAGS = ""
+# Used by configure to define additional values for FLAGS_FOR_TARGET -
+# passed to all the compilers.
+ARCH_FLAGS_FOR_TARGET = ""
+ARCH_FLAGS_FOR_TARGET_nslu2 = "${TARGET_CC_ARCH}"
+EXTRA_OEMAKE += "ARCH_FLAGS_FOR_TARGET='${ARCH_FLAGS_FOR_TARGET}'"
+
def get_gcc_fpu_setting(bb, d):
if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
return "--with-float=soft"
@@ -59,10 +65,14 @@ python __anonymous () {
do_configure () {
# Setup these vars for cross building only
+ # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
+ # gcc build stuff when the build is producing a cross compiler - i.e.
+ # when the 'current' target is the 'host' system, and the host is not
+ # the target (because the build is actually making a cross compiler!)
if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
- export CC_FOR_TARGET="${CCACHE} ${HOST_PREFIX}gcc"
- export GCC_FOR_TARGET="${CCACHE} ${HOST_PREFIX}gcc"
- export CXX_FOR_TARGET="${CCACHE} ${HOST_PREFIX}g++"
+ export CC_FOR_TARGET="${CC}"
+ export GCC_FOR_TARGET="${CC}"
+ export CXX_FOR_TARGET="${CXX}"
export AS_FOR_TARGET="${HOST_PREFIX}as"
export LD_FOR_TARGET="${HOST_PREFIX}ld"
export NM_FOR_TARGET="${HOST_PREFIX}nm"
@@ -75,6 +85,7 @@ do_configure () {
export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
+ export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
(cd ${S} && gnu-configize) || die "failure running gnu-configize"
oe_runconf
}
diff --git a/packages/gcc/gcc_3.4.4.bb b/packages/gcc/gcc_3.4.4.bb
index 263d78396c..f4a67b77c2 100644
--- a/packages/gcc/gcc_3.4.4.bb
+++ b/packages/gcc/gcc_3.4.4.bb
@@ -1,4 +1,4 @@
-PR = "r1"
+PR = "r2"
DESCRIPTION = "The GNU cc and gcc C compilers."
HOMEPAGE = "http://www.gnu.org/software/gcc/"
SECTION = "devel"
@@ -24,4 +24,9 @@ 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-configure.in.patch;patch=1"
+
include gcc3-build.inc
diff --git a/packages/uclibc/uclibc-0.9.27/arm-thumb-defined.patch b/packages/uclibc/uclibc-0.9.27/arm-thumb-defined.patch
new file mode 100644
index 0000000000..675ab6f5c0
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.27/arm-thumb-defined.patch
@@ -0,0 +1,84 @@
+--- uClibc-0.9.27/ldso/include/dl-string.h.orig 2005-08-09 18:16:50.618935711 -0700
++++ uClibc-0.9.27/ldso/include/dl-string.h 2005-08-09 18:17:02.279669474 -0700
+@@ -250,7 +250,7 @@
+ }
+
+
+-#if defined(mc68000) || defined(__arm__) || defined(__mips__) || defined(__sh__) || defined(__powerpc__)
++#if defined(mc68000) || defined(__arm__) || defined(__mips__) || defined(__sh__) || defined(__powerpc__) || defined(__thumb__)
+ /* On some arches constant strings are referenced through the GOT. */
+ /* XXX Requires load_addr to be defined. */
+ #define SEND_STDERR(X) \
+--- uClibc-0.9.27/ldso/ldso/dl-startup.c.orig 2005-08-09 18:17:02.307671237 -0700
++++ uClibc-0.9.27/ldso/ldso/dl-startup.c 2005-08-09 18:19:40.633634061 -0700
+@@ -137,7 +137,7 @@
+ /* First obtain the information on the stack that tells us more about
+ what binary is loaded, where it is loaded, etc, etc */
+ GET_ARGV(aux_dat, args);
+-#if defined (__arm__) || defined (__mips__) || defined (__cris__)
++#if defined (__arm__) || defined (__mips__) || defined (__cris__) || defined(__thumb__)
+ aux_dat += 1;
+ #endif
+ argc = *(aux_dat - 1);
+@@ -200,7 +200,7 @@
+ __asm__("movel %%a5,%0":"=g"(got));
+ #elif defined(__sparc__)
+ __asm__("\tmov %%l7,%0\n\t":"=r"(got));
+-#elif defined(__arm__)
++#elif defined(__arm__) || defined(__thumb__)
+ __asm__("\tmov %0, r10\n\t":"=r"(got));
+ #elif defined(__powerpc__)
+ __asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t":"=l"(got));
+--- uClibc-0.9.27/libc/sysdeps/linux/common/create_module.c.orig 2005-08-09 18:19:40.769642620 -0700
++++ uClibc-0.9.27/libc/sysdeps/linux/common/create_module.c 2005-08-09 18:19:58.442754719 -0700
+@@ -31,7 +31,7 @@
+
+ #ifdef __NR_create_module
+
+-#if defined(__i386__) || defined(__m68k__) || defined(__arm__) || defined(__cris__) || defined(__i960__)
++#if defined(__i386__) || defined(__m68k__) || defined(__arm__) || defined(__cris__) || defined(__i960__) || defined(__thumb__)
+ #define __NR___create_module __NR_create_module
+ #ifdef __STR_NR_create_module
+ #define __STR_NR___create_module __STR_NR_create_module
+--- uClibc-0.9.27/libc/sysdeps/linux/common/iopl.c.orig 2005-08-09 18:20:02.302997628 -0700
++++ uClibc-0.9.27/libc/sysdeps/linux/common/iopl.c 2005-08-09 18:20:12.327628439 -0700
+@@ -9,7 +9,7 @@
+
+ #include "syscalls.h"
+ /* For arm there is a totally different implementation */
+-#if !defined(__arm__)
++#if !defined(__arm__) && !defined(__thumb__)
+ /* Tuns out the m68k unistd.h kernel header is broken */
+ # if defined __ARCH_HAS_MMU__ && defined __NR_iopl && ( !defined(__mc68000__))
+ _syscall1(int, iopl, int, level);
+--- uClibc-0.9.27/libm/math_private.h.orig 2005-08-09 18:20:18.584022129 -0700
++++ uClibc-0.9.27/libm/math_private.h 2005-08-09 18:21:26.280281986 -0700
+@@ -40,7 +40,7 @@
+ * For VFP, floats words follow the memory system mode.
+ */
+
+-#if (__BYTE_ORDER == __BIG_ENDIAN) || defined(__arm__) && !defined(__VFP_FP__)
++#if (__BYTE_ORDER == __BIG_ENDIAN) || (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__)
+
+ typedef union
+ {
+@@ -54,7 +54,7 @@
+
+ #endif
+
+-#if (__BYTE_ORDER == __LITTLE_ENDIAN) && (!defined(__arm__) || defined(__VFP_FP__))
++#if (__BYTE_ORDER == __LITTLE_ENDIAN) && ((!defined(__arm__) && !defined(__thumb__)) || defined(__VFP_FP__))
+
+ typedef union
+ {
+--- uClibc-0.9.27/utils/ldd.c.orig 2005-08-09 18:21:27.724372857 -0700
++++ uClibc-0.9.27/utils/ldd.c 2005-08-09 18:23:13.018998630 -0700
+@@ -51,7 +51,7 @@
+ #include <dmalloc.h>
+ #endif
+
+-#if defined(__arm__)
++#if defined(__arm__) || defined(__thumb__)
+ #define MATCH_MACHINE(x) (x == EM_ARM)
+ #define ELFCLASSM ELFCLASS32
+ #endif
diff --git a/packages/uclibc/uclibc-0.9.27/thumb-swi.patch b/packages/uclibc/uclibc-0.9.27/thumb-swi.patch
new file mode 100644
index 0000000000..a6929a9fc5
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.27/thumb-swi.patch
@@ -0,0 +1,82 @@
+--- uClibc-0.9.27/.pc/thumb-swi.patch/libc/sysdeps/linux/arm/bits/syscalls.h 2005-01-11 23:59:21.000000000 -0800
++++ uClibc-0.9.27/libc/sysdeps/linux/arm/bits/syscalls.h 2005-08-08 21:04:11.081932985 -0700
+@@ -97,6 +97,7 @@
+ #define INTERNAL_SYSCALL_DECL(err) do { } while (0)
+
+ #undef INTERNAL_SYSCALL
++#if !defined(__thumb__)
+ #define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ unsigned int _sys_result; \
+ { \
+@@ -109,6 +110,21 @@
+ _sys_result = _a1; \
+ } \
+ (int) _sys_result; })
++#else
++#define INTERNAL_SYSCALL(name, err, nr, args...) \
++ ({ unsigned int _sys_result; \
++ { \
++ register int _a1 asm ("a1"); \
++ LOAD_ARGS_##nr (args) \
++ register int _r7 asm ("r7") = (int) (SYS_ify(name)); \
++ asm volatile ("swi 0 @ syscall " #name \
++ : "=r" (_a1) \
++ : "r" (_r7) ASM_ARGS_##nr \
++ : "memory"); \
++ _sys_result = _a1; \
++ } \
++ (int) _sys_result; })
++#endif
+
+ #undef INTERNAL_SYSCALL_ERROR_P
+ #define INTERNAL_SYSCALL_ERROR_P(val, err) \
+--- uClibc-0.9.27/libc/sysdeps/linux/arm/brk.c.orig 2005-01-11 23:59:21.000000000 -0800
++++ uClibc-0.9.27/libc/sysdeps/linux/arm/brk.c 2005-08-09 12:44:56.000000000 -0700
+@@ -26,14 +26,7 @@
+
+ int brk (void *addr)
+ {
+- void *newbrk;
+-
+- asm ("mov a1, %1\n" /* save the argment in r0 */
+- "swi %2\n" /* do the system call */
+- "mov %0, a1;" /* keep the return value */
+- : "=r"(newbrk)
+- : "r"(addr), "i" (__NR_brk)
+- : "a1");
++ void *newbrk = (void*)INTERNAL_SYSCALL(brk, , 1, addr);
+
+ __curbrk = newbrk;
+
+--- uClibc-0.9.27/libc/sysdeps/linux/arm/syscall.c.orig 2005-08-09 12:51:10.681364959 -0700
++++ uClibc-0.9.27/libc/sysdeps/linux/arm/syscall.c 2005-08-09 12:52:43.371197563 -0700
+@@ -26,6 +26,7 @@
+
+ long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
+ {
++#if !defined(__thumb__)
+ register long _r0 asm("r0")=(long)(sysnum);
+ register long _r6 asm("r6")=(long)(f);
+ register long _r5 asm("r5")=(long)(e);
+@@ -40,6 +41,21 @@
+ "r"(_r2), "r"(_r3), "r"(_r4), "r"(_r5),
+ "r"(_r6)
+ : "memory");
++#else
++ register long _r7 asm("r7")=(long)(sysnum);
++ register long _r5 asm("r5")=(long)(f);
++ register long _r4 asm("r4")=(long)(e);
++ register long _r3 asm("r3")=(long)(d);
++ register long _r2 asm("r2")=(long)(c);
++ register long _r1 asm("r1")=(long)(b);
++ register long _r0 asm("r0")=(long)(a);
++ asm volatile(
++ "swi 0"
++ : "=r"(_r0)
++ : "r"(_r0), "r"(_r1), "r"(_r2), "r"(_r3),
++ "r"(_r4), "r"(_r5), "r"(_r7)
++ : "memory");
++#endif
+ if(_r0 >=(unsigned long) -4095) {
+ long err = _r0;
+ (*__errno_location())=(-err);
diff --git a/packages/uclibc/uclibc-0.9.27/thumb-swp.patch b/packages/uclibc/uclibc-0.9.27/thumb-swp.patch
new file mode 100644
index 0000000000..89171f735d
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.27/thumb-swp.patch
@@ -0,0 +1,102 @@
+--- uClibc-0.9.27/libc/sysdeps/linux/arm/bits/atomicity.h.orig 2005-08-09 13:12:59.663734027 -0700
++++ uClibc-0.9.27/libc/sysdeps/linux/arm/bits/atomicity.h 2005-08-09 17:54:14.581605661 -0700
+@@ -31,12 +31,23 @@
+ int tmp2;
+ int result;
+ __asm__ ("\n"
++#if defined(__thumb__)
++ "\t.align 0\n"
++ "\tbx pc\n"
++ "\tnop\n"
++ "\t.arm\n"
++#endif
+ "0:\tldr\t%0,[%3]\n\t"
+ "add\t%1,%0,%4\n\t"
+ "swp\t%2,%1,[%3]\n\t"
+ "cmp\t%0,%2\n\t"
+ "swpne\t%1,%2,[%3]\n\t"
+ "bne\t0b"
++#if defined(__thumb__)
++ "\torr %1, pc, #1\n"
++ "\tbx %1\n"
++ "\t.force_thumb"
++#endif
+ : "=&r" (result), "=&r" (tmp1), "=&r" (tmp2)
+ : "r" (mem), "r"(val)
+ : "cc", "memory");
+@@ -51,12 +62,23 @@
+ int tmp2;
+ int tmp3;
+ __asm__ ("\n"
++#if defined(__thumb__)
++ "\t.align 0\n"
++ "\tbx pc\n"
++ "\tnop\n"
++ "\t.arm\n"
++#endif
+ "0:\tldr\t%0,[%3]\n\t"
+ "add\t%1,%0,%4\n\t"
+ "swp\t%2,%1,[%3]\n\t"
+ "cmp\t%0,%2\n\t"
+ "swpne\t%1,%2,[%3]\n\t"
+ "bne\t0b"
++#if defined(__thumb__)
++ "\torr %1, pc, #1\n"
++ "\tbx %1\n"
++ "\t.force_thumb"
++#endif
+ : "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3)
+ : "r" (mem), "r"(val)
+ : "cc", "memory");
+@@ -68,6 +90,12 @@
+ {
+ int result, tmp;
+ __asm__ ("\n"
++#if defined(__thumb__)
++ "\t.align 0\n"
++ "\tbx pc\n"
++ "\tnop\n"
++ "\t.arm\n"
++#endif
+ "0:\tldr\t%1,[%2]\n\t"
+ "mov\t%0,#0\n\t"
+ "cmp\t%1,%4\n\t"
+@@ -78,6 +106,11 @@
+ "bne\t0b\n\t"
+ "mov\t%0,#1\n"
+ "1:"
++#if defined(__thumb__)
++ "\torr %1, pc, #1\n"
++ "\tbx %1\n"
++ "\t.force_thumb"
++#endif
+ : "=&r" (result), "=&r" (tmp)
+ : "r" (p), "r" (newval), "r" (oldval)
+ : "cc", "memory");
+--- uClibc-0.9.27/libpthread/linuxthreads/sysdeps/arm/pt-machine.h.orig 2005-08-09 14:16:50.204774778 -0700
++++ uClibc-0.9.27/libpthread/linuxthreads/sysdeps/arm/pt-machine.h 2005-08-09 17:55:54.027863420 -0700
+@@ -39,9 +39,24 @@
+ {
+ register unsigned int ret;
+
++#if defined(__thumb__)
++ void *pc;
++ __asm__ __volatile__(
++ ".align 0\n"
++ "\tbx pc\n"
++ "\tnop\n"
++ "\t.arm\n"
++ "\tswp %0, %2, [%3]\n"
++ "\torr %1, pc, #1\n"
++ "\tbx %1\n"
++ "\t.force_thumb"
++ : "=r"(ret), "=r"(pc)
++ : "0"(1), "r"(spinlock));
++#else
+ __asm__ __volatile__("swp %0, %1, [%2]"
+ : "=r"(ret)
+ : "0"(1), "r"(spinlock));
++#endif
+
+ return ret;
+ }
diff --git a/packages/uclibc/uclibc.inc b/packages/uclibc/uclibc.inc
index b86ffb1b9b..aa4d165dcc 100644
--- a/packages/uclibc/uclibc.inc
+++ b/packages/uclibc/uclibc.inc
@@ -62,8 +62,14 @@ SRC_URI = "${@['${UCLIBC_LOCALE_URI}', ''][bb.data.getVar('USE_NLS', d, 1) != 'y
UCLIBC_PREFIX = "${CROSS_DIR}/${TARGET_SYS}"
UCLIBC_STAGE_PREFIX = "${STAGING_DIR}/${HOST_SYS}"
-EXTRA_OEMAKE = "'OPTIMIZATION=' 'CPU_CFLAGS=${CFLAGS}' 'STRIPTOOL=true' 'LD=${LD}' \
+# do_stage barfs on a CC with whitepspace, therefore put the 'HOST_CC_ARCH' in
+# the CFLAGS (for when building the utils).
+OEMAKE_NO_CC = "'OPTIMIZATION=' 'CPU_CFLAGS=${CFLAGS}' 'STRIPTOOL=true' 'LD=${LD}' \
'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'"
+EXTRA_OEMAKE = "${OEMAKE_NO_CC} 'CC=${CC}'"
+EXTRA_OEMAKE_task_do_populate_staging = "${OEMAKE_NO_CC}"
+EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
+
configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${CROSS_DIR}/${TARGET_SYS}/include",g; \
s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \
s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \
diff --git a/packages/uclibc/uclibc_0.9.27.bb b/packages/uclibc/uclibc_0.9.27.bb
index 3f593c5698..7ae11507c6 100644
--- a/packages/uclibc/uclibc_0.9.27.bb
+++ b/packages/uclibc/uclibc_0.9.27.bb
@@ -1,5 +1,5 @@
DEFAULT_PREFERENCE = "1"
-PR = "r5"
+PR = "r6"
include uclibc.inc
@@ -16,4 +16,7 @@ SRC_URI += "http://www.uclibc.org/downloads/uClibc-${PV}.tar.bz2 \
file://nokernelheadercheck.patch;patch=1"
SRC_URI += " file://armeb-kernel-stat.h.patch;patch=1"
SRC_URI += "${PATCH_ipc_h}"
+SRC_URI += " file://thumb-swi.patch;patch=1"
+SRC_URI += " file://thumb-swp.patch;patch=1"
+SRC_URI += " file://arm-thumb-defined.patch;patch=1"
S = "${WORKDIR}/uClibc-${PV}"