Discussion:
[x264-devel] x86inc: Support creating global symbols from local labels
Henrik Gramner
2017-12-25 19:39:35 UTC
Permalink
x264 | branch: master | Henrik Gramner <***@gramner.com> | Wed Aug 16 15:59:16 2017 +0200| [d463a92e3b6f8ec04d54cc6c437892f9ffa98e29] | committer: Anton Mitrofanov

x86inc: Support creating global symbols from local labels

On ELF platforms such symbols needs to be flagged as functions with the
correct visibility to please certain linkers in some scenarios.
http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d463a92e3b6f8ec04d54cc6c437892f9ffa98e29
---

common/x86/dct-32.asm | 18 ++++++------------
common/x86/dct-64.asm | 18 ++++++------------
common/x86/dct-a.asm | 3 +--
common/x86/x86inc.asm | 12 +++++++++++-
4 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/common/x86/dct-32.asm b/common/x86/dct-32.asm
index 0594b8bd..ec8c4961 100644
--- a/common/x86/dct-32.asm
+++ b/common/x86/dct-32.asm
@@ -161,8 +161,7 @@ cextern hsub_mul

%macro SUB8x8_DCT8 0
cglobal sub8x8_dct8, 3,3,8
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
LOAD_DIFF8x4 0,1,2,3, none,none, r1, r2
LOAD_DIFF8x4 4,5,6,7, none,none, r1, r2

@@ -211,8 +210,7 @@ SUB8x8_DCT8
%macro ADD8x8_IDCT8 0
cglobal add8x8_idct8, 2,2
add r1, 128
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
UNSPILL_SHUFFLE r1, 1,2,3,5,6,7, -6,-4,-2,2,4,6
IDCT8_1D d,0,1,2,3,4,5,6,7,[r1-128],[r1+0]
mova [r1+0], m4
@@ -443,8 +441,7 @@ global add8x8_idct8_mmx.skip_prologue
%macro DCT_SUB8 0
cglobal sub8x8_dct, 3,3
add r2, 4*FDEC_STRIDE
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
%if cpuflag(ssse3)
mova m7, [hsub_mul]
%endif
@@ -476,8 +473,7 @@ global current_function %+ .skip_prologue
;-----------------------------------------------------------------------------
cglobal sub8x8_dct8, 3,3
add r2, 4*FDEC_STRIDE
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
%if cpuflag(ssse3)
mova m7, [hsub_mul]
LOAD_DIFF8x4 0, 1, 2, 3, 4, 7, r1, r2-4*FDEC_STRIDE
@@ -525,8 +521,7 @@ DCT_SUB8
%macro ADD8x8 0
cglobal add8x8_idct, 2,2
add r0, 4*FDEC_STRIDE
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
UNSPILL_SHUFFLE r1, 0,2,1,3, 0,1,2,3
SBUTTERFLY qdq, 0, 1, 4
SBUTTERFLY qdq, 2, 3, 4
@@ -569,8 +564,7 @@ ADD8x8
%macro ADD8x8_IDCT8 0
cglobal add8x8_idct8, 2,2
add r0, 4*FDEC_STRIDE
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
UNSPILL r1, 1,2,3,5,6,7
IDCT8_1D w,0,1,2,3,4,5,6,7,[r1+0],[r1+64]
SPILL r1, 6
diff --git a/common/x86/dct-64.asm b/common/x86/dct-64.asm
index a01357b1..b34cd10d 100644
--- a/common/x86/dct-64.asm
+++ b/common/x86/dct-64.asm
@@ -142,8 +142,7 @@ cextern hsub_mul
%macro SUB8x8_DCT8 0
cglobal sub8x8_dct8, 3,3,14
TAIL_CALL .skip_prologue, 0
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
LOAD_DIFF8x4 0,1,2,3, none,none, r1, r2
LOAD_DIFF8x4 4,5,6,7, none,none, r1, r2

@@ -192,8 +191,7 @@ SUB8x8_DCT8
cglobal add8x8_idct8, 2,2,16
add r1, 128
TAIL_CALL .skip_prologue, 0
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
mova m0, [r1-128]
mova m1, [r1-96]
mova m2, [r1-64]
@@ -255,8 +253,7 @@ cglobal sub8x8_dct, 3,3,10
mova m7, [hsub_mul]
%endif
TAIL_CALL .skip_prologue, 0
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
SWAP 7, 9
LOAD_DIFF8x4 0, 1, 2, 3, 8, 9, r1, r2-4*FDEC_STRIDE
LOAD_DIFF8x4 4, 5, 6, 7, 8, 9, r1, r2-4*FDEC_STRIDE
@@ -279,8 +276,7 @@ cglobal sub8x8_dct8, 3,3,11
mova m7, [hsub_mul]
%endif
TAIL_CALL .skip_prologue, 0
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
SWAP 7, 10
LOAD_DIFF8x4 0, 1, 2, 3, 4, 10, r1, r2-4*FDEC_STRIDE
LOAD_DIFF8x4 4, 5, 6, 7, 8, 10, r1, r2-4*FDEC_STRIDE
@@ -355,8 +351,7 @@ cglobal add8x8_idct8, 2,2,11
add r0, 4*FDEC_STRIDE
pxor m7, m7
TAIL_CALL .skip_prologue, 0
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
SWAP 7, 9
movdqa m0, [r1+0x00]
movdqa m1, [r1+0x10]
@@ -391,8 +386,7 @@ cglobal add8x8_idct, 2,2,11
add r0, 4*FDEC_STRIDE
pxor m7, m7
TAIL_CALL .skip_prologue, 0
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
SWAP 7, 9
mova m0, [r1+ 0]
mova m2, [r1+16]
diff --git a/common/x86/dct-a.asm b/common/x86/dct-a.asm
index 33ed0618..15a0e69b 100644
--- a/common/x86/dct-a.asm
+++ b/common/x86/dct-a.asm
@@ -510,8 +510,7 @@ cglobal add8x8_idct, 2,3,8
add r0, 4*FDEC_STRIDE
pxor m7, m7
TAIL_CALL .skip_prologue, 0
-global current_function %+ .skip_prologue
-.skip_prologue:
+cglobal_label .skip_prologue
; TRANSPOSE4x4Q
mova xm0, [r1+ 0]
mova xm1, [r1+32]
diff --git a/common/x86/x86inc.asm b/common/x86/x86inc.asm
index 3ee32f73..b950f8ea 100644
--- a/common/x86/x86inc.asm
+++ b/common/x86/x86inc.asm
@@ -4,9 +4,9 @@
;* Copyright (C) 2005-2017 x264 project
;*
;* Authors: Loren Merritt <***@u.washington.edu>
+;* Henrik Gramner <***@gramner.com>
;* Anton Mitrofanov <***@narod.ru>
;* Fiona Glaser <***@x264.com>
-;* Henrik Gramner <***@gramner.com>
;*
;* Permission to use, copy, modify, and/or distribute this software for any
;* purpose with or without fee is hereby granted, provided that the above
@@ -731,6 +731,16 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae,
%endif
%endmacro

+; Create a global symbol from a local label with the correct name mangling and type
+%macro cglobal_label 1
+ %if FORMAT_ELF
+ global current_function %+ %1:function hidden
+ %else
+ global current_function %+ %1
+ %endif
+ %1:
+%endmacro
+
%macro cextern 1
%xdefine %1 mangle(private_prefix %+ _ %+ %1)
CAT_XDEFINE cglobaled_, %1, 1

Loading...