Copy PIC handling code from x86_abi_support
Change-Id: Ia05fe78d2bd29b6aebaf6605719fe8a32528f25c
This commit is contained in:
parent
71ccd103bd
commit
7e065cd573
1
third_party/x86inc/README.libvpx
vendored
1
third_party/x86inc/README.libvpx
vendored
@ -14,3 +14,4 @@ Manage name mangling (prefixing with '_') manually because 'PREFIX' does not
|
||||
exist in libvpx.
|
||||
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
|
||||
|
94
third_party/x86inc/x86inc.asm
vendored
94
third_party/x86inc/x86inc.asm
vendored
@ -101,21 +101,93 @@
|
||||
SECTION .rodata align=%1
|
||||
%endmacro
|
||||
|
||||
%if WIN64
|
||||
%define PIC
|
||||
%elifidn __OUTPUT_FORMAT__,macho64
|
||||
%define PIC
|
||||
%elif ARCH_X86_64 == 0
|
||||
; x86_32 doesn't require PIC.
|
||||
; Some distros prefer shared objects to be PIC, but nothing breaks if
|
||||
; the code contains a few textrels, so we'll skip that complexity.
|
||||
%undef PIC
|
||||
%elif CONFIG_PIC
|
||||
%define PIC
|
||||
; PIC macros are copied from vpx_ports/x86_abi_support.asm. The "define PIC"
|
||||
; from original code is added in for 64bit.
|
||||
%ifidn __OUTPUT_FORMAT__,elf32
|
||||
%define ABI_IS_32BIT 1
|
||||
%elifidn __OUTPUT_FORMAT__,macho32
|
||||
%define ABI_IS_32BIT 1
|
||||
%elifidn __OUTPUT_FORMAT__,win32
|
||||
%define ABI_IS_32BIT 1
|
||||
%elifidn __OUTPUT_FORMAT__,aout
|
||||
%define ABI_IS_32BIT 1
|
||||
%else
|
||||
%define ABI_IS_32BIT 0
|
||||
%endif
|
||||
|
||||
%if ABI_IS_32BIT
|
||||
%if CONFIG_PIC=1
|
||||
%ifidn __OUTPUT_FORMAT__,elf32
|
||||
%define GET_GOT_DEFINED 1
|
||||
%define WRT_PLT wrt ..plt
|
||||
%macro GET_GOT 1
|
||||
extern _GLOBAL_OFFSET_TABLE_
|
||||
push %1
|
||||
call %%get_got
|
||||
%%sub_offset:
|
||||
jmp %%exitGG
|
||||
%%get_got:
|
||||
mov %1, [esp]
|
||||
add %1, _GLOBAL_OFFSET_TABLE_ + $$ - %%sub_offset wrt ..gotpc
|
||||
ret
|
||||
%%exitGG:
|
||||
%undef GLOBAL
|
||||
%define GLOBAL(x) x + %1 wrt ..gotoff
|
||||
%undef RESTORE_GOT
|
||||
%define RESTORE_GOT pop %1
|
||||
%endmacro
|
||||
%elifidn __OUTPUT_FORMAT__,macho32
|
||||
%define GET_GOT_DEFINED 1
|
||||
%macro GET_GOT 1
|
||||
push %1
|
||||
call %%get_got
|
||||
%%get_got:
|
||||
pop %1
|
||||
%undef GLOBAL
|
||||
%define GLOBAL(x) x + %1 - %%get_got
|
||||
%undef RESTORE_GOT
|
||||
%define RESTORE_GOT pop %1
|
||||
%endmacro
|
||||
%else
|
||||
%define GET_GOT_DEFINED 0
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if ARCH_X86_64 == 0
|
||||
%undef PIC
|
||||
%endif
|
||||
|
||||
%else
|
||||
%macro GET_GOT 1
|
||||
%endmacro
|
||||
%define GLOBAL(x) rel x
|
||||
%define WRT_PLT wrt ..plt
|
||||
|
||||
%if WIN64
|
||||
%define PIC
|
||||
%elifidn __OUTPUT_FORMAT__,macho64
|
||||
%define PIC
|
||||
%elif CONFIG_PIC
|
||||
%define PIC
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%ifnmacro GET_GOT
|
||||
%macro GET_GOT 1
|
||||
%endmacro
|
||||
%define GLOBAL(x) x
|
||||
%endif
|
||||
%ifndef RESTORE_GOT
|
||||
%define RESTORE_GOT
|
||||
%endif
|
||||
%ifndef WRT_PLT
|
||||
%define WRT_PLT
|
||||
%endif
|
||||
|
||||
%ifdef PIC
|
||||
default rel
|
||||
%endif
|
||||
; Done with PIC macros
|
||||
|
||||
%ifdef __NASM_VER__
|
||||
%use smartalign
|
||||
|
Loading…
x
Reference in New Issue
Block a user