[x264-devel] x86_64 on Darwin9.0 (Mac OS X 10.5)

Guillaume Poirier gpoirier at mplayerhq.hu
Tue Nov 20 10:11:12 CET 2007


Hello,

Antoine Gerschenfeld wrote:
> Hi,
> 
> Here is a patch that makes it possible to compile x264 in x86_64 on
> the latest Mac OS X, Leopard (it may work on Tiger, but some libraries
> may be missing). The 64-bit option can be enabled by running
> 
> ./configure --host=x86_64-darwin
> 
> and requires yasm >= 0.6 (which supports 64-bit mach-O). Because of
> restrictions inherent in Mach-O 64, PIC has to be enabled (this is
> taken care of) and, as in i386, read-only data has to go in the TEXT
> section (hence the return of the SECTION_RODATA macro).
> 
> As on Linux, the speed gain from moving to x86_64 is between 10-20% on
> my machine...
> 
> Best regards,
> 
> AG
> 
> 
> ------------------------------------------------------------------------
> Index: common/amd64/amd64inc.asm
> ===================================================================
> --- common/amd64/amd64inc.asm	(revision 685)
> +++ common/amd64/amd64inc.asm	(working copy)
> @@ -41,6 +41,18 @@
>      %1:
>  %endmacro
>  
> +; Name of the .rodata section. On OS X we cannot use .rodata because NASM
> +; is unable to compute address offsets outside of .text so we use the .text
> +; section instead until NASM is fixed.
> +%macro SECTION_RODATA 0
> +    %ifidn __OUTPUT_FORMAT__,macho
> +        SECTION .text align=16
> +        fakegot:
> +    %else
> +        SECTION_RODATA
> +    %endif
> +%endmacro
> +
>  %macro pad 1
>      %undef %1
>      %ifdef PREFIX

This looks odd.

On i386, the macro looks as follows:

-------------%<----------------------------------------
; Name of the .rodata section. On OS X we cannot use .rodata because NASM
; is unable to compute address offsets outside of .text so we use the
.text
; section instead until NASM is fixed.
%macro SECTION_RODATA 0
    %ifidn __OUTPUT_FORMAT__,macho
        SECTION .text align=16
        fakegot:
    %else
        SECTION .rodata align=16
    %endif
%endmacro
------------->%----------------------------------------
(note the difference in "%else SECTION .rodata align=16"

So I suspect that in your patch, "%else SECTION_RODATA" is wrong and
should be replaced by "%else SECTION .rodata align=16".

Guillaume



More information about the x264-devel mailing list