Fix SIGILL on Linux when using XLC for DARN
parent
8fba667250
commit
fd5e35fcb6
|
|
@ -6,6 +6,14 @@
|
|||
// additional CXXFLAGS are required to enable the appropriate
|
||||
// instructions sets in some build configurations.
|
||||
|
||||
// The XLC on Linux case is a special case because code generated by XLC on
|
||||
// Linux claims the generator is available when it is not. LLVM Clang does
|
||||
// not have the trouble. The problem seems to be related to the signal
|
||||
// handler. It looks like first call to CPU_ProbePower9() and CPU_ProbeDARN()
|
||||
// are correct, but the call to HasDARN() returns the wrong result. If I am
|
||||
// parsing things correctly while stepping the code and disassembly, it looks
|
||||
// like the result of the inline asm is being removed.
|
||||
|
||||
#include "pch.h"
|
||||
#include "config.h"
|
||||
|
||||
|
|
@ -43,6 +51,8 @@ bool CPU_ProbePower9()
|
|||
{
|
||||
#if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES)
|
||||
return false;
|
||||
#elif defined(__xlC__) && defined(__linux__)
|
||||
return false;
|
||||
#elif defined(CRYPTOPP_POWER9_AVAILABLE)
|
||||
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
|
||||
// longjmp and clobber warnings. Volatile is required.
|
||||
|
|
@ -80,15 +90,18 @@ bool CPU_ProbePower9()
|
|||
#endif // _ARCH_PWR9
|
||||
}
|
||||
|
||||
// The DARN probe is not guarded with a preprocessor macro at the moment. We don't
|
||||
// use CRYPTOPP_POWER9_AVAILABLE because old compilers, like GCC 4.8 on CentOS 7,
|
||||
// will report NO even though we can produce the random numbers. Other Power9
|
||||
// implementations which use builtins will use the preprocessor macro guard. This
|
||||
// strategy also gets into a situation where Power9 is not available but DARN is.
|
||||
// The DARN probe is not guarded with a preprocessor macro at the moment. We
|
||||
// don't use CRYPTOPP_POWER9_AVAILABLE because old compilers, like GCC 4.8 on
|
||||
// CentOS 7, will report NO even though we can produce the random numbers.
|
||||
// Other Power9 implementations which use builtins will use the preprocessor
|
||||
// macro guard. This strategy also gets into a situation where Power9 is not
|
||||
// available but DARN is.
|
||||
bool CPU_ProbeDARN()
|
||||
{
|
||||
#if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES)
|
||||
return false;
|
||||
#elif defined(__xlC__) && defined(__linux__)
|
||||
return false;
|
||||
#else
|
||||
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
|
||||
// longjmp and clobber warnings. Volatile is required.
|
||||
|
|
|
|||
Loading…
Reference in New Issue