summaryrefslogtreecommitdiff
path: root/cpu.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2022-02-16 05:37:28 -0500
committerJeffrey Walton <noloader@gmail.com>2022-02-16 05:37:28 -0500
commit1f258c72d2fab0477d2494c9850bd8becfcc1936 (patch)
tree083578e39f9f42cf0d2f70fa0620924dacb84bf1 /cpu.cpp
parent647fe861cfd249f4c91888ea051e9796486a6d70 (diff)
downloadcryptopp-git-1f258c72d2fab0477d2494c9850bd8becfcc1936.tar.gz
Fix missing CPU_Probe functions when CRYPTOPP_DISABLE_ASM
Diffstat (limited to 'cpu.cpp')
-rw-r--r--cpu.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/cpu.cpp b/cpu.cpp
index 0e8cd7df..f10623bb 100644
--- a/cpu.cpp
+++ b/cpu.cpp
@@ -1130,6 +1130,8 @@ inline bool CPU_QuerySM4()
void DetectArmFeatures()
{
+#ifndef CRYPTOPP_DISABLE_ASM
+
// The CPU_ProbeXXX's return false for OSes which
// can't tolerate SIGILL-based probes
g_hasARMv7 = CPU_QueryARMv7() || CPU_ProbeARMv7();
@@ -1155,6 +1157,8 @@ void DetectArmFeatures()
if (g_cacheLineSize == 0)
g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
+#endif // CRYPTOPP_DISABLE_ASM
+
*const_cast<volatile bool*>(&g_ArmDetectionDone) = true;
}
@@ -1373,15 +1377,16 @@ inline bool CPU_QueryDARN()
return false;
}
-void DetectPowerpcFeatures()
+void DetectPowerPcFeatures()
{
- // GCC 10 is giving us trouble in CPU_ProbePower9() and
- // CPU_ProbeDARN(). GCC is generating POWER9 instructions
- // on POWER8 for ppc_power9.cpp. The compiler idiots did
- // not think through the consequences of requiring us to
- // use -mcpu=power9 to unlock the ISA. Epic fail.
+ // GCC 10 is giving us trouble in CPU_ProbePower9() and CPU_ProbeDARN().
+ // GCC is generating POWER9 instructions on POWER8 for ppc_power9.cpp.
+ // The compiler idiots did not think through the consequences of
+ // requiring us to use -mcpu=power9 to unlock the ISA. Epic fail.
// https://github.com/weidai11/cryptopp/issues/986
+#ifndef CRYPTOPP_DISABLE_ASM
+
// The CPU_ProbeXXX's return false for OSes which
// can't tolerate SIGILL-based probes, like Apple
g_hasAltivec = CPU_QueryAltivec() || CPU_ProbeAltivec();
@@ -1410,6 +1415,8 @@ void DetectPowerpcFeatures()
if (g_cacheLineSize == 0)
g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
+#endif // CRYPTOPP_DISABLE_ASM
+
*const_cast<volatile bool*>(&g_PowerpcDetectionDone) = true;
}
@@ -1430,7 +1437,7 @@ public:
#elif CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8
CryptoPP::DetectArmFeatures();
#elif CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64
- CryptoPP::DetectPowerpcFeatures();
+ CryptoPP::DetectPowerPcFeatures();
#endif
}
};