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

Mike Edenfield kutulu
Tue Dec 7 17:51:29 CET 2010

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:

In function '___arch__swab32':
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.

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

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.

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.

More information about the ffmpeg-devel mailing list