Commit 0149d937 authored by Niels Möller's avatar Niels Möller

Reorganize symbols for fat routines.

parent f003aee6
2015-01-17 Niels Möller <nisse@lysator.liu.se> 2015-01-17 Niels Möller <nisse@lysator.liu.se>
* config.m4.in (SYMBOL_PREFIX): Define from from autoconf
ASM_SYMBOL_PREFIX.
(C_NAMS): move definition to...
* asm.m4 (C_NAME): Define here, also take fat_transform.
(fat_suffix): Replaced by...
(fat_transform): New macro, taking symbol nama as argument.
Updated all uses of fat_suffix.
* fat-x86_64.c: Updated for internal "_nettle" prefix on
cpu-specific memxor functions.
* fat-x86_64.c: Set up for sse2 vs non-sse2 memxor. Patch by Nikos * fat-x86_64.c: Set up for sse2 vs non-sse2 memxor. Patch by Nikos
Mavrogiannopoulos. Mavrogiannopoulos.
* configure.ac (asm_nettle_optional_list): Added memxor-2.asm. * configure.ac (asm_nettle_optional_list): Added memxor-2.asm.
......
...@@ -13,7 +13,8 @@ dnl Including files from the srcdir ...@@ -13,7 +13,8 @@ dnl Including files from the srcdir
define(<include_src>, <include(srcdir/$1)>)dnl define(<include_src>, <include(srcdir/$1)>)dnl
dnl default definition, changed in fat builds dnl default definition, changed in fat builds
define(<fat_suffix>, <>) define(<fat_transform>, <$1>)
define(<C_NAME>, <SYMBOL_PREFIX<>fat_transform($1)>)
dnl Pseudo ops dnl Pseudo ops
define(<DECLARE_FUNC>, define(<DECLARE_FUNC>,
...@@ -27,13 +28,13 @@ COFF_STYLE, yes, ...@@ -27,13 +28,13 @@ COFF_STYLE, yes,
<>)>) <>)>)
define(<PROLOGUE>, define(<PROLOGUE>,
<.globl C_NAME($1)<>fat_suffix <.globl C_NAME($1)
DECLARE_FUNC(C_NAME($1)<>fat_suffix) DECLARE_FUNC(C_NAME($1))
C_NAME($1)<>fat_suffix:>) C_NAME($1):>)
define(<EPILOGUE>, define(<EPILOGUE>,
<ifelse(ELF_STYLE,yes, <ifelse(ELF_STYLE,yes,
<.size C_NAME($1)<>fat_suffix, . - C_NAME($1)<>fat_suffix>,<>)>) <.size C_NAME($1), . - C_NAME($1)>,<>)>)
define(<m4_log2>, <m4_log2_internal($1,1,0)>) define(<m4_log2>, <m4_log2_internal($1,1,0)>)
define(<m4_log2_internal>, define(<m4_log2_internal>,
......
define(<srcdir>, <<@srcdir@>>)dnl define(<srcdir>, <<@srcdir@>>)dnl
define(<C_NAME>, <@ASM_SYMBOL_PREFIX@><$1>)dnl define(<SYMBOL_PREFIX>, <@ASM_SYMBOL_PREFIX@><$1>)dnl
define(<ELF_STYLE>, <@ASM_ELF_STYLE@>)dnl define(<ELF_STYLE>, <@ASM_ELF_STYLE@>)dnl
define(<COFF_STYLE>, <@ASM_COFF_STYLE@>)dnl define(<COFF_STYLE>, <@ASM_COFF_STYLE@>)dnl
define(<TYPE_FUNCTION>, <@ASM_TYPE_FUNCTION@>)dnl define(<TYPE_FUNCTION>, <@ASM_TYPE_FUNCTION@>)dnl
......
...@@ -105,10 +105,9 @@ aes_crypt_internal_func _nettle_aes_decrypt_aesni; ...@@ -105,10 +105,9 @@ aes_crypt_internal_func _nettle_aes_decrypt_aesni;
typedef void *(memxor_func)(void *dst_in, const void *src_in, size_t n); typedef void *(memxor_func)(void *dst_in, const void *src_in, size_t n);
/* FIXME: Fix fat name-mangling to get _nettle prefix. */
memxor_func nettle_memxor IFUNC ("_memxor_resolve"); memxor_func nettle_memxor IFUNC ("_memxor_resolve");
memxor_func nettle_memxor_x86_64; memxor_func _nettle_memxor_x86_64;
memxor_func nettle_memxor_sse2; memxor_func _nettle_memxor_sse2;
#if HAVE_LINK_IFUNC #if HAVE_LINK_IFUNC
#define _aes_encrypt_init NULL #define _aes_encrypt_init NULL
...@@ -120,7 +119,7 @@ static aes_crypt_internal_func _aes_decrypt_init; ...@@ -120,7 +119,7 @@ static aes_crypt_internal_func _aes_decrypt_init;
static aes_crypt_internal_func *_aes_encrypt_vec = _aes_encrypt_init; static aes_crypt_internal_func *_aes_encrypt_vec = _aes_encrypt_init;
static aes_crypt_internal_func *_aes_decrypt_vec = _aes_decrypt_init; static aes_crypt_internal_func *_aes_decrypt_vec = _aes_decrypt_init;
static memxor_func *_memxor_vec = nettle_memxor_x86_64; static memxor_func *_memxor_vec = _nettle_memxor_x86_64;
/* This function should usually be called only once, at startup. But /* This function should usually be called only once, at startup. But
it is idempotent, and on x86, pointer updates are atomic, so it is idempotent, and on x86, pointer updates are atomic, so
...@@ -167,13 +166,13 @@ fat_init (void) ...@@ -167,13 +166,13 @@ fat_init (void)
{ {
if (verbose) if (verbose)
fprintf (stderr, "libnettle: intel SSE2 will be used for XOR.\n"); fprintf (stderr, "libnettle: intel SSE2 will be used for XOR.\n");
_memxor_vec = nettle_memxor_sse2; _memxor_vec = _nettle_memxor_sse2;
} }
else else
{ {
if (verbose) if (verbose)
fprintf (stderr, "libnettle: intel SSE2 will not be used for XOR.\n"); fprintf (stderr, "libnettle: intel SSE2 will not be used for XOR.\n");
_memxor_vec = nettle_memxor_x86_64; _memxor_vec = _nettle_memxor_x86_64;
} }
/* The x86_64 architecture should always make stores visible in the /* The x86_64 architecture should always make stores visible in the
......
...@@ -31,5 +31,5 @@ ifelse(< ...@@ -31,5 +31,5 @@ ifelse(<
not, see http://www.gnu.org/licenses/. not, see http://www.gnu.org/licenses/.
>) >)
define(<fat_suffix>, <_aesni>) define(<fat_transform>, <$1_aesni>)
include_src(<x86_64/aesni/aes-decrypt-internal.asm>) include_src(<x86_64/aesni/aes-decrypt-internal.asm>)
...@@ -31,5 +31,5 @@ ifelse(< ...@@ -31,5 +31,5 @@ ifelse(<
not, see http://www.gnu.org/licenses/. not, see http://www.gnu.org/licenses/.
>) >)
define(<fat_suffix>, <_x86_64>) define(<fat_transform>, <$1_x86_64>)
include_src(<x86_64/aes-decrypt-internal.asm>) include_src(<x86_64/aes-decrypt-internal.asm>)
...@@ -31,5 +31,5 @@ ifelse(< ...@@ -31,5 +31,5 @@ ifelse(<
not, see http://www.gnu.org/licenses/. not, see http://www.gnu.org/licenses/.
>) >)
define(<fat_suffix>, <_aesni>) define(<fat_transform>, <$1_aesni>)
include_src(<x86_64/aesni/aes-encrypt-internal.asm>) include_src(<x86_64/aesni/aes-encrypt-internal.asm>)
...@@ -31,5 +31,5 @@ ifelse(< ...@@ -31,5 +31,5 @@ ifelse(<
not, see http://www.gnu.org/licenses/. not, see http://www.gnu.org/licenses/.
>) >)
define(<fat_suffix>, <_x86_64>) define(<fat_transform>, <$1_x86_64>)
include_src(<x86_64/aes-encrypt-internal.asm>) include_src(<x86_64/aes-encrypt-internal.asm>)
...@@ -31,6 +31,6 @@ ifelse(< ...@@ -31,6 +31,6 @@ ifelse(<
not, see http://www.gnu.org/licenses/. not, see http://www.gnu.org/licenses/.
>) >)
define(<fat_suffix>, <_sse2>) define(<fat_transform>, <_$1_sse2>)
define(<USE_SSE2>, <yes>) define(<USE_SSE2>, <yes>)
include_src(<x86_64/memxor.asm>) include_src(<x86_64/memxor.asm>)
...@@ -31,5 +31,5 @@ ifelse(< ...@@ -31,5 +31,5 @@ ifelse(<
not, see http://www.gnu.org/licenses/. not, see http://www.gnu.org/licenses/.
>) >)
define(<fat_suffix>, <_x86_64>) define(<fat_transform>, <_$1_x86_64>)
include_src(<x86_64/memxor.asm>) include_src(<x86_64/memxor.asm>)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment