Author: reimar Date: Sun Sep 25 15:28:25 2011 New Revision: 34132 Log: Set up HAVE_VFP_ARGS and CONFIG_THUMB correctly to fix compilation for ARM. Modified: trunk/configure Modified: trunk/configure ============================================================================== --- trunk/configure Sun Sep 25 11:58:58 2011 (r34131) +++ trunk/configure Sun Sep 25 15:28:25 2011 (r34132) @@ -89,6 +89,15 @@ cxx_check() { compile_check $TMPCPP $@ -lstdc++ } +cpp_condition_check() { + cat > $TMPC << EOF +#if !($1) +#error condition not true: $1 +#endif +EOF + compile_check $TMPC $@ +} + cflag_check() { cat > $TMPC << EOF int main(void) { return 0; } @@ -560,6 +569,7 @@ Advanced options: --enable-armvfp enable ARM VFP (ARM) [autodetect] --enable-vfpv3 enable ARM VFPV3 (ARM) [autodetect] --enable-neon enable NEON (ARM) [autodetect] + --enable-thumb enable THUMB (ARM) [autodetect] --enable-iwmmxt enable iWMMXt (ARM) [autodetect] --disable-fastmemcpy disable 3DNow!/SSE/MMX optimized memcpy [enable] --enable-hardcoded-tables put tables in binary instead of calculating them at startup [disable] @@ -612,6 +622,7 @@ _armv6t2=auto _armvfp=auto vfpv3=auto neon=auto +armthumb=auto _iwmmxt=auto _mtrr=auto _altivec=auto @@ -1409,6 +1420,8 @@ for ac_option do --disable-vfpv3) vfpv3=no ;; --enable-neon) neon=yes ;; --disable-neon) neon=no ;; + --enable-thumb) armthumb=yes ;; + --disable-thumb) armthumb=no ;; --enable-iwmmxt) _iwmmxt=yes ;; --disable-iwmmxt) _iwmmxt=no ;; --enable-mmx) _mmx=yes ;; @@ -2865,6 +2878,16 @@ if arm ; then fi echores "$vfpv3" + echocheck "softfloat ABI" + softfloat=yes + cpp_condition_check 'defined(__ARM_PCS_VFP) || (!defined(__ARM_PCS) && !defined(__SOFTFP__))' && softfloat=no + if test $softfloat = "yes" ; then + def_vfp_args='#define HAVE_VFP_ARGS 0' + else + def_vfp_args='#define HAVE_VFP_ARGS 1' + fi + echores "$softfloat" + echocheck "ARM NEON" if test $neon = "auto" ; then neon=no @@ -2872,6 +2895,19 @@ if arm ; then fi echores "$neon" + echocheck "ARM THUMB" + if test $armthumb = "auto" ; then + armthumb=no + fi + if test $armthumb = "yes" ; then + extra_cflags="$extra_cflags -mthumb" + def_armthumb='#define CONFIG_THUMB 1' + else + extra_cflags="$extra_cflags -marm" + def_armthumb='#define CONFIG_THUMB 0' + fi + echores "$armthumb" + echocheck "iWMMXt (Intel XScale SIMD instructions)" if test $_iwmmxt = "auto" ; then _iwmmxt=no @@ -8280,6 +8316,8 @@ $def_bigendian $(ff_config_enable "$arch_all" "$arch" "#" "ARCH") $(ff_config_enable "$subarch_all" "$subarch" "#" "ARCH") $(ff_config_enable "$cpuexts_all" "$cpuexts" "#" "HAVE") +$def_armthumb +$def_vfp_args /* Blu-ray/DVD/VCD/CD */ @@ -8579,7 +8617,6 @@ $def_yasm #define HAVE_SYMVER_ASM_LABEL 0 #define HAVE_SYMVER_GNU_ASM 0 #define HAVE_SYS_SELECT_H 0 -#define HAVE_VFP_ARGS 1 #define HAVE_VIRTUALALLOC 0 /* Some FFmpeg codecs depend on these. Enable them unconditionally for now. */
On Sun, Sep 25, 2011 at 03:28:25PM +0200, reimar wrote:
--- trunk/configure Sun Sep 25 11:58:58 2011 (r34131) +++ trunk/configure Sun Sep 25 15:28:25 2011 (r34132) @@ -89,6 +89,15 @@ cxx_check() {
+cpp_condition_check() { + cat > $TMPC << EOF +#if !($1) +#error condition not true: $1 +#endif +EOF + compile_check $TMPC $@ +}
Nice one, I meant to implement this for some time, you beat me to it. Diego
On So, Sep 25, 2011 at 15:28:25 (CEST), reimar wrote:
Author: reimar Date: Sun Sep 25 15:28:25 2011 New Revision: 34132
Log: Set up HAVE_VFP_ARGS and CONFIG_THUMB correctly to fix compilation for ARM.
Modified: trunk/configure
Modified: trunk/configure ==============================================================================
[...]
@@ -2872,6 +2895,19 @@ if arm ; then fi echores "$neon"
+ echocheck "ARM THUMB" + if test $armthumb = "auto" ; then + armthumb=no + fi + if test $armthumb = "yes" ; then + extra_cflags="$extra_cflags -mthumb" + def_armthumb='#define CONFIG_THUMB 1' + else + extra_cflags="$extra_cflags -marm" + def_armthumb='#define CONFIG_THUMB 0' + fi
I think -marm is wrong: https://buildd.debian.org/status/fetch.php?pkg=mplayer&arch=armel&ver=2%3A1.0~rc4.dfsg1%2Bsvn34492-1&stamp=1325969800 The build fails because the libmpeg2 uses armv5 speicific instruction. I'm thinking about changing the extra_cflags to read like this: extra_cflags="$extra_cflags -marmv5" Reimar, how do you think about this?
+ echores "$armthumb" + echocheck "iWMMXt (Intel XScale SIMD instructions)" if test $_iwmmxt = "auto" ; then _iwmmxt=no
-- Gruesse/greetings, Reinhard Tartler, KeyID 945348A4
On Sun, Jan 08, 2012 at 01:56:50PM +0100, Reinhard Tartler wrote:
On So, Sep 25, 2011 at 15:28:25 (CEST), reimar wrote:
Author: reimar Date: Sun Sep 25 15:28:25 2011 New Revision: 34132
Log: Set up HAVE_VFP_ARGS and CONFIG_THUMB correctly to fix compilation for ARM.
Modified: trunk/configure
Modified: trunk/configure ==============================================================================
[...]
@@ -2872,6 +2895,19 @@ if arm ; then fi echores "$neon"
+ echocheck "ARM THUMB" + if test $armthumb = "auto" ; then + armthumb=no + fi + if test $armthumb = "yes" ; then + extra_cflags="$extra_cflags -mthumb" + def_armthumb='#define CONFIG_THUMB 1' + else + extra_cflags="$extra_cflags -marm" + def_armthumb='#define CONFIG_THUMB 0' + fi
I think -marm is wrong:
The build fails because the libmpeg2 uses armv5 speicific instruction. I'm thinking about changing the extra_cflags to read like this:
extra_cflags="$extra_cflags -marmv5"
Reimar, how do you think about this?
-marm is the opposite of -mthumb, it has nothing at all to do with which version as far as I can tell.
On Sun, Jan 08, 2012 at 02:28:24PM +0100, Reimar Döffinger wrote:
On Sun, Jan 08, 2012 at 01:56:50PM +0100, Reinhard Tartler wrote:
On So, Sep 25, 2011 at 15:28:25 (CEST), reimar wrote:
Author: reimar Date: Sun Sep 25 15:28:25 2011 New Revision: 34132
Log: Set up HAVE_VFP_ARGS and CONFIG_THUMB correctly to fix compilation for ARM.
Modified: trunk/configure
Modified: trunk/configure ==============================================================================
[...]
@@ -2872,6 +2895,19 @@ if arm ; then fi echores "$neon"
+ echocheck "ARM THUMB" + if test $armthumb = "auto" ; then + armthumb=no + fi + if test $armthumb = "yes" ; then + extra_cflags="$extra_cflags -mthumb" + def_armthumb='#define CONFIG_THUMB 1' + else + extra_cflags="$extra_cflags -marm" + def_armthumb='#define CONFIG_THUMB 0' + fi
I think -marm is wrong:
The build fails because the libmpeg2 uses armv5 speicific instruction. I'm thinking about changing the extra_cflags to read like this:
extra_cflags="$extra_cflags -marmv5"
Reimar, how do you think about this?
-marm is the opposite of -mthumb, it has nothing at all to do with which version as far as I can tell.
Just to make it clear: Since autodetection is basically not workable on arm, you have to explicitly specify which CPU to build for. -marmv5 is a deprecated way to do it which you should never use as far as I can tell. -march=... would be the replacement, though I though -march shouldn't really be used for ARM either, but you should set -mcpu= accordingly. I can't help you with what Debian targets though...
Le nonidi 19 nivôse, an CCXX, Reimar Döffinger a écrit :
Just to make it clear: Since autodetection is basically not workable on arm, you have to explicitly specify which CPU to build for. -marmv5 is a deprecated way to do it which you should never use as far as I can tell. -march=... would be the replacement, though I though -march shouldn't really be used for ARM either, but you should set -mcpu= accordingly.
Do you by any chance have a pointer to a doc helping to figure out the correct value for -mcpu et -mtune depending on the version of the compiler and the contents of /proc/cpuinfo? Regards, -- Nicolas George
On Sun, Jan 08, 2012 at 02:43:14PM +0100, Nicolas George wrote:
Le nonidi 19 nivôse, an CCXX, Reimar Döffinger a écrit :
Just to make it clear: Since autodetection is basically not workable on arm, you have to explicitly specify which CPU to build for. -marmv5 is a deprecated way to do it which you should never use as far as I can tell. -march=... would be the replacement, though I though -march shouldn't really be used for ARM either, but you should set -mcpu= accordingly.
Do you by any chance have a pointer to a doc helping to figure out the correct value for -mcpu et -mtune depending on the version of the compiler and the contents of /proc/cpuinfo?
No. I usually experiment wildly until I happen to get something where configure enables NEON and it does not crash. Since I consider a video player without NEON support mildly pointless. I don't know why you ask, but I strongly think that such functionality belongs in gcc and should be triggered by -mcpu=native.
Le nonidi 19 nivôse, an CCXX, Reimar Döffinger a écrit :
I don't know why you ask, but I strongly think that such functionality belongs in gcc and should be triggered by -mcpu=native.
It does belong there indeed, but compiling for ARM is often done by crosscompiling, and AFAIK native does not work in that case. Regards, -- Nicolas George
On Sun, Jan 08, 2012 at 06:45:18PM +0100, Nicolas George wrote:
Le nonidi 19 nivôse, an CCXX, Reimar Döffinger a écrit :
I don't know why you ask, but I strongly think that such functionality belongs in gcc and should be triggered by -mcpu=native.
It does belong there indeed, but compiling for ARM is often done by crosscompiling, and AFAIK native does not work in that case.
Yes, but that's the same for looking at cpuinfo... Also note that when using -march=native gcc will print which march setting it translates that to (when using -v or such option in addition).
On So, Jan 08, 2012 at 18:56:42 (CET), Reimar Döffinger wrote:
On Sun, Jan 08, 2012 at 06:45:18PM +0100, Nicolas George wrote:
Le nonidi 19 nivôse, an CCXX, Reimar Döffinger a écrit :
I don't know why you ask, but I strongly think that such functionality belongs in gcc and should be triggered by -mcpu=native.
It does belong there indeed, but compiling for ARM is often done by crosscompiling, and AFAIK native does not work in that case.
Yes, but that's the same for looking at cpuinfo... Also note that when using -march=native gcc will print which march setting it translates that to (when using -v or such option in addition).
-march=native will give you binaries that will use all instructions available the build host. Obviously, this cannot work in a cross-compilation setting. Moreover, in a distribution setting this is undesired and pretty harmful as the resulting binary packages will be different, depending on the buildd. The correct fix is to specify the lowest required cpu instruction set to gcc to maximize the number of machines on which the binary will run. If the user wants a higher instruction set, then he should specify that in extra-cflags, for example with -mcpu=native. -- Gruesse/greetings, Reinhard Tartler, KeyID 945348A4
On So, Jan 08, 2012 at 14:28:24 (CET), Reimar Döffinger wrote:
On Sun, Jan 08, 2012 at 01:56:50PM +0100, Reinhard Tartler wrote:
On So, Sep 25, 2011 at 15:28:25 (CEST), reimar wrote:
Author: reimar Date: Sun Sep 25 15:28:25 2011 New Revision: 34132
Log: Set up HAVE_VFP_ARGS and CONFIG_THUMB correctly to fix compilation for ARM.
Modified: trunk/configure
Modified: trunk/configure ==============================================================================
[...]
@@ -2872,6 +2895,19 @@ if arm ; then fi echores "$neon"
+ echocheck "ARM THUMB" + if test $armthumb = "auto" ; then + armthumb=no + fi + if test $armthumb = "yes" ; then + extra_cflags="$extra_cflags -mthumb" + def_armthumb='#define CONFIG_THUMB 1' + else + extra_cflags="$extra_cflags -marm" + def_armthumb='#define CONFIG_THUMB 0' + fi
I think -marm is wrong:
The build fails because the libmpeg2 uses armv5 speicific instruction. I'm thinking about changing the extra_cflags to read like this:
extra_cflags="$extra_cflags -marmv5"
Reimar, how do you think about this?
-marm is the opposite of -mthumb, it has nothing at all to do with which version as far as I can tell.
Right. This doesn't help completely either, I've tested yesterday. What helped was compiling with "-marm -mcpu=armv5te". I'll test that on the next upload, but I'm confident that this is the right solution. -- Gruesse/greetings, Reinhard Tartler, KeyID 945348A4
On Sun, Jan 08, 2012 at 01:56:50PM +0100, Reinhard Tartler wrote:
On So, Sep 25, 2011 at 15:28:25 (CEST), reimar wrote:
Log: Set up HAVE_VFP_ARGS and CONFIG_THUMB correctly to fix compilation for ARM.
Modified: trunk/configure
Modified: trunk/configure ==============================================================================
[...]
@@ -2872,6 +2895,19 @@ if arm ; then
+ echocheck "ARM THUMB" + if test $armthumb = "auto" ; then + armthumb=no + fi + if test $armthumb = "yes" ; then + extra_cflags="$extra_cflags -mthumb" + def_armthumb='#define CONFIG_THUMB 1' + else + extra_cflags="$extra_cflags -marm" + def_armthumb='#define CONFIG_THUMB 0' + fi
I think -marm is wrong:
The build fails because the libmpeg2 uses armv5 speicific instruction.
I think we should finally throw out the forked copy of libmpeg2. Diego
participants (5)
-
Diego Biurrun -
Nicolas George -
reimar -
Reimar Döffinger -
Reinhard Tartler