]> git.videolan.org Git - x264.git/commitdiff
* common/i386/i386inc.asm: support for ELF, a.out and Mach-O objects.
authorSam Hocevar <sam@videolan.org>
Wed, 8 Feb 2006 11:07:06 +0000 (11:07 +0000)
committerSam Hocevar <sam@videolan.org>
Wed, 8 Feb 2006 11:07:06 +0000 (11:07 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@424 df754926-b1dd-0310-bc7b-ec298dee348c

common/i386/i386inc.asm

index cf9e845c32bc26620bbd1d006a85e39923e04712..4e37a25ae9ead9b4dd7cb617e6489361768bc715 100644 (file)
@@ -66,15 +66,32 @@ BITS 32
 ;     mov eax, [esp + 12]
 ;
 %ifdef __PIC__
-    extern _GLOBAL_OFFSET_TABLE_
-    ; FIXME: find an elegant way to use registers other than ebx
-    %define GLOBAL + ebx wrt ..gotoff
-    %macro picgetgot 1
-        call %%getgot 
-      %%getgot: 
-        pop %1 
-        add %1, _GLOBAL_OFFSET_TABLE_ + $$ - %%getgot wrt ..gotpc 
-    %endmacro
+    %ifdef FORMAT_MACHO
+        ; There is no real global offset table on OS X, but we still
+        ; need to reference our variables by offset.
+        %define GLOBAL + ebx
+        %macro picgetgot 1
+            call %%getgot 
+          %%getgot: 
+            pop %1 
+            sub %1, %%getgot
+        %endmacro
+    %else
+        %ifdef FORMAT_ELF
+            %define GOT _GLOBAL_OFFSET_TABLE_
+        %else ; for a.out
+            %define GOT __GLOBAL_OFFSET_TABLE_
+        %endif
+        extern GOT
+        ; FIXME: find an elegant way to use registers other than ebx
+        %define GLOBAL + ebx wrt ..gotoff
+        %macro picgetgot 1
+            call %%getgot 
+          %%getgot: 
+            pop %1 
+            add %1, GOT + $$ - %%getgot wrt ..gotpc 
+        %endmacro
+    %endif
     %macro picpush 1
         push %1
     %endmacro