diff --git a/configure.ac b/configure.ac index 79a03ac0..7bd1380c 100644 --- a/configure.ac +++ b/configure.ac @@ -529,9 +529,9 @@ __asm__ __volatile__ ("xchgl %%ebx, %k1; cpuid; xchgl %%ebx, %k1" : ]) AC_SUBST(HAVE_CPUID_V) -HAVE_VISIBILITY_V=0 +asm_hide_symbol="unsupported" AS_IF([test "$enable_asm" != "no"],[ - AC_MSG_CHECKING(if the private_extern asm directive is supported) + 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" @@ -543,12 +543,28 @@ __asm__ __volatile__ (".private_extern dummy_symbol \n" ); ]])], [AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_VISIBILITY], [1], [the private_extern asm directive -is supported]) - HAVE_VISIBILITY_V=1], + asm_hide_symbol=".private_extern"], [AC_MSG_RESULT(no)]) + + AC_MSG_CHECKING(if the .hidden asm directive is supported) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ +__asm__ __volatile__ (".hidden dummy_symbol \n" + ".hidden _dummy_symbol \n" + ".globl dummy_symbol \n" + ".globl _dummy_symbol \n" + "dummy_symbol: \n" + "_dummy_symbol: \n" + " nop \n" +); + ]])], + [AC_MSG_RESULT(yes) + asm_hide_symbol=".hidden"], + [AC_MSG_RESULT(no)]) + + AS_IF([test "$asm_hide_symbol" != "unsupported"],[ + AC_DEFINE_UNQUOTED([ASM_HIDE_SYMBOL], [$asm_hide_symbol], [directive to hide symbols]) ]) -AC_SUBST(HAVE_VISIBILITY_V) +]) AC_MSG_CHECKING(if weak symbols are supported) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S index 7f793ff9..83501b03 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S @@ -7,9 +7,9 @@ #include "consts_namespace.h" .text .p2align 5 -#ifdef HAVE_VISIBILITY -.private_extern fe51_mul -.private_extern _fe51_mul +#ifdef ASM_HIDE_SYMBOL +ASM_HIDE_SYMBOL fe51_mul +ASM_HIDE_SYMBOL _fe51_mul #endif .globl fe51_mul .globl _fe51_mul diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S index a8a14aef..fabdf5b8 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S @@ -8,9 +8,9 @@ #include "consts_namespace.h" .p2align 5 -#ifdef HAVE_VISIBILITY -.private_extern fe51_nsquare -.private_extern _fe51_nsquare +#ifdef ASM_HIDE_SYMBOL +ASM_HIDE_SYMBOL fe51_nsquare +ASM_HIDE_SYMBOL _fe51_nsquare #endif .globl fe51_nsquare .globl _fe51_nsquare diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S index 65f2c08d..cf5d2c5c 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S @@ -8,9 +8,9 @@ #include "consts_namespace.h" .p2align 5 -#ifdef HAVE_VISIBILITY -.private_extern fe51_pack -.private_extern _fe51_pack +#ifdef ASM_HIDE_SYMBOL +ASM_HIDE_SYMBOL fe51_pack +ASM_HIDE_SYMBOL _fe51_pack #endif .globl fe51_pack .globl _fe51_pack diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S index 412aed1d..92ecac9b 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S @@ -4,9 +4,9 @@ #include "consts_namespace.h" .p2align 5 -#ifdef HAVE_VISIBILITY -.private_extern ladder -.private_extern _ladder +#ifdef ASM_HIDE_SYMBOL +ASM_HIDE_SYMBOL ladder +ASM_HIDE_SYMBOL _ladder #endif .globl ladder .globl _ladder diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S index 1efd9dc3..a400b2aa 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S @@ -4,9 +4,9 @@ #include "consts_namespace.h" .p2align 5 -#ifdef HAVE_VISIBILITY -.private_extern ladder_base -.private_extern _ladder_base +#ifdef ASM_HIDE_SYMBOL +ASM_HIDE_SYMBOL ladder_base +ASM_HIDE_SYMBOL _ladder_base #endif .globl ladder_base .globl _ladder_base