summaryrefslogtreecommitdiffstats
path: root/libass/x86/x86inc.asm
diff options
context:
space:
mode:
authorOneric <oneric@oneric.stub>2024-05-19 17:09:10 +0200
committerOneric <oneric@oneric.stub>2024-05-19 18:51:54 +0200
commit598fae80af47ca1ab1372dbc219159275d73cc2c (patch)
treebe24add83f73d8abfbae974a0095ec55671e4e96 /libass/x86/x86inc.asm
parentf460d224791422b547ed37c146a91fc67fc5b57c (diff)
downloadlibass-598fae80af47ca1ab1372dbc219159275d73cc2c.tar.bz2
libass-598fae80af47ca1ab1372dbc219159275d73cc2c.tar.xz
Update x86inc.asm
Corresponds to upstream https://code.videolan.org/videolan/x86inc.asm/-/commit/b6ba1e3045d758fd6c6e24591dac21a3dc812e1d This obsoletes our custom patch for 64-bit Haiku checkasm
Diffstat (limited to 'libass/x86/x86inc.asm')
-rw-r--r--libass/x86/x86inc.asm25
1 files changed, 20 insertions, 5 deletions
diff --git a/libass/x86/x86inc.asm b/libass/x86/x86inc.asm
index d2bd758..fc490b6 100644
--- a/libass/x86/x86inc.asm
+++ b/libass/x86/x86inc.asm
@@ -232,7 +232,7 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%elif PIC
call $+5 ; special-cased to not affect the RSB on most CPU:s
pop %1
- add %1, (%2)-$+1
+ add %1, -$+1+%2
%else
mov %1, %2
%endif
@@ -864,16 +864,16 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae,
%macro cextern 1
%xdefine %1 mangle(private_prefix %+ _ %+ %1)
- CAT_XDEFINE cglobaled_, %1, 1
+ CAT_XDEFINE cglobaled_, %1, 2
extern %1
%endmacro
-; like cextern, but without the prefix
+; Like cextern, but without the prefix. This should be used for symbols from external libraries.
%macro cextern_naked 1
%ifdef PREFIX
%xdefine %1 mangle(%1)
%endif
- CAT_XDEFINE cglobaled_, %1, 1
+ CAT_XDEFINE cglobaled_, %1, 3
extern %1
%endmacro
@@ -1268,12 +1268,27 @@ INIT_XMM
%endmacro
%macro call_internal 2
%xdefine %%i %2
+ %define %%j %%i
%ifndef cglobaled_%2
%ifdef cglobaled_%1
%xdefine %%i %1
%endif
+ %elif FORMAT_ELF
+ %if ARCH_X86_64
+ %if cglobaled_%2 >= 2
+ ; Always emit PLT relocations when calling external functions,
+ ; the linker will eliminate unnecessary PLT indirections anyway.
+ %define %%j %%i wrt ..plt
+ %endif
+ %elif PIC && cglobaled_%2 == 3
+ ; Go through the GOT for functions declared using cextern_naked with
+ ; PIC, as such functions presumably exists in external libraries.
+ extern _GLOBAL_OFFSET_TABLE_
+ LEA eax, $$+_GLOBAL_OFFSET_TABLE_ wrt ..gotpc
+ %define %%j [eax+%%i wrt ..got]
+ %endif
%endif
- call %%i
+ call %%j
LOAD_MM_PERMUTATION %%i
%endmacro