[x264-devel] macho64 or macho format: Use .const for read only data instead of .text?

Dimitry Andric dimitry at andric.com
Thu May 16 13:22:56 CEST 2013


On 2013-05-06 12:28:28 -0700, Paul Sterne wrote:
> May I suggest that the .const section be used for read-only data instead of
> the .text section?
> Apple's convention is that the .text section contains pure instructions.

Actually, it seems that Apple has different places for read-only data,
depending on whether it is relocatable or not:

<https://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html#//apple_ref/doc/uid/TP40000895-CH248-CJBIIIJH>

E.g. non-relocatable const data goes into "__TEXT,__const", while
relocatable const data goes into "__DATA,__const".  For yasm, the former
is called ".const", the latter ".const_data".

The problem I encountered linking on OS X x86_64 ("illegal
text-relocation to _x264_coeff_last16_sse2") is solved by setting the
section for those apparently relocatable symbols to .const_data.

-Dimitry


More information about the x264-devel mailing list