dealt (nicely) with the libgcc.a on the crio not having enough functions
diff --git a/aos/build/aos.gypi b/aos/build/aos.gypi
index 662a419..115ae06 100644
--- a/aos/build/aos.gypi
+++ b/aos/build/aos.gypi
@@ -44,6 +44,8 @@
'defines': [
'__STDC_FORMAT_MACROS',
'_FORTIFY_SOURCE=2',
+ '__STDC_CONSTANT_MACROS',
+ '__STDC_LIMIT_MACROS',
],
'ldflags': [
'-pipe',
diff --git a/aos/build/download_externals.sh b/aos/build/download_externals.sh
index 5e07d02..4f999b2 100755
--- a/aos/build/download_externals.sh
+++ b/aos/build/download_externals.sh
@@ -89,3 +89,10 @@
CFLAGS='-m32' CXXFLAGS='-m32' LDFLAGS='-m32' \
bash -c "cd ${LIBUSB_DIR} && ./configure \
--prefix=`readlink -f ${LIBUSB_PREFIX}` && make && make install"
+
+# get the LLVM Compiler-RT source
+COMPILER_RT_TAG=RELEASE_32/final
+COMPILER_RT_VERSION=`echo ${COMPILER_RT_TAG} | sed s:/:_:`
+COMPILER_RT_DIR=${EXTERNALS}/compiler-rt-${COMPILER_RT_VERSION}
+COMPILER_RT_URL=http://llvm.org/svn/llvm-project/compiler-rt/tags/${COMPILER_RT_TAG}
+[ -d ${COMPILER_RT_DIR} ] || svn checkout ${COMPILER_RT_URL} ${COMPILER_RT_DIR}
diff --git a/aos/build/externals.gyp b/aos/build/externals.gyp
index 1033551..958f823 100644
--- a/aos/build/externals.gyp
+++ b/aos/build/externals.gyp
@@ -13,6 +13,7 @@
'gflags_version': '2.0',
'libusb_version': '1.0.9',
'libusb_apiversion': '1.0',
+ 'compiler_rt_version': 'RELEASE_32_final',
},
'targets': [
{
@@ -179,4 +180,7 @@
},
},
],
+ 'includes': [
+ 'libgcc-additions/libgcc-additions.gypi',
+ ],
}
diff --git a/aos/build/libgcc-additions/README b/aos/build/libgcc-additions/README
new file mode 100644
index 0000000..6a9a665
--- /dev/null
+++ b/aos/build/libgcc-additions/README
@@ -0,0 +1,26 @@
+This directory contains the stuff necessary to deal with the fact that the
+ libgcc.a from the old GCC that the cRIO has doesn't have all of the functions
+ that newer GCCs expect from it.
+
+[extra functions necessary for 4.5.2]
+I generated this diff with `powerpc-wrs-vxworks-nm \
+ gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/lib/gcc/powerpc-wrs-vxworks/3.4.4/libgcc.a \
+ | fgrep '000 T' | awk ' { print $NF }'` (and using the same command with the
+ gccdist.a from the 4.5.2 GCC.
+ I then gave the outputs from both of those to diff and edited out by hand the
+ functions that just moved.
+__powisf2
+__powidf2
+__mulsc3
+__muldc3
+__divsc3
+__divdc3
+__bswapsi2
+__bswapdi2
+__floatundisf
+__floatundidf
+__eprintf
+
+eprintf looks like it's not needed.
+Compiler-RT thinks that bswapsi2 and bswapdi2 are only needed on arm, so it
+ only has arm assembly for them.
diff --git a/aos/build/libgcc-additions/_bswapdi2.o b/aos/build/libgcc-additions/_bswapdi2.o
new file mode 100644
index 0000000..8bc6f56
--- /dev/null
+++ b/aos/build/libgcc-additions/_bswapdi2.o
Binary files differ
diff --git a/aos/build/libgcc-additions/_bswapsi2.o b/aos/build/libgcc-additions/_bswapsi2.o
new file mode 100644
index 0000000..4700ad8
--- /dev/null
+++ b/aos/build/libgcc-additions/_bswapsi2.o
Binary files differ
diff --git a/aos/build/libgcc-additions/libgcc-additions.gypi b/aos/build/libgcc-additions/libgcc-additions.gypi
new file mode 100644
index 0000000..8090f7c
--- /dev/null
+++ b/aos/build/libgcc-additions/libgcc-additions.gypi
@@ -0,0 +1,33 @@
+{
+ 'targets': [
+ {
+ 'target_name': 'libgcc-4.5.2',
+ 'type': 'static_library',
+ 'variables': {
+ 'compiler-rt': '<(externals)/compiler-rt-<(compiler_rt_version)',
+ },
+ 'include_dirs': [
+ '<(compiler-rt)/lib',
+ ],
+ 'defines': [
+ '_YUGA_BIG_ENDIAN=1',
+ '_YUGA_LITTLE_ENDIAN=0',
+ 'UINT64_C(c)=c##ULL',
+ ],
+ 'sources': [
+ '<(compiler-rt)/lib/powisf2.c',
+ '<(compiler-rt)/lib/powidf2.c',
+ '<(compiler-rt)/lib/mulsc3.c',
+ '<(compiler-rt)/lib/muldc3.c',
+ '<(compiler-rt)/lib/divsc3.c',
+ '<(compiler-rt)/lib/divdc3.c',
+ #'<(compiler-rt)/lib/bswapsi2.c',
+ '_bswapsi2.o',
+ #'<(compiler-rt)/lib/bswapdi2.c',
+ '_bswapdi2.o',
+ '<(compiler-rt)/lib/floatundisf.c',
+ '<(compiler-rt)/lib/floatundidf.c',
+ ],
+ },
+ ],
+}
diff --git a/aos/crio/floatundidf.c b/aos/crio/floatundidf.c
deleted file mode 100644
index 356dd78..0000000
--- a/aos/crio/floatundidf.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdint.h>
-
-// stolen from
-// http://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/floatundidf.c@179666
-//
-// Lame hack to provide a libgcc function that the version on the crio doesn't
-// have.
-// TODO(brians): make this nicer and figure out which other ones we need
-
-double __floatundidf(unsigned long long a)
-{
- static const double twop52 = 0x1.0p52;
- static const double twop84 = 0x1.0p84;
- static const double twop84_plus_twop52 = 0x1.00000001p84;
-
- union { uint64_t x; double d; } high = { .d = twop84 };
- union { uint64_t x; double d; } low = { .d = twop52 };
-
- high.x |= a >> 32;
- low.x |= a & 0x00000000ffffffffULL;
-
- const double result = (high.d - twop84_plus_twop52) + low.d;
- return result;
-}
diff --git a/aos/externals/.gitignore b/aos/externals/.gitignore
index 7f6c98d..64c3acf 100644
--- a/aos/externals/.gitignore
+++ b/aos/externals/.gitignore
@@ -21,3 +21,4 @@
/libusb-1.0.9-prefix/
/libusb-1.0.9.tar.bz2
/libusb-1.0.9/
+/compiler-rt-RELEASE_32_final/