Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/neutrinolabs/librfxcodec.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormirabilos <thorsten.glaser@teckids.org>2017-03-25 23:19:06 +0300
committermirabilos <thorsten.glaser@teckids.org>2017-03-25 23:19:06 +0300
commit7b6e65ab7a8ec9ec708eccf29998b2bc45276410 (patch)
tree3e80edec70b3499b1979552268cba1292d944e50
parent0b4f260e94aa7b6cbf5d744c6f9db2d0a6b14b89 (diff)
move i386 ELF PIC stuff to common.asm
-rw-r--r--src/common.asm44
-rw-r--r--src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm26
-rw-r--r--src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm26
3 files changed, 44 insertions, 52 deletions
diff --git a/src/common.asm b/src/common.asm
index 8770777..62c6f5c 100644
--- a/src/common.asm
+++ b/src/common.asm
@@ -51,4 +51,48 @@ section .note.GNU-stack noalloc noexec nowrite progbits
%endif
%endmacro
+; Macros for relative access to local data
+%undef use_elf_pic
+%ifdef ASM_ARCH_I386
+%ifdef is_elf
+%ifdef PIC
+; i386 ELF PIC
+%define use_elf_pic 1
+%macro get_GOT 0
+ call ..@get_GOT
+%%getgot:
+ add ebx, _GLOBAL_OFFSET_TABLE_ + $$ - %%getgot wrt ..gotpc
+%endmacro
+%define lsym(name) ebx + name wrt ..gotoff
+%else
+; i386 ELF, not PIC
+%macro get_GOT 0
+%endmacro
+%define lsym(name) name
+%endif
+%else
+; i386 not ELF
+%ifdef PIC
+%error "Position-Independent Code is currently only supported for ELF"
+%endif
+; i386 not ELF, not PIC
+%macro get_GOT 0
+%endmacro
+%define lsym(name) name
+%endif
+%else
+; not i386
+%macro get_GOT 0
+%endmacro
+%define lsym(name) name
+%endif
+
section .text
+
+; Prerequisite code for relative access to local data
+%ifdef use_elf_pic
+extern _GLOBAL_OFFSET_TABLE_
+..@get_GOT:
+ mov ebx, [esp]
+ ret
+%endif
diff --git a/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm b/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
index 48a47d3..7ace68e 100644
--- a/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
+++ b/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
@@ -22,32 +22,6 @@
%include "common.asm"
-%ifidn __OUTPUT_FORMAT__,elf
-%ifdef PIC
-section .text
-extern _GLOBAL_OFFSET_TABLE_
-..@get_GOT:
- mov ebx, [esp]
- ret
-%define lsym(name) ebx + name wrt ..gotoff
-%macro get_GOT 0
- call ..@get_GOT
-%%getgot:
- add ebx, _GLOBAL_OFFSET_TABLE_ + $$ - %%getgot wrt ..gotpc
-%endmacro
-%endif
-%else
-; not ELF
-%ifdef PIC
-%error "Position-Independent Code is currently only supported for ELF"
-%endif
-%endif
-%ifndef lsym
-%define lsym(name) name
-%macro get_GOT 0
-%endmacro
-%endif
-
section .data
align 16
cw128 times 8 dw 128
diff --git a/src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm b/src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm
index c9de0bb..20d7f2b 100644
--- a/src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm
+++ b/src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm
@@ -22,32 +22,6 @@
%include "common.asm"
-%ifidn __OUTPUT_FORMAT__,elf
-%ifdef PIC
-section .text
-extern _GLOBAL_OFFSET_TABLE_
-..@get_GOT:
- mov ebx, [esp]
- ret
-%define lsym(name) ebx + name wrt ..gotoff
-%macro get_GOT 0
- call ..@get_GOT
-%%getgot:
- add ebx, _GLOBAL_OFFSET_TABLE_ + $$ - %%getgot wrt ..gotpc
-%endmacro
-%endif
-%else
-; not ELF
-%ifdef PIC
-%error "Position-Independent Code is currently only supported for ELF"
-%endif
-%endif
-%ifndef lsym
-%define lsym(name) name
-%macro get_GOT 0
-%endmacro
-%endif
-
section .data
align 16
cw128 times 8 dw 128