[FFmpeg-devel] [patch] Option to specify Thumb instructions when building for arm.

Luca Barbato lu_zero
Tue Dec 7 20:36:52 CET 2010


On 12/7/10 5:51 PM, Mike Edenfield wrote:
> On 12/7/2010 7:08 AM, Luca Barbato wrote:
>> On 12/07/2010 12:33 AM, Mike Edenfield wrote:
>>> This patch allows the user to use -mthumb to build Thumb 16-bit
>>> instructions instead of -arm, which builds ARM 32-bit instructions.
>>> Using -mthumb instead of -marm also defines __thumb__, which is needed
>>> e.g. when building using the Android native toolchain.
>>>
>>> (This patch eliminates the need to supply --extra-cflags to do a thumb
>>> build.)
>>
>> doesn't that break the arm asm completely?
>
> It builds and run fine here, but I'll be the first to admit I'm in a
> tiny bit over my head.  I'm mostly trying to simplify the configure
> process for ffmpeg by eliminating as many custom CFLAGS options as I
> can.  Its entirely possible that I'm making this way to hard, in which
> case I'd be grateful for someone to clarify for me :)
>
> The motivation behind the patch is trying to use the Android native
> tools as a cross-compiler.  Trying to build just using the --enable-arm
> support gave me a few problems:
>
> 1. The system headers supplied by the NDK don't compile:
>
> /opt/android-ndk-r5/platforms/android-5/arch-arm/usr/include/asm/byteorder.h:
> In function '___arch__swab32':
> /opt/android-ndk-r5/platforms/android-5/arch-arm/usr/include/asm/byteorder.h:25:
> error: expected ')' before ':' token
>
> I only investigated this problem far enough to figure out that the
> offending asm() statement is behind an #ifndef __thumb__ block.

rename asm to __asm__ and you'll be fine =)

> 2. I get linker warnings about mismatched implementations of
> short-enums.  I guess the default implementation for -marm and -mthumb
> are different.

nope it's an explicit flag you should add.

> 3. By default the NDK builds are -mthumb builds; this means I have to
> specify -mthumb-interwork on my ffmpeg build and/or force my NDK builds
> to be ARM.  I'm not sure what the implications are for either option,
> but I've been assuming that the NDK defaults to Thumb for a reason and
> sticking to that.

thumb make code smaller, that's all more or less.

> Of course, there are easy workarounds here, such as
> --extra-cflags="-D__thumb__ -mabi=aapcs-linux", but it seems like I'm
> just recreating -mthumb without actually specifying it.

I'm pretty sure -mthumb breaks the arm asm and that the android 
toolchain miscompiles it nonetheless.


lu



More information about the ffmpeg-devel mailing list