DORMANTno replies

[PATCH] crypto: jitterentropy: Add automatically deoptimization.

From: dm9pZCAq <hidden>
Date: 2021-02-22 23:27:06
Subsystem: crypto api, the rest · Maintainers: Herbert Xu, "David S. Miller", Linus Torvalds

This is needed to compile with `CFLAGS_KERNEL=-O2`.

Due to `CFLAGS_jitterentropy.o = -O0` comes after `CFLAGS_KERNEL`
the code is still optimized and gives an error.
This patch deoptimizes the code despite any `CFLAGS`.

Signed-off-by: dm9pZCAq <redacted>
---
 crypto/jitterentropy.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/crypto/jitterentropy.c b/crypto/jitterentropy.c
index 6e147c43fc18..7d84bc10626f 100644
--- a/crypto/jitterentropy.c
+++ b/crypto/jitterentropy.c
@@ -50,7 +50,14 @@
  * version 2.2.0 provided at https://www.chronox.de/jent.html
  */
 
-#ifdef __OPTIMIZE__
+
+#ifdef __clang__
+ #pragma clang optimize off
+#else
+ #pragma GCC optimize ("O0")
+#endif
+
+#if !defined(__clang__) && defined(__OPTIMIZE__)
  #error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy.c."
 #endif
 
-- 
2.30.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help