mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Fix "error "SSSE3 instruction set not enabled" when compiling using GCC version < 4.9 without -mssse3 option (SSSE3=1 when using make). (#507)
Compiling with -mxxx defines the corresponding macro of the intrinsics.
For example, -mssse3 defines __SSSE3__ macro to 1.
In GCC versions < 4.9, it is not possible to use and call x86 intrinsics only at runtime without
compiling the entire file with the -mxxx option.
For example, if we want to call SSSE3 intrinsics without compiling with -mssse3, the macro __SSSE3__ is not defined.
Therefore, when including <tmmintrin.h>, this results in "error "SSSE3 instruction set not enabled"" because of :
#ifndef __SSSE3__
# error "SSSE3 instruction set not enabled"
Since GCC 4.9, this has been fixed and it is possible to call x86 intrinsics from select functions in a file
that are tagged with the corresponding target attribute without having to compile the entire file with the -mxxx option.
This can be seen in <tmmintrin.h> which in recent versions (>= 4.9) contains :
#ifndef __SSSE3__
#pragma GCC push_options
#pragma GCC target("ssse3")
#define __DISABLE_SSSE3__
Since SSSE3 is only used under Windows for ChaCha256, this can be fixed by preceding '#include <tmmintrin.h>' with
#if defined (_MSC_VER) && !defined (TC_WINDOWS_BOOT).
See https://gcc.gnu.org/gcc-4.9/changes.html
This commit is contained in:
committed by
Mounir IDRASSI
parent
1fb81d1a43
commit
9a895bedde
@@ -144,6 +144,7 @@ extern __m128i _mm_set1_epi64x (__int64 a);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CRYPTOPP_SSSE3_AVAILABLE || defined(__INTEL_COMPILER)
|
#if CRYPTOPP_SSSE3_AVAILABLE || defined(__INTEL_COMPILER)
|
||||||
|
#if defined (_MSC_VER) && !defined (TC_WINDOWS_BOOT)
|
||||||
#if defined(TC_WINDOWS_DRIVER) || defined (_UEFI)
|
#if defined(TC_WINDOWS_DRIVER) || defined (_UEFI)
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -155,6 +156,7 @@ extern __m128i _mm_shuffle_epi8 (__m128i a, __m128i b);
|
|||||||
#else
|
#else
|
||||||
#include <tmmintrin.h>
|
#include <tmmintrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__SSE4_1__) || defined(__INTEL_COMPILER) || defined(_MSC_VER)
|
#if defined(__SSE4_1__) || defined(__INTEL_COMPILER) || defined(_MSC_VER)
|
||||||
#if defined(TC_WINDOWS_DRIVER) || defined (_UEFI)
|
#if defined(TC_WINDOWS_DRIVER) || defined (_UEFI)
|
||||||
|
|||||||
Reference in New Issue
Block a user