1 From: Mike Hommey <mh@glandium.org>
2 Date: Wed, 27 Apr 2011 08:58:01 +0200
3 Subject: Bug 626035 - Modify the way arm compiler flags are set in configure
6 configure.in | 292 ++++++++++++++++++++++++++++++++-------------------
7 js/src/configure.in | 284 ++++++++++++++++++++++++++++++++-----------------
8 2 files changed, 372 insertions(+), 204 deletions(-)
10 Index: mozjs-1.8.5-1.0.0+dfsg/js/src/configure.in
11 ===================================================================
12 --- mozjs-1.8.5-1.0.0+dfsg.orig/js/src/configure.in 2012-01-21 15:57:37.507703219 +0100
13 +++ mozjs-1.8.5-1.0.0+dfsg/js/src/configure.in 2012-01-21 15:58:04.951703302 +0100
14 @@ -3535,34 +3535,6 @@
15 AC_CHECK_LIB(socket, socket)
18 -AC_MSG_CHECKING(for ARM SIMD support in compiler)
20 - [asm("uqadd8 r1, r1, r2");],
21 - result="yes", result="no")
22 -AC_MSG_RESULT("$result")
23 -if test "$result" = "yes"; then
24 - AC_DEFINE(HAVE_ARM_SIMD)
27 -AC_SUBST(HAVE_ARM_SIMD)
29 -AC_MSG_CHECKING(for ARM NEON support in compiler)
30 -_SAVE_CFLAGS="$CFLAGS"
31 -if test "$GNU_CC"; then
32 - # gcc needs -mfpu=neon to recognize NEON instructions
33 - CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
36 - [asm("vadd.i8 d0, d0, d0");],
37 - result="yes", result="no")
38 -AC_MSG_RESULT("$result")
39 -if test "$result" = "yes"; then
40 - AC_DEFINE(HAVE_ARM_NEON)
43 -CFLAGS="$_SAVE_CFLAGS"
44 -AC_SUBST(HAVE_ARM_NEON)
46 dnl ========================================================
48 dnl = Start by checking whether the system support pthreads
49 @@ -4614,13 +4586,11 @@
63 @@ -4666,80 +4636,204 @@
64 dnl ========================================================
65 MOZ_ARG_HEADER(Individual module options)
67 -dnl Setup default CPU arch for arm target
68 -case "$target_cpu" in
73 dnl ========================================================
74 -dnl = Enable building the Thumb2 instruction set
75 +dnl = ARM toolchain tweaks
76 dnl ========================================================
77 -MOZ_ARG_ENABLE_BOOL(thumb2,
78 - [ --enable-thumb2 Enable Thumb2 instruction set (implies ARMv7)],
81 -if test -n "$MOZ_THUMB2"; then
90 + MOZ_FLOAT_ABI=softfp
93 + if test -n "$MOZ_PLATFORM_MAEMO"; then
96 + MOZ_FLOAT_ABI=softfp
98 + if test "$MOZ_PLATFORM_MAEMO" = 6; then
104 +dnl Kept for compatibility with some buildbot mozconfig
105 +MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
107 +MOZ_ARG_WITH_STRING(thumb,
108 +[ --with-thumb[[=yes|no|toolchain]]]
109 +[ Use Thumb instruction set (-mthumb)],
110 + if test -z "$GNU_CC"; then
111 + AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
113 + MOZ_THUMB=$withval)
115 +MOZ_ARG_WITH_STRING(thumb-interwork,
116 +[ --with-thumb-interwork[[=yes|no|toolchain]]
117 + Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
118 + if test -z "$GNU_CC"; then
119 + AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
121 + MOZ_THUMB_INTERWORK=$withval)
123 +MOZ_ARG_WITH_STRING(arch,
124 +[ --with-arch=[[type|toolchain]]
125 + Use specific CPU features (-march=type)],
126 + if test -z "$GNU_CC"; then
127 + AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
131 +MOZ_ARG_WITH_STRING(fpu,
132 +[ --with-fpu=[[type|toolchain]]
133 + Use specific FPU type (-mfpu=type)],
134 + if test -z "$GNU_CC"; then
135 + AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
139 +MOZ_ARG_WITH_STRING(float-abi,
140 +[ --with-float-abi=[[type|toolchain]]
141 + Use specific arm float ABI (-mfloat-abi=type)],
142 + if test -z "$GNU_CC"; then
143 + AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
145 + MOZ_FLOAT_ABI=$withval)
147 +MOZ_ARG_WITH_STRING(soft-float,
148 +[ --with-soft-float[[=yes|no|toolchain]]
149 + Use soft float library (-msoft-float)],
150 + if test -z "$GNU_CC"; then
151 + AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
153 + MOZ_SOFT_FLOAT=$withval)
160 + arch_flag="-march=$MOZ_ARCH"
164 +case "$MOZ_THUMB" in
167 + thumb_flag="-mthumb"
174 + _SAVE_CFLAGS="$CFLAGS"
175 + CFLAGS="$arch_flag"
176 + AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
179 + CFLAGS="$_SAVE_CFLAGS"
184 +if test "$MOZ_THUMB2" = 1; then
185 + AC_DEFINE(MOZ_THUMB2)
188 -dnl ========================================================
189 -dnl = Enable building for ARM specific CPU features
190 -dnl ========================================================
191 -MOZ_ARG_WITH_STRING(cpu-arch,
192 -[ --with-cpu-arch=arch Use specific arm architecture CPU features, default armv7],
193 - MOZ_ARM_ARCH=$withval)
194 +case "$MOZ_THUMB_INTERWORK" in
196 + thumb_interwork_flag="-mthumb-interwork"
199 + thumb_interwork_flag="-mno-thumb-interwork"
202 + thumb_interwork_flag=""
206 -if test -n "$MOZ_THUMB2"; then
207 - case "$target_cpu" in
209 - if test "$MOZ_ARM_ARCH" != "armv7"; then
210 - AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH])
212 - if test "$GNU_CC"; then
213 - AC_DEFINE(MOZ_THUMB2)
214 - AC_DEFINE(MOZ_ARM_ARCH)
215 - CFLAGS="$CFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
216 - CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
217 - ASFLAGS="$ASFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
219 - AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
226 - AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
228 + fpu_flag="-mfpu=$MOZ_FPU"
231 -elif test "$MOZ_ARM_ARCH" = "armv7"; then
232 - case "$target_cpu" in
234 - if test "$GNU_CC"; then
235 - AC_DEFINE(MOZ_ARM_ARCH)
236 - CFLAGS="$CFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
237 - CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
238 - ASFLAGS="$ASFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
240 - AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains])
244 +case "$MOZ_FLOAT_ABI" in
249 - AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures])
251 + float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
255 - case "$target_cpu" in
257 - if test "$GNU_CC"; then
258 - CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float"
259 - CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -msoft-float"
260 - ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork -msoft-float"
266 +case "$MOZ_SOFT_FLOAT" in
268 + soft_float_flag="-msoft-float"
271 + soft_float_flag="-mno-soft-float"
278 +dnl Use echo to avoid accumulating space characters
279 +all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
280 +if test -n "$all_flags"; then
281 + _SAVE_CFLAGS="$CFLAGS"
282 + CFLAGS="$all_flags"
283 + AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
284 + AC_TRY_COMPILE([],[return 0;],
285 + AC_MSG_RESULT([yes]),
286 + AC_MSG_ERROR([no]))
288 + CFLAGS="$_SAVE_CFLAGS $all_flags"
289 + CXXFLAGS="$CXXFLAGS $all_flags"
290 + ASFLAGS="$ASFLAGS $all_flags"
291 + if test -n "$thumb_flag"; then
292 + LDFLAGS="$LDFLAGS $thumb_flag"
297 -AC_SUBST(MOZ_ARM_ARCH)
299 +if test "$CPU_ARCH" = "arm"; then
300 + AC_MSG_CHECKING(for ARM SIMD support in compiler)
301 + # We try to link so that this also fails when
302 + # building with LTO.
304 + [asm("uqadd8 r1, r1, r2");],
305 + result="yes", result="no")
306 + AC_MSG_RESULT("$result")
307 + if test "$result" = "yes"; then
308 + AC_DEFINE(HAVE_ARM_SIMD)
312 + AC_MSG_CHECKING(for ARM NEON support in compiler)
313 + # We try to link so that this also fails when
314 + # building with LTO.
316 + [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
317 + result="yes", result="no")
318 + AC_MSG_RESULT("$result")
319 + if test "$result" = "yes"; then
320 + AC_DEFINE(HAVE_ARM_NEON)
325 +AC_SUBST(HAVE_ARM_SIMD)
326 +AC_SUBST(HAVE_ARM_NEON)
328 dnl ========================================================
330 @@ -6147,12 +6241,6 @@
331 if test "$OS_ARCH" = "OS2"; then
332 ac_configure_args="$ac_configure_args CFLAGS=-Zomf AR=emxomfar"
334 - if test -n "$MOZ_THUMB2"; then
335 - ac_configure_args="$ac_configure_args --enable-thumb2"
337 - if test -n "$MOZ_ARM_ARCH"; then
338 - ac_configure_args="$ac_configure_args --with-cpu-arch=$MOZ_ARM_ARCH"
341 # Use a separate cache file for libffi, since it does things differently
342 # from our configure.