From 5d5c5cc213fb25a1fd151af80ab0a4fb614dd32c Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 8 Feb 2006 11:07:06 +0000 Subject: [PATCH] * common/i386/i386inc.asm: support for ELF, a.out and Mach-O objects. git-svn-id: svn://svn.videolan.org/x264/trunk@424 df754926-b1dd-0310-bc7b-ec298dee348c --- common/i386/i386inc.asm | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/common/i386/i386inc.asm b/common/i386/i386inc.asm index cf9e845c..4e37a25a 100644 --- a/common/i386/i386inc.asm +++ b/common/i386/i386inc.asm @@ -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 -- 2.50.0