summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-07-27 01:01:42 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2021-07-27 13:00:42 +0200
commit2173f382ca5e02b8c05ae2d75b040df701bf497e (patch)
tree441e3c52966267dc9ab105dbb0be7b1d4e9d6f74 /extra
parent217caf27e3ac40fb83ee64ae9cf4012e908097d8 (diff)
downloadmariadb-git-2173f382ca5e02b8c05ae2d75b040df701bf497e.tar.gz
MDEV-26236 ssl_8k_key test fails on x86
Workaround WolfSSL bug https://github.com/wolfSSL/wolfssl/issues/4242 (heap overflow) by using fastmath library everywhere, except Windows clang Before the patch, default math library was used on all 32bit platforms.
Diffstat (limited to 'extra')
-rw-r--r--extra/wolfssl/CMakeLists.txt20
1 files changed, 18 insertions, 2 deletions
diff --git a/extra/wolfssl/CMakeLists.txt b/extra/wolfssl/CMakeLists.txt
index d14ef49ea9c..387f6189609 100644
--- a/extra/wolfssl/CMakeLists.txt
+++ b/extra/wolfssl/CMakeLists.txt
@@ -107,8 +107,9 @@ ${WOLFCRYPT_SRCDIR}/wolfmath.c
)
# Use fastmath large number math library.
-IF(NOT (MSVC AND CMAKE_C_COMPILER_ID MATCHES Clang)
- AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
+IF(NOT (MSVC AND CMAKE_C_COMPILER_ID MATCHES Clang))
+ # Can't use clang-cl with WOLFSSL_FASTMATH
+ # due to https://bugs.llvm.org/show_bug.cgi?id=25305
SET(WOLFSSL_FASTMATH 1)
ENDIF()
@@ -119,6 +120,21 @@ IF(WOLFSSL_FASTMATH)
# WolfSSL will use more stack space with it
SET(FP_MAX_BITS 16384)
SET(WOLFCRYPT_SOURCES ${WOLFCRYPT_SOURCES} ${WOLFCRYPT_SRCDIR}/tfm.c)
+ IF((CMAKE_SIZEOF_VOID_P MATCHES 4) AND (CMAKE_SYSTEM_PROCESSOR MATCHES "86")
+ AND (NOT MSVC))
+ # Workaround https://github.com/wolfSSL/wolfssl/issues/4245
+ # On 32bit Intel, to satisfy inline assembly's wish for free registers
+ # 1. use -fomit-frame-pointer
+ # 2. With GCC 4, additionally use -fno-PIC, which works on x86
+ # (modern GCC has PIC optimizations, that make it unnecessary)
+ # The following assumes GCC or Clang
+ SET(TFM_COMPILE_FLAGS "-fomit-frame-pointer")
+ IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "5")
+ SET(TFM_COMPILE_FLAGS "${TFM_COMPILE_FLAGS} -fno-PIC")
+ ENDIF()
+ SET_SOURCE_FILES_PROPERTIES(${WOLFCRYPT_SRCDIR}/tfm.c
+ PROPERTIES COMPILE_FLAGS ${TFM_COMPILE_FLAGS})
+ ENDIF()
ELSE()
SET(WOLFCRYPT_SOURCES ${WOLFCRYPT_SOURCES} ${WOLFCRYPT_SRCDIR}/integer.c)
ENDIF()