Bug 639204 - Fix link with xcode 4; r=tterribe
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Mon, 14 Mar 2011 11:50:00 -0400
changeset 64035 7b9f40070259da7a35dc9338c7d5fda196ff4c5c
parent 64034 c9387916c9c28507b9c40aa844ee63d0dc08c6b5
child 64036 eb6edf77b7c8979df539d1bf2caafb4d0d1dcbb3
push idunknown
push userunknown
push dateunknown
reviewerstterribe
bugs639204
milestone2.2a1pre
Bug 639204 - Fix link with xcode 4; r=tterribe
media/libvpx/update.sh
media/libvpx/vpx_ports/x86_abi_support.asm
media/libvpx/xcode4.patch
--- a/media/libvpx/update.sh
+++ b/media/libvpx/update.sh
@@ -312,8 +312,11 @@ cp $1/objdir/generic-gnu/vpx_config.h vp
 for f in ${commonFiles[@]}
 do
   mkdir -p -v `dirname $f`
   cp -v $1/$f $f
 done
 
 # Patch to compile with Sun Studio on Solaris
 patch -p3 < solaris.patch
+
+# Patch to fix link with xcode4
+patch -p1 < xcode4.patch
--- a/media/libvpx/vpx_ports/x86_abi_support.asm
+++ b/media/libvpx/vpx_ports/x86_abi_support.asm
@@ -163,25 +163,20 @@
       %define GLOBAL(x) x + %1 wrt ..gotoff
       %undef RESTORE_GOT
       %define RESTORE_GOT pop %1
     %endmacro
   %elifidn __OUTPUT_FORMAT__,macho32
     %macro GET_GOT 1
       push %1
       call %%get_got
-      %%sub_offset:
-      jmp  %%exitGG
       %%get_got:
-      mov  %1, [esp]
-      add %1, fake_got - %%sub_offset
-      ret
-      %%exitGG:
+      pop  %1
       %undef GLOBAL
-      %define GLOBAL(x) x + %1 - fake_got
+      %define GLOBAL(x) x + %1 - %%get_got
       %undef RESTORE_GOT
       %define RESTORE_GOT pop %1
     %endmacro
   %endif
   %endif
   %define HIDDEN_DATA(x) x
 %else
   %macro GET_GOT 1
@@ -284,17 +279,16 @@
 ;
 ; .rodata seems to be an elf-ism, as it doesn't work on OSX.
 ;
 %ifidn __OUTPUT_FORMAT__,macho64
 %define SECTION_RODATA section .text
 %elifidn __OUTPUT_FORMAT__,macho32
 %macro SECTION_RODATA 0
 section .text
-fake_got:
 %endmacro
 %else
 %define SECTION_RODATA section .rodata
 %endif
 
 
 ; Tell GNU ld that we don't require an executable stack.
 %ifidn __OUTPUT_FORMAT__,elf32
new file mode 100644
--- /dev/null
+++ b/media/libvpx/xcode4.patch
@@ -0,0 +1,42 @@
+commit 52f6e28e9e5e176424c1c65ff13aa57abf9c00e6
+Author: Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
+Date:   Sat Mar 5 15:36:40 2011 -0500
+
+    Fix build with xcode4 and simplify GLOBAL.
+    
+    Without this change I get link errors in firefox's libxul. It looks
+    like the linker expect a particular pattern for getting the GOT. This
+    patch changes webm to use the same pattern used by the compiler.
+    
+    Change-Id: Iea8c2e134ad45c1dc7d221ff885a8429bfa4e057
+
+diff --git a/vpx_ports/x86_abi_support.asm b/vpx_ports/x86_abi_support.asm
+index a872b28..be64cd7 100644
+--- a/vpx_ports/x86_abi_support.asm
++++ b/vpx_ports/x86_abi_support.asm
+@@ -168,15 +168,10 @@
+     %macro GET_GOT 1
+       push %1
+       call %%get_got
+-      %%sub_offset:
+-      jmp  %%exitGG
+       %%get_got:
+-      mov  %1, [esp]
+-      add %1, fake_got - %%sub_offset
+-      ret
+-      %%exitGG:
++      pop  %1
+       %undef GLOBAL
+-      %define GLOBAL(x) x + %1 - fake_got
++      %define GLOBAL(x) x + %1 - %%get_got
+       %undef RESTORE_GOT
+       %define RESTORE_GOT pop %1
+     %endmacro
+@@ -289,7 +284,6 @@
+ %elifidn __OUTPUT_FORMAT__,macho32
+ %macro SECTION_RODATA 0
+ section .text
+-fake_got:
+ %endmacro
+ %else
+ %define SECTION_RODATA section .rodata