summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ.W. Jagersma <jwjagersma@gmail.com>2022-11-22 19:20:53 +0100
committerPauli <pauli@openssl.org>2023-03-01 09:11:30 +1100
commitcdcb9c76bddc36ace7d06bf0a97935f2ff1b67a8 (patch)
treef2073989ad7c3ef89201897445d36c24ef326f82
parentb175e870e97c5b9153fa3bd18375402673fdddcf (diff)
Disable atomic refcounts with no-threads
This is needed for building with '-march=i386 no-threads', on platforms where libatomic is not available (djgpp, specifically). The implementation now falls back to 'CRYPTO_atomic_add()', which performs plain lock-free addition in a 'no-threads' build. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19751) (cherry picked from commit b484c6268ce38ccbc1bf5ee95bbd36f76fba994f)
-rw-r--r--include/internal/refcount.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/internal/refcount.h b/include/internal/refcount.h
index 7412d62f56..8674ab3664 100644
--- a/include/internal/refcount.h
+++ b/include/internal/refcount.h
@@ -13,7 +13,7 @@
# include <openssl/e_os2.h>
# include <openssl/trace.h>
-# ifndef OPENSSL_DEV_NO_ATOMICS
+# if defined(OPENSSL_THREADS) && !defined(OPENSSL_DEV_NO_ATOMICS)
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
&& !defined(__STDC_NO_ATOMICS__)
# include <stdatomic.h>