Ticket #2049: git-arm-compile-v1.diff

File git-arm-compile-v1.diff, 5.1 KB (added by Josh, 11 years ago)

Should fix all the issues.

Line 
1diff --git a/binaries/data/config/default.cfg b/binaries/data/config/default.cfg
2index f02f2ed..486080f 100644
3--- a/binaries/data/config/default.cfg
4diff --git a/build/premake/premake4.lua b/build/premake/premake4.lua
5index 72422e8..a38a5c2 100644
6--- a/build/premake/premake4.lua
7+++ b/build/premake/premake4.lua
8@@ -26,7 +26,7 @@ rootdir = "../.."
9
10 dofile("extern_libs4.lua")
11
12--- detect CPU architecture (simplistic, currently only supports x86 and amd64)
13+-- detect CPU architecture (simplistic, currently only supports x86, amd64 and ARM)
14 arch = "x86"
15 if _OPTIONS["android"] then
16 arch = "arm"
17@@ -47,6 +47,8 @@ else
18 arch = "amd64"
19 elseif string.find(machine, "i.86") == 1 then
20 arch = "x86"
21+ elseif string.find(machine, "arm") == 1 then
22+ arch = "arm"
23 else
24 print("WARNING: Cannot determine architecture from GCC, assuming x86")
25 end
26@@ -263,8 +265,8 @@ function project_set_build_flags()
27 -- disable warnings about va_list ABI change
28 buildoptions { "-Wno-psabi" }
29
30- -- target Cortex-A9 CPUs with NEON
31- buildoptions { "-mthumb -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp" }
32+ -- target Cortex-A15 CPUs with NEON
33+ buildoptions { "-mtune=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard -Ofast" }
34 end
35
36 if _OPTIONS["coverage"] then
37diff --git a/libraries/source/fcollada/src/FCollada/FUtils/FUAssert.cpp b/libraries/source/fcollada/src/FCollada/FUtils/FUAssert.cpp
38index 9e7651e..12770a9 100644
39--- a/libraries/source/fcollada/src/FCollada/FUtils/FUAssert.cpp
40+++ b/libraries/source/fcollada/src/FCollada/FUtils/FUAssert.cpp
41@@ -44,6 +44,8 @@ bool FUAssertion::OnAssertionFailed(const char* file, uint32 line)
42 #elif defined (__APPLE__)
43 Debugger();
44 //SysBreak();
45+#elif defined (__arm__)
46+ __asm__("bkpt 0");
47 #else
48 // AFAIK This is available on all X86 platforms
49 __asm__("int $0x03");
50diff --git a/libraries/source/fcollada/src/Makefile b/libraries/source/fcollada/src/Makefile
51index 90d6d1b..341cb11 100644
52--- a/libraries/source/fcollada/src/Makefile
53+++ b/libraries/source/fcollada/src/Makefile
54@@ -1,4 +1,5 @@
55 OS_ARCH := $(shell uname -s)
56+OS_CPU := $(shell uname -p)
57
58 ifeq ($(OS_ARCH),Darwin)
59 PIC_FLAGS ?= -fPIC
60@@ -9,10 +10,17 @@ endif
61
62 CXX ?= g++
63 CXXFLAGS += -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function $(OS_DEFINE) $(PIC_FLAGS) $(CPPFLAGS)
64-CXXFLAGS_DEBUG := -O0 -g -D_DEBUG -DRETAIL
65+# If we're compiling on ARM, target Cortex-A15 CPUs with NEON on GCC >4.3 ***KEEP THESE OPTIONS IN SYNC WITH PREMAKE***
66+ifeq (&(OS_CPU),armv7l)
67+CXXFLAGS_RELEASE := -Ofast -DNDEBUG -DRETAIL -mtune=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard
68+CXXFLAGS_DEBUG := -O0 -g -D_DEBUG -DRETAIL -mtune=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard
69+CXXFLAGS_TEST := -O0 -g -D_DEBUG -mtune=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard
70+else
71 CXXFLAGS_RELEASE := -O1 -DNDEBUG -DRETAIL
72-# (-O2 with gcc 4.3 causes linker errors when using this library, for unknown reasons, so stick with -O1)
73+CXXFLAGS_DEBUG := -O0 -g -D_DEBUG -DRETAIL
74 CXXFLAGS_TEST := -O0 -g -D_DEBUG
75+# (-O2 with gcc 4.3 causes linker errors when using this library, for unknown reasons, so stick with -O1)
76+endif
77 LIBS += `pkg-config libxml-2.0 --libs`
78 INCLUDES += -IFCollada `pkg-config libxml-2.0 --cflags`
79 INCLUDES_TEST := -IFCollada/FColladaTest $(INCLUDES)
80diff --git a/libraries/source/nvtt/src/src/nvcore/nvcore.h b/libraries/source/nvtt/src/src/nvcore/nvcore.h
81index 5de942d..21bf202 100644
82--- a/libraries/source/nvtt/src/src/nvcore/nvcore.h
83+++ b/libraries/source/nvtt/src/src/nvcore/nvcore.h
84@@ -67,6 +67,7 @@
85 // NV_CPU_X86
86 // NV_CPU_X86_64
87 // NV_CPU_PPC
88+// NV_CPU_ARM
89
90 #define NV_CPU_STRING POSH_CPU_STRING
91
92@@ -76,6 +77,8 @@
93 # define NV_CPU_X86 1
94 #elif defined POSH_CPU_PPC
95 # define NV_CPU_PPC 1
96+#elif defined POSH_CPU_STRONGARM
97+# define NV_CPU_ARM 1
98 #else
99 # error "Unsupported CPU"
100 #endif
101diff --git a/source/lib/sysdep/arch/arm/arm.cpp b/source/lib/sysdep/arch/arm/arm.cpp
102index 867e80c..b9b85d5 100644
103--- a/source/lib/sysdep/arch/arm/arm.cpp
104+++ b/source/lib/sysdep/arch/arm/arm.cpp
105@@ -28,7 +28,6 @@
106
107 #include "lib/sysdep/cpu.h"
108
109-#include <android/log.h>
110 intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)
111 {
112 return __sync_fetch_and_add(location, increment);
113@@ -41,21 +40,7 @@ bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue)
114
115 bool cpu_CAS64(volatile i64* location, i64 expected, i64 newValue)
116 {
117- // Current versions of GCC don't implement this on ARM:
118- // return __sync_bool_compare_and_swap(location, expected, newValue);
119-
120- // http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=40fb79c8a88625504857d44de1bc89dc0341e618
121- // adds support for
122- // return __kernel_cmpxchg64(&expected, &newValue, (long long*)location) == 0;
123- // but only for Linux kernel 3.1
124-
125- // Maybe we can do it with user-space assembly assuming a modern-enough CPU?
126- // That sounds non-trivial so let's just cheat
127-#warning TODO: atomic cpu_CAS64 on ARM
128- if (*location != expected)
129- return false;
130- *location = newValue;
131- return true;
132+ return __sync_bool_compare_and_swap(location, expected, newValue);
133 }
134
135 const char* cpu_IdentifierString()