Add IBM XLC init priority support

pull/752/head
Jeffrey Walton 2018-11-30 08:23:35 -05:00
parent 52613240ae
commit 3e909c13d4
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
4 changed files with 21 additions and 21 deletions

View File

@ -373,6 +373,8 @@ NAMESPACE_END
#define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data"))) #define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data")))
#elif (defined(__ELF__) && (CRYPTOPP_GCC_VERSION >= 40300)) #elif (defined(__ELF__) && (CRYPTOPP_GCC_VERSION >= 40300))
#define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon"))) #define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
#elif defined(__ELF__) && (defined(__xlC__) || defined(__ibmxl__))
#define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
#else #else
#define CRYPTOPP_SECTION_INIT #define CRYPTOPP_SECTION_INIT
#endif #endif
@ -858,7 +860,7 @@ NAMESPACE_END
#if defined(_MSC_VER) #if defined(_MSC_VER)
# define CRYPTOPP_NOINLINE_DOTDOTDOT # define CRYPTOPP_NOINLINE_DOTDOTDOT
# define CRYPTOPP_NOINLINE __declspec(noinline) # define CRYPTOPP_NOINLINE __declspec(noinline)
#elif defined(__xlc__) || defined(__xlC__) #elif defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__)
# define CRYPTOPP_NOINLINE_DOTDOTDOT ... # define CRYPTOPP_NOINLINE_DOTDOTDOT ...
# define CRYPTOPP_NOINLINE __attribute__((noinline)) # define CRYPTOPP_NOINLINE __attribute__((noinline))
#elif defined(__GNUC__) #elif defined(__GNUC__)
@ -904,10 +906,8 @@ NAMESPACE_END
// CRYPTOPP_USER_PRIORITY is for other libraries and user code that is using Crypto++ // CRYPTOPP_USER_PRIORITY is for other libraries and user code that is using Crypto++
// and managing C++ static object creation. It is guaranteed not to conflict with // and managing C++ static object creation. It is guaranteed not to conflict with
// values used by (or would be used by) the Crypto++ library. // values used by (or would be used by) the Crypto++ library.
#if defined(CRYPTOPP_INIT_PRIORITY) && (CRYPTOPP_INIT_PRIORITY > 0) #ifndef CRYPTOPP_USER_PRIORITY
# define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY + 101) # define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY+101)
#else
# define CRYPTOPP_USER_PRIORITY 350
#endif #endif
// Most platforms allow us to specify when to create C++ objects. Apple and Sun do not. // Most platforms allow us to specify when to create C++ objects. Apple and Sun do not.
@ -916,6 +916,8 @@ NAMESPACE_END
# define HAVE_GCC_INIT_PRIORITY 1 # define HAVE_GCC_INIT_PRIORITY 1
# elif (CRYPTOPP_MSC_VERSION >= 1310) # elif (CRYPTOPP_MSC_VERSION >= 1310)
# define HAVE_MSC_INIT_PRIORITY 1 # define HAVE_MSC_INIT_PRIORITY 1
# elif defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__)
# define HAVE_XLC_INIT_PRIORITY 1
# endif # endif
#endif // CRYPTOPP_INIT_PRIORITY, NO_OS_DEPENDENCE, Apple, Sun #endif // CRYPTOPP_INIT_PRIORITY, NO_OS_DEPENDENCE, Apple, Sun
@ -1050,15 +1052,6 @@ NAMESPACE_END
# define CRYPTOPP_DEPRECATED(msg) # define CRYPTOPP_DEPRECATED(msg)
#endif #endif
// ************** Instrumentation ***************
// GCC does not support; see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=78204
#if (CRYPTOPP_LLVM_CLANG_VERSION >= 30700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70000)
# define CRYPTOPP_NO_SANITIZE(x) __attribute__((no_sanitize(x)))
#else
# define CRYPTOPP_NO_SANITIZE(x)
#endif
// ***************** C++11 related ******************** // ***************** C++11 related ********************
// Visual Studio began at VS2010, http://msdn.microsoft.com/en-us/library/hh567368%28v=vs.110%29.aspx // Visual Studio began at VS2010, http://msdn.microsoft.com/en-us/library/hh567368%28v=vs.110%29.aspx

View File

@ -1069,6 +1069,10 @@ public:
#pragma init_seg(".CRT$XCU") #pragma init_seg(".CRT$XCU")
const InitCpu s_init; const InitCpu s_init;
#pragma warning(default: 4075) #pragma warning(default: 4075)
#elif HAVE_XLC_INIT_PRIORITY
// XLC needs constant, not a define
#pragma priority(270)
const InitCpu s_init;
#else #else
const InitCpu s_init; const InitCpu s_init;
#endif #endif

View File

@ -4826,6 +4826,13 @@ public:
const Integer g_one(1L); const Integer g_one(1L);
const Integer g_two(2L); const Integer g_two(2L);
#pragma warning(default: 4075) #pragma warning(default: 4075)
#elif HAVE_XLC_INIT_PRIORITY
// XLC needs constant, not a define
#pragma priority(280)
const InitInteger s_init;
const Integer g_zero(0L);
const Integer g_one(1L);
const Integer g_two(2L);
#else #else
const InitInteger s_init; const InitInteger s_init;
#endif #endif
@ -4834,7 +4841,7 @@ public:
const Integer &Integer::Zero() const Integer &Integer::Zero()
{ {
#if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY)
return g_zero; return g_zero;
#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) #elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT)
static const Integer s_zero(0L); static const Integer s_zero(0L);
@ -4846,7 +4853,7 @@ const Integer &Integer::Zero()
const Integer &Integer::One() const Integer &Integer::One()
{ {
#if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY)
return g_one; return g_one;
#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) #elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT)
static const Integer s_one(1L); static const Integer s_one(1L);
@ -4858,7 +4865,7 @@ const Integer &Integer::One()
const Integer &Integer::Two() const Integer &Integer::Two()
{ {
#if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY)
return g_two; return g_two;
#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) #elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT)
static const Integer s_two(2L); static const Integer s_two(2L);

View File

@ -51,8 +51,6 @@ bool CPU_ProbePower9()
{ {
#if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES) #if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES)
return false; return false;
#elif defined(__xlC__) && defined(__linux__)
return false;
#elif defined(CRYPTOPP_POWER9_AVAILABLE) #elif defined(CRYPTOPP_POWER9_AVAILABLE)
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY) # if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
// longjmp and clobber warnings. Volatile is required. // longjmp and clobber warnings. Volatile is required.
@ -100,8 +98,6 @@ bool CPU_ProbeDARN()
{ {
#if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES) #if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES)
return false; return false;
#elif defined(__xlC__) && defined(__linux__)
return false;
#else #else
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY) # if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
// longjmp and clobber warnings. Volatile is required. // longjmp and clobber warnings. Volatile is required.