diff options
author | Johann <johannkoenig@google.com> | 2020-04-02 10:41:24 +0900 |
---|---|---|
committer | Johann <johannkoenig@google.com> | 2020-04-02 11:01:52 +0900 |
commit | cbd820dcebebfd7d5834afbffc18848c0ad9f4e0 (patch) | |
tree | ad4081a99f179a725f90d3faa094c8849bb3f1dd /third_party | |
parent | 66095ce5951cc382e064dc724f9019c0220e652f (diff) | |
download | libvpx-cbd820dcebebfd7d5834afbffc18848c0ad9f4e0.tar libvpx-cbd820dcebebfd7d5834afbffc18848c0ad9f4e0.tar.gz libvpx-cbd820dcebebfd7d5834afbffc18848c0ad9f4e0.tar.bz2 libvpx-cbd820dcebebfd7d5834afbffc18848c0ad9f4e0.zip |
x86inc.asm: copy PIC macros from x86_abi_support.asm
Reapply 7e065cd57. x86inc.asm always defines PIC for x86_64. We undefine
it for x32.
Incorporate e56f96394 as well to ensure GET_GOT_DEFINED is defined.
BUG=webm:1679
Change-Id: I1535d57bcb4223327ca63b4fd11bffcda1009332
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/x86inc/README.libvpx_new | 1 | ||||
-rw-r--r-- | third_party/x86inc/x86inc.asm_new | 94 |
2 files changed, 89 insertions, 6 deletions
diff --git a/third_party/x86inc/README.libvpx_new b/third_party/x86inc/README.libvpx_new index f0738ad88..af37bb876 100644 --- a/third_party/x86inc/README.libvpx_new +++ b/third_party/x86inc/README.libvpx_new @@ -12,3 +12,4 @@ Get configuration from vpx_config.asm. Prefix functions with vpx by default. Manage name mangling (prefixing with '_') manually because 'PREFIX' does not exist in libvpx. +Copy PIC 'GLOBAL' macros from x86_abi_support.asm diff --git a/third_party/x86inc/x86inc.asm_new b/third_party/x86inc/x86inc.asm_new index 8a3845c90..72092d3ba 100644 --- a/third_party/x86inc/x86inc.asm_new +++ b/third_party/x86inc/x86inc.asm_new @@ -107,14 +107,96 @@ %endif %endmacro -%if ARCH_X86_64 - %define PIC 1 ; always use PIC on x86-64 - default rel +; PIC macros from vpx_ports/x86_abi_support.asm. +%ifidn __OUTPUT_FORMAT__,elf32 +%define ABI_IS_32BIT 1 +%elifidn __OUTPUT_FORMAT__,macho32 +%define ABI_IS_32BIT 1 %elifidn __OUTPUT_FORMAT__,win32 - %define PIC 0 ; PIC isn't used on 32-bit Windows -%elifndef PIC - %define PIC 0 +%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 + +%ifndef GET_GOT_DEFINED + %define GET_GOT_DEFINED 0 %endif +; End PIC macros from vpx_ports/x86_abi_support.asm. %define HAVE_PRIVATE_EXTERN 1 %ifdef __NASM_VER__ |