]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Disable atomic refcounts with no-threads
authorJ.W. Jagersma <jwjagersma@gmail.com>
Tue, 22 Nov 2022 18:20:53 +0000 (19:20 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 25 Nov 2022 09:29:44 +0000 (10:29 +0100)
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)

include/internal/refcount.h

index 7412d62f56fda607449acaa21683e197398d3939..8674ab3664e1878eff2d68cce856babeb9f18301 100644 (file)
@@ -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>