diff --git a/library/aesce.c b/library/aesce.c
index 893ed173c..babd9a64b 100644
--- a/library/aesce.c
+++ b/library/aesce.c
@@ -66,9 +66,11 @@
 #   endif
 #endif
 
+#include <arm_neon.h>
+
 #if !defined(__ARM_FEATURE_AES) || defined(MBEDTLS_ENABLE_ARM_CRYPTO_EXTENSIONS_COMPILER_FLAG)
 #   if defined(__clang__)
-#       pragma clang attribute push (__attribute__((target("aes"))), apply_to=function)
+#       pragma clang attribute push (__attribute__((target("crypto,aes"))), apply_to=function)
 #       define MBEDTLS_POP_TARGET_PRAGMA
 #   elif defined(__GNUC__)
 #       pragma GCC push_options
@@ -79,8 +81,6 @@
 #   endif
 #endif /* !__ARM_FEATURE_AES || MBEDTLS_ENABLE_ARM_CRYPTO_EXTENSIONS_COMPILER_FLAG */
 
-#include <arm_neon.h>
-
 #if defined(__linux__)
 #include <asm/hwcap.h>
 #include <sys/auxv.h>
diff --git a/library/sha256.c b/library/sha256.c
index 169229c88..ae1b35ca5 100644
--- a/library/sha256.c
+++ b/library/sha256.c
@@ -57,15 +57,18 @@
 #include "mbedtls/platform.h"
 
 #if defined(__aarch64__)
+
 #  if defined(MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT) || \
     defined(MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY)
+
 /* *INDENT-OFF* */
+#    include <arm_neon.h>
 #    if !defined(__ARM_FEATURE_CRYPTO) || defined(MBEDTLS_ENABLE_ARM_CRYPTO_EXTENSIONS_COMPILER_FLAG)
 #      if defined(__clang__)
 #        if __clang_major__ < 4
 #          error "A more recent Clang is required for MBEDTLS_SHA256_USE_A64_CRYPTO_*"
 #        endif
-#        pragma clang attribute push (__attribute__((target("crypto"))), apply_to=function)
+#        pragma clang attribute push (__attribute__((target("crypto,sha2"))), apply_to=function)
 #        define MBEDTLS_POP_TARGET_PRAGMA
 #      elif defined(__GNUC__)
          /* FIXME: GCC 5 claims to support Armv8 Crypto Extensions, but some
@@ -83,7 +86,7 @@
 #      endif
 #    endif
 /* *INDENT-ON* */
-#    include <arm_neon.h>
+
 #  endif
 #  if defined(MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT)
 #    if defined(__unix__)
diff --git a/library/sha512.c b/library/sha512.c
index ff92a1b81..5174b657e 100644
--- a/library/sha512.c
+++ b/library/sha512.c
@@ -60,6 +60,7 @@
 #  if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT) || \
     defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY)
 /* *INDENT-OFF* */
+#    include <arm_neon.h>
 /*
  * Best performance comes from most recent compilers, with intrinsics and -O3.
  * Must compile with -march=armv8.2-a+sha3, but we can't detect armv8.2-a, and
@@ -96,7 +97,6 @@
 #      endif
 #    endif
 /* *INDENT-ON* */
-#    include <arm_neon.h>
 #  endif
 #  if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT)
 #    if defined(__unix__)