summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2012-05-08 11:56:49 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2012-05-08 12:00:32 +0800
commit6a5fd5f0c6aa00bfbc4473007a349710e026bb10 (patch)
tree087b2dda86d1475b13126ffa2885f72ef442d26d
parent2c18ea2753707ff9b5e1c6ad18d025ff3cef374c (diff)
downloadgdk-6a5fd5f0c6aa00bfbc4473007a349710e026bb10.tar.gz
Cleanup code
Revmoved lots of trailing spaces, etc. Change-Id: I5adee31b96a8c4b1375d93d386abde8e5f15f184
-rw-r--r--samples/PhotoEditor/jni/Android.mk2
-rw-r--r--samples/PhotoEditor/jni/_jni.cpp8
-rw-r--r--samples/PhotoEditor/src/com/android/photoeditor/PhotoEditor.java4
-rw-r--r--samples/bitmap-plasma-llvm/jni/Application.mk2
-rw-r--r--samples/bitmap-plasma-llvm/jni/plasma.cpp20
-rw-r--r--samples/bitmap-plasma-llvm/src/com/example/plasma/llvm/Plasma.java6
-rw-r--r--samples/quake/jni/Android.mk6
-rw-r--r--samples/quake/jni/Application.mk4
-rw-r--r--samples/quake/jni/masterMain.cpp14
-rw-r--r--samples/quake/jni/net_udp.cpp36
-rw-r--r--samples/quake/jni/sys_android.cpp26
-rw-r--r--samples/quake/src/com/android/quake/llvm/QuakeLib.java6
-rw-r--r--toolchains/llvm/setup-arm.mk39
-rw-r--r--toolchains/llvm/setup-mips.mk39
-rw-r--r--toolchains/llvm/setup-x86.mk39
l---------[-rw-r--r--]toolchains/llvm/setup.mk32
16 files changed, 185 insertions, 98 deletions
diff --git a/samples/PhotoEditor/jni/Android.mk b/samples/PhotoEditor/jni/Android.mk
index 794c7b8..e1db8b8 100644
--- a/samples/PhotoEditor/jni/Android.mk
+++ b/samples/PhotoEditor/jni/Android.mk
@@ -41,7 +41,7 @@ ifeq ($(TARGET_ARCH), arm)
endif
LOCAL_CFLAGS := -Werror \
- -I$(OUT)/../../../../frameworks/compile/libbcc/include
+ -I$(OUT)/../../../../frameworks/compile/libbcc/include
LOCAL_LDFLAGS := -L$(OUT)/system/lib
diff --git a/samples/PhotoEditor/jni/_jni.cpp b/samples/PhotoEditor/jni/_jni.cpp
index 63fd3d6..a5935bb 100644
--- a/samples/PhotoEditor/jni/_jni.cpp
+++ b/samples/PhotoEditor/jni/_jni.cpp
@@ -72,19 +72,19 @@ extern "C" JNIEXPORT jboolean JNICALL Java_com_android_photoeditor_filters_Image
}
#endif
bccRegisterSymbolCallback(script_ref, lookupSymbol, NULL);
-
+
#ifdef OLD_BCC
if (bccPrepareExecutable(script_ref, "/data/data/com.android.photoeditor/photoeditorLLVM.oBCC", 0)) {
LOGE("Error! Cannot bccPrepareExecutable");
return JNI_FALSE;
}
- #else
+ #else
if (bccPrepareExecutable(script_ref, "/data/data/com.android.photoeditor/", "photoeditorLLVM", 0)) {
LOGE("Error! Cannot bccPrepareExecutable");
return JNI_FALSE;
}
#endif // OLD_BCC
-
+
for(i=0; i<JNI_max; i++) {
new_func_ptr[i] = bccGetFuncAddr(script_ref, JNIFunc[i].func_name);
if (new_func_ptr[i] == NULL) {
@@ -106,7 +106,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_com_android_photoeditor_filters_Image
return JNI_TRUE;
#else
-
+
return JNI_FALSE;
#endif // !__GDK__ && !__NOGDK__
diff --git a/samples/PhotoEditor/src/com/android/photoeditor/PhotoEditor.java b/samples/PhotoEditor/src/com/android/photoeditor/PhotoEditor.java
index 074b882..5add524 100644
--- a/samples/PhotoEditor/src/com/android/photoeditor/PhotoEditor.java
+++ b/samples/PhotoEditor/src/com/android/photoeditor/PhotoEditor.java
@@ -41,9 +41,9 @@ public class PhotoEditor extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
-
+
if (ImageUtils.gdk())
- {
+ {
// HACK: create faked view in order to read bitcode in resource
View view = new View(getApplication());
byte[] pgm;
diff --git a/samples/bitmap-plasma-llvm/jni/Application.mk b/samples/bitmap-plasma-llvm/jni/Application.mk
index 5b6cab6..58a5cc4 100644
--- a/samples/bitmap-plasma-llvm/jni/Application.mk
+++ b/samples/bitmap-plasma-llvm/jni/Application.mk
@@ -1,5 +1,5 @@
# The ARMv7 is significanly faster due to the use of the hardware FPU
-APP_ABI := armeabi armeabi-v7a
+APP_ABI := armeabi armeabi-v7a
#APP_ABI := mips mips-r2
#APP_ABI := x86
APP_PLATFORM := android-8
diff --git a/samples/bitmap-plasma-llvm/jni/plasma.cpp b/samples/bitmap-plasma-llvm/jni/plasma.cpp
index d05990f..e487c7f 100644
--- a/samples/bitmap-plasma-llvm/jni/plasma.cpp
+++ b/samples/bitmap-plasma-llvm/jni/plasma.cpp
@@ -419,7 +419,7 @@ extern "C" JNIEXPORT jint JNICALL Java_com_example_plasma_llvm_PlasmaView_native
count = 0, time_sum = 0;
last_mode = use_llvm;
#endif // !__NOGDK__
-
+
if (!init) {
init_tables();
stats_init(&stats);
@@ -439,7 +439,7 @@ extern "C" JNIEXPORT jint JNICALL Java_com_example_plasma_llvm_PlasmaView_native
if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
}
-
+
#if !defined(__NOGDK__)
if (use_llvm) {
double start_jit = now_ms();
@@ -463,22 +463,22 @@ extern "C" JNIEXPORT jint JNICALL Java_com_example_plasma_llvm_PlasmaView_native
LOGE("Error! Cannot bccLinkBC");
return -1;
}
- #endif
-
- bccRegisterSymbolCallback(script_ref, lookupSymbol, NULL);
-
- #ifdef OLD_BCC
+ #endif
+
+ bccRegisterSymbolCallback(script_ref, lookupSymbol, NULL);
+
+ #ifdef OLD_BCC
if (bccPrepareExecutable(script_ref, "/data/data/com.example.plasma.llvm/plasmaLLVM.oBCC", 0)) {
LOGE("Error! Cannot bccPrepareExecutable");
return -1;
}
- #else
+ #else
if (bccPrepareExecutable(script_ref, "/data/data/com.example.plasma.llvm/", "plasmaLLVM", 0)) {
LOGE("Error! Cannot bccPrepareExecutable");
return -1;
}
#endif // OLD_BCC
-
+
native_function = (pPlasmaType)bccGetFuncAddr(script_ref, "fill_plasma");
if (native_function == NULL) {
LOGE("Error! Cannot find fill_plasma()");
@@ -493,7 +493,7 @@ extern "C" JNIEXPORT jint JNICALL Java_com_example_plasma_llvm_PlasmaView_native
LOGI("LLVM Time JIT: %.2lf , Run: %.2lf, Avg: %.2lf, count=%d", start_run-start_jit, diff, time_sum / count, count+1);
time_sum += diff + start_run - start_jit;
}
- else
+ else
#endif // !__NOGDK__
{
diff --git a/samples/bitmap-plasma-llvm/src/com/example/plasma/llvm/Plasma.java b/samples/bitmap-plasma-llvm/src/com/example/plasma/llvm/Plasma.java
index a627a1c..1614482 100644
--- a/samples/bitmap-plasma-llvm/src/com/example/plasma/llvm/Plasma.java
+++ b/samples/bitmap-plasma-llvm/src/com/example/plasma/llvm/Plasma.java
@@ -93,7 +93,7 @@ class PlasmaView extends View {
public PlasmaView(Context context) {
super(context);
-
+
llvm_mode = gdk();
mStartTime = System.currentTimeMillis();
@@ -125,8 +125,8 @@ class PlasmaView extends View {
} catch(IOException e) {
throw new Resources.NotFoundException();
}
- }
-
+ }
+
paint = new Paint();
paint.setTextSize(40);
}
diff --git a/samples/quake/jni/Android.mk b/samples/quake/jni/Android.mk
index 27dd381..893c96d 100644
--- a/samples/quake/jni/Android.mk
+++ b/samples/quake/jni/Android.mk
@@ -33,9 +33,9 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS := -Werror \
- -I$(OUT)/../../../../frameworks/compile/libbcc/include \
- -I$(OUT)/../../../../frameworks/native/include \
- -I$(OUT)/../../../../system/core/include
+ -I$(OUT)/../../../../frameworks/compile/libbcc/include \
+ -I$(OUT)/../../../../frameworks/native/include \
+ -I$(OUT)/../../../../system/core/include
LOCAL_C_INCLUDES := $(call include-path-for, wilhelm)
diff --git a/samples/quake/jni/Application.mk b/samples/quake/jni/Application.mk
index a64dbba..bb9ec4d 100644
--- a/samples/quake/jni/Application.mk
+++ b/samples/quake/jni/Application.mk
@@ -1,5 +1,5 @@
-APP_ABI := armeabi armeabi-v7a
-#APP_ABI := mips mips-r2
+APP_ABI := armeabi armeabi-v7a
+#APP_ABI := mips mips-r2
#APP_ABI := x86
APP_PLATFORM := android-9
diff --git a/samples/quake/jni/masterMain.cpp b/samples/quake/jni/masterMain.cpp
index 67e9697..8bd08ce 100644
--- a/samples/quake/jni/masterMain.cpp
+++ b/samples/quake/jni/masterMain.cpp
@@ -92,7 +92,7 @@ qquit(JNIEnv *env, jobject thiz) {
return pAndroidQuit();
}
-jboolean
+jboolean
gdk(JNIEnv *env, jobject obj)
{
#if !defined(__NOGDK__)
@@ -148,13 +148,13 @@ qcompile_bc(JNIEnv *env, jobject thiz, jbyteArray scriptRef, jint length)
time = newtime;
bccRegisterSymbolCallback(script_ref, lookupSymbol, NULL);
-
+
#ifdef OLD_BCC
if (bccPrepareExecutable(script_ref, "/data/data/com.android.quake.llvm/quakeLLVM.oBCC", 0)) {
LOGE("Error! Cannot bccPrepareExecutable");
return JNI_FALSE;
}
- #else
+ #else
if (bccPrepareExecutable(script_ref, "/data/data/com.android.quake.llvm/", "quakeLLVM", 0)) {
LOGE("Error! Cannot bccPrepareExecutable");
return JNI_FALSE;
@@ -227,15 +227,15 @@ qcompile_bc(JNIEnv *env, jobject thiz, jbyteArray scriptRef, jint length)
}
newtime = Sys_FloatTime ();
double findptrtime = newtime - time;
-
+
LOGI("LLVM JIT time = %lf (%lf + %lf + %lf)\n", readtime+compiletime+findptrtime,
- readtime, compiletime, findptrtime);
+ readtime, compiletime, findptrtime);
return JNI_TRUE;
#else
-
+
return JNI_FALSE;
-
+
#endif // !__GDK__ && !__NOGDK__
}
diff --git a/samples/quake/jni/net_udp.cpp b/samples/quake/jni/net_udp.cpp
index aaf470f..f0a6c0e 100644
--- a/samples/quake/jni/net_udp.cpp
+++ b/samples/quake/jni/net_udp.cpp
@@ -63,7 +63,7 @@ static unsigned long myAddr;
#include <net/if.h>
//
-// system dependent
+// system dependent
//
#define SOCK_DGRAM_PORTABLE 2
@@ -71,15 +71,15 @@ static unsigned long myAddr;
#define FIONBIO_PORTABLE 0x5421
#define FIONREAD_PORTABLE 0x541B
#define ECONNREFUSED_PORTABLE 111
-#define SOL_SOCKET_PORTABLE 1
-#define SO_BROADCAST_PORTABLE 6
+#define SOL_SOCKET_PORTABLE 1
+#define SO_BROADCAST_PORTABLE 6
#define SOCK_DGRAM_MIPS 1
#define SOCK_STREAM_MIPS 2
#define FIONBIO_MIPS 0x667e
#define FIONREAD_MIPS 0x467f
#define ECONNREFUSED_MIPS 146
-#define SOL_SOCKET_MIPS 0xffff
+#define SOL_SOCKET_MIPS 0xffff
#define SO_BROADCAST_MIPS 0x0020
@@ -92,13 +92,13 @@ int errno_portable();
#if !defined(__GDK__)
int socket_portable(int domain, int type, int protocol)
{
-#if defined(__mips__)
+#if defined(__mips__)
switch(type) {
- case SOCK_DGRAM_PORTABLE:
- type = SOCK_DGRAM_MIPS;
+ case SOCK_DGRAM_PORTABLE:
+ type = SOCK_DGRAM_MIPS;
break;
case SOCK_STREAM_PORTABLE:
- type = SOCK_STREAM_MIPS;
+ type = SOCK_STREAM_MIPS;
break;
}
#endif // __mips__
@@ -110,47 +110,47 @@ int ioctl_portable(int fd, int cmd, void *arg)
#if defined(__mips__)
switch(cmd) {
case FIONBIO_PORTABLE:
- cmd = FIONBIO_MIPS;
+ cmd = FIONBIO_MIPS;
break;
case FIONREAD_PORTABLE:
cmd = FIONREAD_MIPS;
- //ToDo: there are a lot more diff!
+ //ToDo: there are a lot more diff!
}
#endif // __mips__
return ioctl(fd, cmd, arg);
}
-
+
int errno_portable()
{
int ret = errno;
#if defined(__mips__)
switch(ret) {
- case ECONNREFUSED_PORTABLE:
+ case ECONNREFUSED_PORTABLE:
ret = ECONNREFUSED_MIPS;
break;
//ToDo: there are a lot more diff!
}
-#endif // __mips__
+#endif // __mips__
return ret;
}
-
+
int setsockopt_portable(int s, int level, int optname, const void *optval, socklen_t optlen)
{
#if defined(__mips__)
switch(level) {
- case SOL_SOCKET_PORTABLE:
+ case SOL_SOCKET_PORTABLE:
level = SOL_SOCKET_MIPS;
break;
//ToDo: there are a lot more diff!
}
-
+
switch(optname) {
- case SO_BROADCAST_PORTABLE:
+ case SO_BROADCAST_PORTABLE:
optname = SO_BROADCAST_MIPS;
break;
//ToDo: there are a lot more diff!
}
-#endif
+#endif
return setsockopt(s, level, optname, optval, optlen);
}
diff --git a/samples/quake/jni/sys_android.cpp b/samples/quake/jni/sys_android.cpp
index 5d418ea..7afb55c 100644
--- a/samples/quake/jni/sys_android.cpp
+++ b/samples/quake/jni/sys_android.cpp
@@ -67,14 +67,14 @@ cvar_t sys_linerefresh = CVAR2("sys_linerefresh","0");// set for entity display
//
-// system dependent
-//
+// system dependent
+//
struct stat_portable {
unsigned long long st_dev;
unsigned char __pad0[4];
- unsigned long __st_ino;
+ unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
@@ -159,26 +159,26 @@ static void __copy_mips_stat_to_portable(struct stat_portable *pst_portable, str
pst_portable->st_mtime_nsec = pst_mips->st_mtime_nsec;
pst_portable->st_ctime = pst_mips->st_ctime;
pst_portable->st_ctime_nsec = pst_mips->st_ctime_nsec;
- pst_portable->st_ino = pst_mips->st_ino;
+ pst_portable->st_ino = pst_mips->st_ino;
}
#endif // __mips__
-
+
int stat_portable(const char *path, struct stat_portable *st)
{
#if !defined(__mips__)
struct stat st_orig;
//assert(sizeof(st_orig) == sizeof(*st)); //ToDo: and offset of each field !
-
+
return stat(path, (struct stat*)st);
#else
struct stat/*_mips*/ st_mips;
//assert(sizeof(st_mips) == sizeof(*st)); //ToDo: and offset of each field !
-
+
int ret = stat(path, &st_mips);
__copy_mips_stat_to_portable((struct stat_portable *)st, &st_mips);
-
+
return ret;
-#endif
+#endif
}
int fstat_portable(int fd, struct stat_portable *st)
@@ -186,17 +186,17 @@ int fstat_portable(int fd, struct stat_portable *st)
#if !defined(__mips__)
struct stat st_orig;
//assert(sizeof(st_orig) == sizeof(*st)); //ToDo: and offset of each field !
-
+
return fstat(fd, (struct stat*)st);
#else
struct stat/*_mips*/ st_mips;
//assert(sizeof(st_mips) == sizeof(*st)); //ToDo: and offset of each field !
-
+
int ret = fstat(fd, &st_mips);
__copy_mips_stat_to_portable((struct stat_portable *)st, &st_mips);
-
+
return ret;
-#endif
+#endif
}
#endif // !__GDK__
diff --git a/samples/quake/src/com/android/quake/llvm/QuakeLib.java b/samples/quake/src/com/android/quake/llvm/QuakeLib.java
index 664acf6..5bdcfc7 100644
--- a/samples/quake/src/com/android/quake/llvm/QuakeLib.java
+++ b/samples/quake/src/com/android/quake/llvm/QuakeLib.java
@@ -136,10 +136,10 @@ public class QuakeLib {
static {
System.loadLibrary("quake");
}
-
+
public QuakeLib(byte[] pgm, int pgmLength) {
- if (gdk())
- compile_bc(pgm, pgmLength);
+ if (gdk())
+ compile_bc(pgm, pgmLength);
}
public static native boolean gdk();
diff --git a/toolchains/llvm/setup-arm.mk b/toolchains/llvm/setup-arm.mk
new file mode 100644
index 0000000..14a27b0
--- /dev/null
+++ b/toolchains/llvm/setup-arm.mk
@@ -0,0 +1,39 @@
+# FIXME(Nowar): Use llvm-ndk-cc instead of clang.
+#TARGET_CC := $(TOOLCHAIN_PREBUILT_ROOT)/llvm-ndk-cc
+#TARGET_CFLAGS :=
+#
+#TARGET_CXX := $(TARGET_CC)
+#TARGET_CXXFLAGS := $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus
+#
+#TARGET_LD := $(TOOLCHAIN_PREBUILT_ROOT)/llvm-ndk-link
+#TARGET_LDFLAGS :=
+
+TARGET_C_INCLUDES := $(GDK_PLATFORMS_ROOT)/android-portable/arch-llvm/usr/include
+
+# Workaround before the required headers are in the above dir.
+##TARGET_C_INCLUDES += $(NDK_ROOT)/platforms/android-9/arch-arm/usr/include
+TARGET_C_INCLUDES += $(NDK_ROOT)/sources/cxx-stl/system/include
+TARGET_C_INCLUDES += $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/include
+#TARGET_C_INCLUDES += $(NDK_ROOT)/toolchains/mips-linux-android-4.4.3/prebuilt/linux-x86/lib/gcc/mips-linux-android/4.4.3/include
+#TARGET_C_INCLUDES += $(NDK_ROOT)/toolchains/x86-4.4.3/prebuilt/linux-x86/lib/gcc/i686-android-linux/4.4.3/include
+
+TARGET_CC := $(OUT)/../../../host/linux-x86/bin/clang
+TARGET_CFLAGS := -ccc-host-triple armv7-none-linux-gnueabi
+#TARGET_CFLAGS := -ccc-host-triple mipsel-none-linux-gnueabi
+#TARGET_CFLAGS := -ccc-host-triple i686-unknown-linux
+TARGET_CFLAGS += -emit-llvm
+TARGET_CFLAGS += -D_MIPS_SZLONG=32 ## Workaround for arch-mips
+
+TARGET_CXX := $(OUT)/../../../host/linux-x86/bin/clang++
+TARGET_CXXFLAGS := $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus -ffunction-sections -fdata-sections
+
+TARGET_LD := $(OUT)/../../../host/linux-x86/bin/llvm-link
+TARGET_LDFLAGS :=
+
+TARGET_STRIP := $(OUT)/../../../host/linux-x86/bin/opt
+
+define cmd-link-bitcodes
+$(TARGET_LD) \
+ $(call host-path, $(PRIVATE_OBJECTS)) | \
+ $(TARGET_STRIP) -strip -o $(call host-path,$@)
+endef
diff --git a/toolchains/llvm/setup-mips.mk b/toolchains/llvm/setup-mips.mk
new file mode 100644
index 0000000..dfdcf04
--- /dev/null
+++ b/toolchains/llvm/setup-mips.mk
@@ -0,0 +1,39 @@
+# FIXME(Nowar): Use llvm-ndk-cc instead of clang.
+#TARGET_CC := $(TOOLCHAIN_PREBUILT_ROOT)/llvm-ndk-cc
+#TARGET_CFLAGS :=
+#
+#TARGET_CXX := $(TARGET_CC)
+#TARGET_CXXFLAGS := $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus
+#
+#TARGET_LD := $(TOOLCHAIN_PREBUILT_ROOT)/llvm-ndk-link
+#TARGET_LDFLAGS :=
+
+TARGET_C_INCLUDES := $(GDK_PLATFORMS_ROOT)/android-portable/arch-llvm/usr/include
+
+# Workaround before the required headers are in the above dir.
+##TARGET_C_INCLUDES += $(NDK_ROOT)/platforms/android-9/arch-arm/usr/include
+TARGET_C_INCLUDES += $(NDK_ROOT)/sources/cxx-stl/system/include
+#TARGET_C_INCLUDES += $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/include
+TARGET_C_INCLUDES += $(NDK_ROOT)/toolchains/mips-linux-android-4.4.3/prebuilt/linux-x86/lib/gcc/mips-linux-android/4.4.3/include
+#TARGET_C_INCLUDES += $(NDK_ROOT)/toolchains/x86-4.4.3/prebuilt/linux-x86/lib/gcc/i686-android-linux/4.4.3/include
+
+TARGET_CC := $(OUT)/../../../host/linux-x86/bin/clang
+#TARGET_CFLAGS := -ccc-host-triple armv7-none-linux-gnueabi
+TARGET_CFLAGS := -ccc-host-triple mipsel-none-linux-gnueabi
+#TARGET_CFLAGS := -ccc-host-triple i686-unknown-linux
+TARGET_CFLAGS += -emit-llvm
+TARGET_CFLAGS += -D_MIPS_SZLONG=32 ## Workaround for arch-mips
+
+TARGET_CXX := $(OUT)/../../../host/linux-x86/bin/clang++
+TARGET_CXXFLAGS := $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus -ffunction-sections -fdata-sections
+
+TARGET_LD := $(OUT)/../../../host/linux-x86/bin/llvm-link
+TARGET_LDFLAGS :=
+
+TARGET_STRIP := $(OUT)/../../../host/linux-x86/bin/opt
+
+define cmd-link-bitcodes
+$(TARGET_LD) \
+ $(call host-path, $(PRIVATE_OBJECTS)) | \
+ $(TARGET_STRIP) -strip -o $(call host-path,$@)
+endef
diff --git a/toolchains/llvm/setup-x86.mk b/toolchains/llvm/setup-x86.mk
new file mode 100644
index 0000000..033588c
--- /dev/null
+++ b/toolchains/llvm/setup-x86.mk
@@ -0,0 +1,39 @@
+# FIXME(Nowar): Use llvm-ndk-cc instead of clang.
+#TARGET_CC := $(TOOLCHAIN_PREBUILT_ROOT)/llvm-ndk-cc
+#TARGET_CFLAGS :=
+#
+#TARGET_CXX := $(TARGET_CC)
+#TARGET_CXXFLAGS := $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus
+#
+#TARGET_LD := $(TOOLCHAIN_PREBUILT_ROOT)/llvm-ndk-link
+#TARGET_LDFLAGS :=
+
+TARGET_C_INCLUDES := $(GDK_PLATFORMS_ROOT)/android-portable/arch-llvm/usr/include
+
+# Workaround before the required headers are in the above dir.
+##TARGET_C_INCLUDES += $(NDK_ROOT)/platforms/android-9/arch-arm/usr/include
+TARGET_C_INCLUDES += $(NDK_ROOT)/sources/cxx-stl/system/include
+#TARGET_C_INCLUDES += $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/include
+#TARGET_C_INCLUDES += $(NDK_ROOT)/toolchains/mips-linux-android-4.4.3/prebuilt/linux-x86/lib/gcc/mips-linux-android/4.4.3/include
+TARGET_C_INCLUDES += $(NDK_ROOT)/toolchains/x86-4.4.3/prebuilt/linux-x86/lib/gcc/i686-android-linux/4.4.3/include
+
+TARGET_CC := $(OUT)/../../../host/linux-x86/bin/clang
+#TARGET_CFLAGS := -ccc-host-triple armv7-none-linux-gnueabi
+#TARGET_CFLAGS := -ccc-host-triple mipsel-none-linux-gnueabi
+TARGET_CFLAGS := -ccc-host-triple i686-unknown-linux
+TARGET_CFLAGS += -emit-llvm
+TARGET_CFLAGS += -D_MIPS_SZLONG=32 ## Workaround for arch-mips
+
+TARGET_CXX := $(OUT)/../../../host/linux-x86/bin/clang++
+TARGET_CXXFLAGS := $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus -ffunction-sections -fdata-sections
+
+TARGET_LD := $(OUT)/../../../host/linux-x86/bin/llvm-link
+TARGET_LDFLAGS :=
+
+TARGET_STRIP := $(OUT)/../../../host/linux-x86/bin/opt
+
+define cmd-link-bitcodes
+$(TARGET_LD) \
+ $(call host-path, $(PRIVATE_OBJECTS)) | \
+ $(TARGET_STRIP) -strip -o $(call host-path,$@)
+endef
diff --git a/toolchains/llvm/setup.mk b/toolchains/llvm/setup.mk
index 5a3fbc5..f8f72e9 100644..120000
--- a/toolchains/llvm/setup.mk
+++ b/toolchains/llvm/setup.mk
@@ -1,31 +1 @@
-# FIXME(Nowar): Use llvm-ndk-cc instead of clang.
-#TARGET_CC := $(TOOLCHAIN_PREBUILT_ROOT)/llvm-ndk-cc
-#TARGET_CFLAGS :=
-#
-#TARGET_CXX := $(TARGET_CC)
-#TARGET_CXXFLAGS := $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus
-#
-#TARGET_LD := $(TOOLCHAIN_PREBUILT_ROOT)/llvm-ndk-link
-#TARGET_LDFLAGS :=
-
-TARGET_C_INCLUDES := $(GDK_PLATFORMS_ROOT)/android-portable/arch-llvm/usr/include
-
-# Workaround before the required headers are in the above dir.
-TARGET_C_INCLUDES += $(NDK_ROOT)/platforms/android-9/arch-arm/usr/include \
- $(NDK_ROOT)/sources/cxx-stl/system/include \
- $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/include
-
-TARGET_CC := $(OUT)/../../../host/linux-x86/bin/clang
-TARGET_CFLAGS := -ccc-host-triple armv7-none-linux-gnueabi -emit-llvm
-
-TARGET_CXX := $(OUT)/../../../host/linux-x86/bin/clang++
-TARGET_CXXFLAGS := $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus
-
-TARGET_LD := $(OUT)/../../../host/linux-x86/bin/llvm-link
-TARGET_LDFLAGS :=
-
-define cmd-link-bitcodes
-$(TARGET_LD) \
- $(call host-path, $(PRIVATE_OBJECTS)) \
- -o $(call host-path,$@)
-endef
+setup-arm.mk \ No newline at end of file