Skip to content

Commit 9f0dc02

Browse files
committed
Add check for ARM to set WOLFSS_USE_ALIGN
1 parent 00fe73b commit 9f0dc02

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

wolfssl/wolfcrypt/types.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,19 @@ WOLFSSL_API word32 CheckRunTimeSettings(void);
17061706
#endif /* WOLFSSL_AESNI || WOLFSSL_ARMASM || USE_INTEL_SPEEDUP || \
17071707
* WOLFSSL_AFALG_XILINX */
17081708

1709+
/* ARM C-only builds: if the toolchain reports that the target does NOT
1710+
* support unaligned access, force the alignment-safe code paths. This
1711+
* catches Cortex-M (ARMv6-M, and ARMv7-M/v8-M built with
1712+
* -mno-unaligned-access) without penalizing unaligned-capable cores
1713+
* such as Cortex-A and AArch64. __ARM_FEATURE_UNALIGNED is defined by
1714+
* GCC, Clang and armclang per the ARM ACLE when unaligned access is
1715+
* available. */
1716+
#if defined(__arm__) && !defined(__ARM_FEATURE_UNALIGNED)
1717+
#ifndef WOLFSSL_USE_ALIGN
1718+
#define WOLFSSL_USE_ALIGN
1719+
#endif
1720+
#endif
1721+
17091722
/* Helpers for memory alignment */
17101723
#ifndef XALIGNED
17111724
#if defined(__GNUC__) || defined(__llvm__) || \

0 commit comments

Comments
 (0)