[FFmpeg-devel] Cross-compiling arm assembler on OSX

Måns Rullgård mans
Fri Jan 30 15:09:18 CET 2009


"Kvikant, Christian \(Scilla\)" <kvide at scilla.tv> writes:

> Earlier Ronald S. Bultje wrote:
>>
>> It'd be nice if there was somehow a way to (cross-)compile the armv4l/ 
>> directory on the Mac in some way, either by updating gas (haven't 
>> tested) or by making the code somewhat more forgiving to early gas 
>> version restrictions / bugs / etc.
>>
>> Ronald
>>
>
> Cross-compiling is certainly possible.
>
> Apple's SDK uses an anno dazumal gas 1.38 with lots of mach-o specific
> customization in binutils while linking is done with ld64. Saurik's approach
> uses more recent cctools with patches for arm and ld_classic as linker.
>
> Both tool chains choke on different stuff in the arm code, but to compile
> ffmpeg with all the goodies enabled the following needs to be done with the
> arm assembly:
>
> 1) Avoid uppercase

Where and why?

> 2) pop/push need to be rewritten in their canonical forms

push/pop *are* the new canonical forms.

> 3) Macro parameters need to be referred to as $0, $1 etc.

That is 1) unreadable and 2) incompatible with GNU as.  Feel free to
maintain patches with these changes, but it well never go into svn.

> 4) Manually define labels and if needed, define them global (or tweak
> endfunc to do nothing)

Manually as opposed to what?

> 5) Some replacements: e.g. use .long for .word

That could be considered for svn.

> 6) Verify stack alignment

Does the Apply runtime make any guarantees?  A few functions need
8-byte alignment, but most don't care.

> Yonas has a patch in progress here: http://code.google.com/p/ffmpeg4iphone/
>
> When using Saurik's assembler the adrl operation that Yonas asked about
> translates into:
>
>     add   ip, pc, 5f
>     add   ip, ip, 0x600 (?)

There is no ADRL in svn head.

> But from a "commercial" point of view the main problem arises when building
> shared libraries. While loading libavcodec.dyld on the iPhone the dyld
> automagic rebasing stuff chokes on addressing. Removing "-read_only_relocs
> suppress" when linking reveals the error:
>
> ld: absolute addressing (perhaps -mdynamic-no-pic) used in _put_pixels16_arm
> from libavcodec/arm/dsputil_arm_s.o not allowed in slidable image. Use
> '-read_only_relocs suppress' to enable text relocs.

Yes, we use that flag for a reason.

I know this will disappoint some people, but the Apple assembler
cannot be supported by FFmpeg.  If you want FFmpeg to build cleanly
for the iphone, go and help the people working on mach-o support for
gnu binutils instead.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list