Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge 'solaris' dev branch into 'master'
  • Loading branch information
noloader committed Jun 15, 2016
1 parent a4f9045 commit b1df573
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 82 deletions.
46 changes: 31 additions & 15 deletions GNUmakefile
Expand Up @@ -35,6 +35,10 @@ CLANG_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")
INTEL_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\)")
MACPORTS_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "macports")

# Sun Studio 12.0 (0x0510) and 12.3 (0x0512)
SUNCC_120_OR_LATER := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: Sun .* (5\.1[0-9]|5\.[2-9]|6\.)")
SUNCC_123_OR_LATER := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: Sun .* (5\.1[2-9]|5\.[2-9]|6\.)")

HAS_SOLIB_VERSION := $(IS_LINUX)

# Fixup SunOS
Expand All @@ -49,7 +53,11 @@ endif

# Base CXXFLAGS used if the user did not specify them
ifeq ($(SUN_COMPILER),1)
CXXFLAGS ?= -DNDEBUG -g3 -xO2
ifeq ($(SUNCC_123_OR_LATER),1)
CXXFLAGS ?= -DNDEBUG -g3 -xO2
else
CXXFLAGS ?= -DNDEBUG -g -xO2
endif
else
CXXFLAGS ?= -DNDEBUG -g2 -O2
endif
Expand Down Expand Up @@ -111,18 +119,16 @@ endif
# Guard use of -march=native
ifeq ($(GCC42_OR_LATER)$(IS_NETBSD),10)
CXXFLAGS += -march=native
else ifeq ($(CLANG_COMPILER),1)
CXXFLAGS += -march=native
else ifeq ($(INTEL_COMPILER),1)
else ifneq ($(CLANG_COMPILER)$(INTEL_COMPILER),00)
CXXFLAGS += -march=native
else
# GCC 3.3 and "unknown option -march="
# Ubuntu GCC 4.1 compiler crash with -march=native
# NetBSD GCC 4.8 compiler and "bad value (native) for -march= switch"
# Sun compiler from legacy and handled below
# Sun compiler is handled below
ifeq ($(SUN_COMPILER)$(IS_X64),01)
CXXFLAGS += -m64
else ifeq ($(SUN_COMPILER)$(IS_X32),01)
else ifeq ($(SUN_COMPILER)$(IS_X86),01)
CXXFLAGS += -m32
endif # X86/X32/X64
endif
Expand Down Expand Up @@ -161,11 +167,11 @@ endif
endif

# Allow use of "/" operator for GNU Assembler
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
ifeq ($(IS_GAS),1)
CXXFLAGS += -Wa,--divide
endif
endif
# ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
# ifeq ($(IS_GAS),1)
# CXXFLAGS += -Wa,--divide
# endif
# endif

ifeq ($(UNAME),) # for DJGPP, where uname doesn't exist
CXXFLAGS += -mbnu210
Expand Down Expand Up @@ -230,20 +236,26 @@ endif
# Add -errtags=yes to get the name for a warning suppression
ifneq ($(SUN_COMPILER),0) # override flags for CC Sun C++ compiler
IS_64 := $(shell isainfo -b 2>/dev/null | grep -i -c "64")
ifeq ($(SUN_COMPILER)$(IS_64),11)
CXXFLAGS += -native -template=no%extdef -w -erroff=wvarhidemem -erroff=voidretw -m64
else ifeq ($(SUN_COMPILER)$(IS_64),10)
CXXFLAGS += -native -template=no%extdef -w -erroff=wvarhidemem -erroff=voidretw -m32
ifeq ($(IS_64),1)
CXXFLAGS += -native -m64
else ifeq ($(IS_64),0)
CXXFLAGS += -native -m32
endif
# Add for non-i386
ifneq ($(IS_X86),1)
CXXFLAGS += -KPIC
endif
# Add to all Solaris
CXXFLAGS += -template=no%extdef -w -erroff=wvarhidemem -erroff=voidretw
SUN_CC10_BUGGY := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: Sun .* 5\.10 .* (2009|2010/0[1-4])")
ifneq ($(SUN_CC10_BUGGY),0)
# -DCRYPTOPP_INCLUDE_VECTOR_CC is needed for Sun Studio 12u1 Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21 and was fixed in May 2010
# remove it if you get "already had a body defined" errors in vector.cc
CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC
endif
#ifneq ($SUNCC_123_OR_LATER),0)
#CXXFLAGS += -xarch=aes -D__AES__=1 -xarch=no%sse4_1 -xarch=no%sse4_2
#endif
AR = $(CXX)
ARFLAGS = -xar -o
RANLIB = true
Expand Down Expand Up @@ -553,7 +565,9 @@ endif

libcryptopp.a: $(LIBOBJS) | config_warning
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
ifeq ($(IS_SUN),0)
$(RANLIB) $@
endif

ifeq ($(HAS_SOLIB_VERSION),1)
.PHONY: libcryptopp.so
Expand Down Expand Up @@ -584,7 +598,9 @@ cryptopp.dll: $(DLLOBJS)

libcryptopp.import.a: $(LIBIMPORTOBJS)
$(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
ifeq ($(IS_SUN),0)
$(RANLIB) $@
endif

cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
$(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS)
Expand Down
5 changes: 5 additions & 0 deletions blake2.cpp
Expand Up @@ -22,6 +22,11 @@ NAMESPACE_BEGIN(CryptoPP)
# undef CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
#endif

// Testing shows Sun CC needs 12.4 for _mm_set_epi64x
#if (__SUNPRO_CC <= 0x5130)
# undef CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
#endif

// Visual Studio needs VS2008 (1500); no dependency on _mm_set_epi64x()
// http://msdn.microsoft.com/en-us/library/bb892950%28v=vs.90%29.aspx
#if defined(_MSC_VER) && (_MSC_VER < 1500)
Expand Down
35 changes: 29 additions & 6 deletions config.h
Expand Up @@ -404,6 +404,12 @@ NAMESPACE_END
# define CRYPTOPP_DISABLE_ASM
#endif

// Sun Studio 12 provides GCC inline assembly, http://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support
// We can enable SSE2 for Sun Studio in the makefile with -D__SSE2__, but users may not compile with it.
#if !defined(CRYPTOPP_DISABLE_ASM) && defined(__x86_64__) && (__SUNPRO_CC >= 0x5100) && !defined(__SSE2__)
# define __SSE2__ 1
#endif

#if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
// C++Builder 2010 does not allow "call label" where label is defined within inline assembly
#define CRYPTOPP_X86_ASM_AVAILABLE
Expand All @@ -417,7 +423,7 @@ NAMESPACE_END
// SSE3 was actually introduced in GNU as 2.17, which was released 6/23/2006, but we can't tell what version of binutils is installed.
// GCC 4.1.2 was released on 2/13/2007, so we'll use that as a proxy for the binutils version. Also see the output of
// `gcc -dM -E -march=native - < /dev/null | grep -i SSE` for preprocessor defines available.
#if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102 || defined(__SSSE3__) || defined(__SSE3__))
#if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102 || defined(__SSSE3__))
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
Expand Down Expand Up @@ -746,7 +752,7 @@ NAMESPACE_END
// C++11 or C++14 is available
#if defined(CRYPTOPP_CXX11)

// atomics: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.1/3.2; and Intel 13.0.
// atomics: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.1/3.2; Intel 13.0; SunCC 12.5.
#if (CRYPTOPP_MSC_VERSION >= 1700)
# define CRYPTOPP_CXX11_ATOMICS 1
#elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1300)
Expand All @@ -757,9 +763,11 @@ NAMESPACE_END
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40400)
# define CRYPTOPP_CXX11_ATOMICS 1
#elif (__SUNPRO_CC >= 0x5140)
# define CRYPTOPP_CXX11_ATOMICS 1
#endif // atomics

// synchronization: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Xcode 5.0; and Intel 12.0.
// synchronization: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Xcode 5.0; Intel 12.0; SunCC 12.4.
// TODO: verify Clang and Intel versions; find __has_feature(x) extension for Clang
#if (CRYPTOPP_MSC_VERSION >= 1700)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
Expand All @@ -769,9 +777,11 @@ NAMESPACE_END
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#elif (CRYPTOPP_GCC_VERSION >= 40400)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#endif // synchronization

// alignof/alignas: MS at VS2015 (19.00); GCC at 4.8; Clang at 3.3; and Intel 15.0.
// alignof/alignas: MS at VS2015 (19.00); GCC at 4.8; Clang at 3.3; Intel 15.0; SunCC 12.4.
#if (CRYPTOPP_MSC_VERSION >= 1900)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
Expand All @@ -788,9 +798,12 @@ NAMESPACE_END
#elif (CRYPTOPP_GCC_VERSION >= 40800)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#endif // alignof/alignas

// noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; and Intel 14.0.
// noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; Intel 14.0; SunCC 12.4.
#if (CRYPTOPP_MSC_VERSION >= 1900)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1400)
Expand All @@ -801,9 +814,11 @@ NAMESPACE_END
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40600)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#endif // noexcept compilers

// variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; and Intel 12.1.
// variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; Intel 12.1; SunCC 12.4.
#if (CRYPTOPP_MSC_VERSION >= 1800)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1210)
Expand All @@ -814,13 +829,21 @@ NAMESPACE_END
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40300)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#endif // variadic templates

// TODO: Emplacement, R-values and Move semantics
// Needed because we are catching warnings with GCC and MSC

#endif // CRYPTOPP_CXX11

// Hack... CRYPTOPP_ALIGN_DATA is defined earlier, before C++11 alignas available
#if defined(CRYPTOPP_CXX11_ALIGNAS)
# undef CRYPTOPP_ALIGN_DATA
# define CRYPTOPP_ALIGN_DATA(x) alignas(x)
#endif // CRYPTOPP_CXX11_ALIGNAS

#if defined(CRYPTOPP_CXX11_NOEXCEPT)
# define CRYPTOPP_THROW noexcept(false)
# define CRYPTOPP_NO_THROW noexcept(true)
Expand Down
35 changes: 29 additions & 6 deletions config.recommend
Expand Up @@ -404,6 +404,12 @@ NAMESPACE_END
# define CRYPTOPP_DISABLE_ASM
#endif

// Sun Studio 12 provides GCC inline assembly, http://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support
// We can enable SSE2 for Sun Studio in the makefile with -D__SSE2__, but users may not compile with it.
#if !defined(CRYPTOPP_DISABLE_ASM) && defined(__x86_64__) && (__SUNPRO_CC >= 0x5100) && !defined(__SSE2__)
# define __SSE2__ 1
#endif

#if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
// C++Builder 2010 does not allow "call label" where label is defined within inline assembly
#define CRYPTOPP_X86_ASM_AVAILABLE
Expand All @@ -417,7 +423,7 @@ NAMESPACE_END
// SSE3 was actually introduced in GNU as 2.17, which was released 6/23/2006, but we can't tell what version of binutils is installed.
// GCC 4.1.2 was released on 2/13/2007, so we'll use that as a proxy for the binutils version. Also see the output of
// `gcc -dM -E -march=native - < /dev/null | grep -i SSE` for preprocessor defines available.
#if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102 || defined(__SSSE3__) || defined(__SSE3__))
#if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102 || defined(__SSSE3__))
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
Expand Down Expand Up @@ -744,7 +750,7 @@ NAMESPACE_END
// C++11 or C++14 is available
#if defined(CRYPTOPP_CXX11)

// atomics: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.1/3.2; and Intel 13.0.
// atomics: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.1/3.2; Intel 13.0; SunCC 12.5.
#if (CRYPTOPP_MSC_VERSION >= 1700)
# define CRYPTOPP_CXX11_ATOMICS 1
#elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1300)
Expand All @@ -755,9 +761,11 @@ NAMESPACE_END
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40400)
# define CRYPTOPP_CXX11_ATOMICS 1
#elif (__SUNPRO_CC >= 0x5140)
# define CRYPTOPP_CXX11_ATOMICS 1
#endif // atomics

// synchronization: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Xcode 5.0; and Intel 12.0.
// synchronization: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Xcode 5.0; Intel 12.0; SunCC 12.4.
// TODO: verify Clang and Intel versions; find __has_feature(x) extension for Clang
#if (CRYPTOPP_MSC_VERSION >= 1700)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
Expand All @@ -767,9 +775,11 @@ NAMESPACE_END
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#elif (CRYPTOPP_GCC_VERSION >= 40400)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_SYNCHRONIZATION 1
#endif // synchronization

// alignof/alignas: MS at VS2015 (19.00); GCC at 4.8; Clang at 3.3; and Intel 15.0.
// alignof/alignas: MS at VS2015 (19.00); GCC at 4.8; Clang at 3.3; Intel 15.0; SunCC 12.4.
#if (CRYPTOPP_MSC_VERSION >= 1900)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
Expand All @@ -786,9 +796,12 @@ NAMESPACE_END
#elif (CRYPTOPP_GCC_VERSION >= 40800)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#endif // alignof/alignas

// noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; and Intel 14.0.
// noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; Intel 14.0; SunCC 12.4.
#if (CRYPTOPP_MSC_VERSION >= 1900)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1400)
Expand All @@ -799,9 +812,11 @@ NAMESPACE_END
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40600)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#endif // noexcept compilers

// variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; and Intel 12.1.
// variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; Intel 12.1; SunCC 12.4.
#if (CRYPTOPP_MSC_VERSION >= 1800)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1210)
Expand All @@ -812,13 +827,21 @@ NAMESPACE_END
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40300)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#elif (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#endif // variadic templates

// TODO: Emplacement, R-values and Move semantics
// Needed because we are catching warnings with GCC and MSC

#endif // CRYPTOPP_CXX11

// Hack... CRYPTOPP_ALIGN_DATA is defined earlier, before C++11 alignas available
#if defined(CRYPTOPP_CXX11_ALIGNAS)
# undef CRYPTOPP_ALIGN_DATA
# define CRYPTOPP_ALIGN_DATA(x) alignas(x)
#endif // CRYPTOPP_CXX11_ALIGNAS

#if defined(CRYPTOPP_CXX11_NOEXCEPT)
# define CRYPTOPP_THROW noexcept(false)
# define CRYPTOPP_NO_THROW noexcept(true)
Expand Down

1 comment on commit b1df573

@noloader
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion at Integer class hack due to Sun CC on the mailing list.

Please sign in to comment.