Skip to content

Commit

Permalink
Fix breakage on arm64_32 platforms
Browse files Browse the repository at this point in the history
We just avoid the special handling needed for Apple M1.

Fixes openssl#26135

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from openssl#26145)
  • Loading branch information
t8m committed Dec 13, 2024
1 parent ffa1cf6 commit 79c9cbb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crypto/threads_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,16 @@ typedef struct rcu_cb_item *prcu_cb_item;

# if defined(__GNUC__) && defined(__ATOMIC_ACQUIRE) && !defined(BROKEN_CLANG_ATOMICS) \
&& !defined(USE_ATOMIC_FALLBACKS)
# if defined(__APPLE__) && defined(__clang__) && defined(__aarch64__)
# if defined(__APPLE__) && defined(__clang__) && defined(__aarch64__) && defined(__LP64__)
/*
* For pointers, Apple M1 virtualized cpu seems to have some problem using the
* ldapr instruction (see https://github.com/openssl/openssl/pull/23974)
* When using the native apple clang compiler, this instruction is emitted for
* atomic loads, which is bad. So, if
* 1) We are building on a target that defines __APPLE__ AND
* 2) We are building on a target using clang (__clang__) AND
* 3) We are building for an M1 processor (__aarch64__)
* 3) We are building for an M1 processor (__aarch64__) AND
* 4) We are building with 64 bit pointers
* Then we should not use __atomic_load_n and instead implement our own
* function to issue the ldar instruction instead, which produces the proper
* sequencing guarantees
Expand Down

0 comments on commit 79c9cbb

Please sign in to comment.