shithub: libvpx

Download patch

ref: 9679be4bc0b0ff64c1dcce776c83a33968253826
parent: 7e065cd57392772b2ec20388f9cacc1c828995e9
author: Johann <[email protected]>
date: Wed Feb 17 13:25:09 EST 2016

Use .text instead of .rodata on macho

The read only sections are getting stripped on some OS X builds. As a
result, random data is used in place of the intended tables.

Change-Id: I4629c90d9e0ae4d4efc193a93be6fb93809ae895

--- a/third_party/x86inc/README.libvpx
+++ b/third_party/x86inc/README.libvpx
@@ -15,3 +15,4 @@
 Expand PIC default to macho64 and respect CONFIG_PIC from libvpx
 Set 'private_extern' visibility for macho targets.
 Copy PIC 'GLOBAL' macros from x86_abi_support.asm
+Use .text instead of .rodata on macho to avoid broken tables in PIC mode.
--- a/third_party/x86inc/x86inc.asm
+++ b/third_party/x86inc/x86inc.asm
@@ -97,8 +97,18 @@
     %define mangle(x) x
 %endif
 
+; In some instances macho32 tables get misaligned when using .rodata.
+; When looking at the disassembly it appears that the offset is either
+; correct or consistently off by 90. Placing them in the .text section
+; works around the issue. It appears to be specific to the way libvpx
+; handles the tables.
 %macro SECTION_RODATA 0-1 16
-    SECTION .rodata align=%1
+    %ifidn __OUTPUT_FORMAT__,macho32
+        SECTION .text align=%1
+        fakegot:
+    %else
+        SECTION .rodata align=%1
+    %endif
 %endmacro
 
 ; PIC macros are copied from vpx_ports/x86_abi_support.asm. The "define PIC"