mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Fix build error in Crypto/Whirpool.c when using LLVM Clang compiler by disabling inline assembly in this case (caused by http://llvm.org/bugs/show_bug.cgi?id=24232)
This commit is contained in:
@@ -80,6 +80,15 @@
|
||||
#include "misc.h"
|
||||
#include "Whirlpool.h"
|
||||
|
||||
// "Inline assembly operands don't work with .intel_syntax",
|
||||
// http://llvm.org/bugs/show_bug.cgi?id=24232
|
||||
#if defined(CRYPTOPP_DISABLE_INTEL_ASM)
|
||||
# undef CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
# undef CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE
|
||||
# define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
|
||||
# define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The number of rounds of the internal dedicated block cipher.
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
#define VC_INLINE static inline
|
||||
#endif
|
||||
|
||||
// Clang pretends to be VC++, too.
|
||||
// See http://github.com/weidai11/cryptopp/issues/147
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
# error: "Unsupported configuration"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
@@ -16,14 +22,16 @@
|
||||
|
||||
// Apple and LLVM's Clang. Apple Clang version 7.0 roughly equals LLVM Clang version 3.7
|
||||
#if defined(__clang__ ) && !defined(__apple_build_version__)
|
||||
#define CRYPTOPP_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
|
||||
#define CRYPTOPP_LLVM_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
|
||||
#define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
|
||||
#elif defined(__clang__ ) && defined(__apple_build_version__)
|
||||
#define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
|
||||
#define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
|
||||
#endif
|
||||
|
||||
// Clang due to "Inline assembly operands don't work with .intel_syntax", http://llvm.org/bugs/show_bug.cgi?id=24232
|
||||
// TODO: supply the upper version when LLVM fixes it. We set it to 20.0 for compilation purposes.
|
||||
#if (defined(CRYPTOPP_CLANG_VERSION) && CRYPTOPP_CLANG_VERSION <= 200000) || (defined(CRYPTOPP_APPLE_CLANG_VERSION) && CRYPTOPP_APPLE_CLANG_VERSION <= 200000)
|
||||
#if (defined(CRYPTOPP_LLVM_CLANG_VERSION) && CRYPTOPP_LLVM_CLANG_VERSION <= 200000) || (defined(CRYPTOPP_APPLE_CLANG_VERSION) && CRYPTOPP_APPLE_CLANG_VERSION <= 200000) || defined(CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER)
|
||||
#define CRYPTOPP_DISABLE_INTEL_ASM 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,6 +4,27 @@
|
||||
#include "Common/Tcdefs.h"
|
||||
#include "config.h"
|
||||
|
||||
// Applies to both X86/X32/X64 and ARM32/ARM64
|
||||
#if defined(CRYPTOPP_LLVM_CLANG_VERSION) || defined(CRYPTOPP_APPLE_CLANG_VERSION) || defined(CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER)
|
||||
#define NEW_LINE "\n"
|
||||
#define INTEL_PREFIX ".intel_syntax;"
|
||||
#define INTEL_NOPREFIX ".intel_syntax;"
|
||||
#define ATT_PREFIX ".att_syntax;"
|
||||
#define ATT_NOPREFIX ".att_syntax;"
|
||||
#elif defined(__GNUC__)
|
||||
#define NEW_LINE
|
||||
#define INTEL_PREFIX ".intel_syntax prefix;"
|
||||
#define INTEL_NOPREFIX ".intel_syntax noprefix;"
|
||||
#define ATT_PREFIX ".att_syntax prefix;"
|
||||
#define ATT_NOPREFIX ".att_syntax noprefix;"
|
||||
#else
|
||||
#define NEW_LINE
|
||||
#define INTEL_PREFIX
|
||||
#define INTEL_NOPREFIX
|
||||
#define ATT_PREFIX
|
||||
#define ATT_NOPREFIX
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#define CRYPTOPP_X86_ASM_AVAILABLE
|
||||
@@ -218,6 +239,8 @@ extern int g_hasMMX;
|
||||
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
#define AS1(x) x*newline*
|
||||
#define AS2(x, y) x, y*newline*
|
||||
@@ -241,20 +264,6 @@ extern int g_hasMMX;
|
||||
#else
|
||||
#define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY
|
||||
|
||||
#if defined(CRYPTOPP_CLANG_VERSION) || defined(CRYPTOPP_APPLE_CLANG_VERSION)
|
||||
#define NEW_LINE "\n"
|
||||
#define INTEL_PREFIX ".intel_syntax;"
|
||||
#define INTEL_NOPREFIX ".intel_syntax;"
|
||||
#define ATT_PREFIX ".att_syntax;"
|
||||
#define ATT_NOPREFIX ".att_syntax;"
|
||||
#else
|
||||
#define NEW_LINE
|
||||
#define INTEL_PREFIX ".intel_syntax prefix;"
|
||||
#define INTEL_NOPREFIX ".intel_syntax noprefix;"
|
||||
#define ATT_PREFIX ".att_syntax prefix;"
|
||||
#define ATT_NOPREFIX ".att_syntax noprefix;"
|
||||
#endif
|
||||
|
||||
// define these in two steps to allow arguments to be expanded
|
||||
#define GNU_AS1(x) #x ";" NEW_LINE
|
||||
#define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE
|
||||
@@ -275,21 +284,6 @@ extern int g_hasMMX;
|
||||
#define IF0(y)
|
||||
#define IF1(y) y
|
||||
|
||||
// Should be confined to GCC, but its used to help manage Clang 3.4 compiler error.
|
||||
// Also see LLVM Bug 24232, http://llvm.org/bugs/show_bug.cgi?id=24232 .
|
||||
#ifndef INTEL_PREFIX
|
||||
#define INTEL_PREFIX
|
||||
#endif
|
||||
#ifndef INTEL_NOPREFIX
|
||||
#define INTEL_NOPREFIX
|
||||
#endif
|
||||
#ifndef ATT_PREFIX
|
||||
#define ATT_PREFIX
|
||||
#endif
|
||||
#ifndef ATT_NOPREFIX
|
||||
#define ATT_NOPREFIX
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
#define ASM_MOD(x, y) ((x) MOD (y))
|
||||
#define XMMWORD_PTR XMMWORD PTR
|
||||
@@ -420,6 +414,7 @@ extern int g_hasMMX;
|
||||
ASL(labelPrefix##9)\
|
||||
AS2( add outputPtr, increment*16)
|
||||
|
||||
#endif // X86/X32/X64
|
||||
|
||||
#if defined(TC_WINDOWS_DRIVER) || defined (_UEFI)
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user