From bafc9c70e1052a3413afc879d319ee3f89499113 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 22 Mar 2016 20:42:07 +0100 Subject: [PATCH] Only use .private_extern if this is supported --- configure.ac | 21 +++++++++++++++++++ .../curve25519/sandy2x/fe51_mul.S | 2 ++ .../curve25519/sandy2x/fe51_nsquare.S | 2 ++ .../curve25519/sandy2x/fe51_pack.S | 2 ++ .../curve25519/sandy2x/ladder.S | 2 ++ .../curve25519/sandy2x/ladder_base.S | 2 ++ 6 files changed, 31 insertions(+) diff --git a/configure.ac b/configure.ac index 2328ca4a..79a03ac0 100644 --- a/configure.ac +++ b/configure.ac @@ -529,6 +529,27 @@ __asm__ __volatile__ ("xchgl %%ebx, %k1; cpuid; xchgl %%ebx, %k1" : ]) AC_SUBST(HAVE_CPUID_V) +HAVE_VISIBILITY_V=0 +AS_IF([test "$enable_asm" != "no"],[ + AC_MSG_CHECKING(if the private_extern asm directive is supported) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ +__asm__ __volatile__ (".private_extern dummy_symbol \n" + ".private_extern _dummy_symbol \n" + ".globl dummy_symbol \n" + ".globl _dummy_symbol \n" + "dummy_symbol: \n" + "_dummy_symbol: \n" + " nop \n" +); + ]])], + [AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_VISIBILITY], [1], [the private_extern asm directive +is supported]) + HAVE_VISIBILITY_V=1], + [AC_MSG_RESULT(no)]) + ]) +AC_SUBST(HAVE_VISIBILITY_V) + AC_MSG_CHECKING(if weak symbols are supported) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ __attribute__((weak)) void __dummy(void *x) { } diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S index 4249db51..7f793ff9 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S @@ -7,8 +7,10 @@ #include "consts_namespace.h" .text .p2align 5 +#ifdef HAVE_VISIBILITY .private_extern fe51_mul .private_extern _fe51_mul +#endif .globl fe51_mul .globl _fe51_mul #ifdef __ELF__ diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S index 64ab2b5a..a8a14aef 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S @@ -8,8 +8,10 @@ #include "consts_namespace.h" .p2align 5 +#ifdef HAVE_VISIBILITY .private_extern fe51_nsquare .private_extern _fe51_nsquare +#endif .globl fe51_nsquare .globl _fe51_nsquare #ifdef __ELF__ diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S index b6128ee3..65f2c08d 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S @@ -8,8 +8,10 @@ #include "consts_namespace.h" .p2align 5 +#ifdef HAVE_VISIBILITY .private_extern fe51_pack .private_extern _fe51_pack +#endif .globl fe51_pack .globl _fe51_pack #ifdef __ELF__ diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S index abb8fd68..412aed1d 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S @@ -4,8 +4,10 @@ #include "consts_namespace.h" .p2align 5 +#ifdef HAVE_VISIBILITY .private_extern ladder .private_extern _ladder +#endif .globl ladder .globl _ladder #ifdef __ELF__ diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S index 7d21687e..1efd9dc3 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S @@ -4,8 +4,10 @@ #include "consts_namespace.h" .p2align 5 +#ifdef HAVE_VISIBILITY .private_extern ladder_base .private_extern _ladder_base +#endif .globl ladder_base .globl _ladder_base #ifdef __ELF__