diff options
author | kinichiro <kinichiro.inoguchi@gmail.com> | 2020-07-15 01:25:34 +0900 |
---|---|---|
committer | kinichiro <kinichiro.inoguchi@gmail.com> | 2020-07-21 22:13:39 +0900 |
commit | 7423582705d6c9d71e1caf8a1f892e8995bcd63e (patch) | |
tree | 399980fb1d1624c5970d14a29fbec9c086d9acc0 | |
parent | fa26b5359b76570b471a1dc3b8ed5dfbd240520c (diff) | |
download | portable-7423582705d6c9d71e1caf8a1f892e8995bcd63e.tar.gz portable-7423582705d6c9d71e1caf8a1f892e8995bcd63e.tar.bz2 portable-7423582705d6c9d71e1caf8a1f892e8995bcd63e.zip |
Get __STRICT_ALIGNMENT from machine/endian.h
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | include/compat/machine/endian.h | 10 |
2 files changed, 10 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac index 888ca19..acfe307 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -75,18 +75,6 @@ AC_ARG_ENABLE([tests], | |||
75 | [enable_tests="yes"]) | 75 | [enable_tests="yes"]) |
76 | AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = xyes]) | 76 | AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = xyes]) |
77 | 77 | ||
78 | # Add CPU-specific alignment flags | ||
79 | old_cflags=$CFLAGS | ||
80 | CFLAGS="$CFLAGS -I$srcdir/include" | ||
81 | AC_MSG_CHECKING([if BSWAP4 builds without __STRICT_ALIGNMENT]) | ||
82 | AC_TRY_COMPILE([#include "$srcdir/crypto/modes/modes_lcl.h"], | ||
83 | [int a = 0; BSWAP4(a);], | ||
84 | AC_MSG_RESULT([yes]) | ||
85 | BSWAP4=yes, | ||
86 | AC_MSG_RESULT([no]) | ||
87 | BSWAP4=no) | ||
88 | CFLAGS="$old_cflags" | ||
89 | |||
90 | AS_CASE([$host_cpu], | 78 | AS_CASE([$host_cpu], |
91 | [*sparc*], [CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"], | 79 | [*sparc*], [CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"], |
92 | [*arm*], [host_cpu=arm], | 80 | [*arm*], [host_cpu=arm], |
@@ -94,7 +82,6 @@ AS_CASE([$host_cpu], | |||
94 | [i?86], [HOSTARCH=intel], | 82 | [i?86], [HOSTARCH=intel], |
95 | [x86_64], [HOSTARCH=intel] | 83 | [x86_64], [HOSTARCH=intel] |
96 | ) | 84 | ) |
97 | AS_IF([test "x$BSWAP4" = "xyes" -a "$host_cpu" = "arm" ],,CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT") | ||
98 | AM_CONDITIONAL([HOST_CPU_IS_INTEL], [test "x$HOSTARCH" = "xintel"]) | 85 | AM_CONDITIONAL([HOST_CPU_IS_INTEL], [test "x$HOSTARCH" = "xintel"]) |
99 | 86 | ||
100 | AC_MSG_CHECKING([if .gnu.warning accepts long strings]) | 87 | AC_MSG_CHECKING([if .gnu.warning accepts long strings]) |
diff --git a/include/compat/machine/endian.h b/include/compat/machine/endian.h index 43dac8f..54267a8 100644 --- a/include/compat/machine/endian.h +++ b/include/compat/machine/endian.h | |||
@@ -37,4 +37,14 @@ | |||
37 | 37 | ||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #ifndef __STRICT_ALIGNMENT | ||
41 | #define __STRICT_ALIGNMENT | ||
42 | #if defined(__i386) || defined(__i386__) || \ | ||
43 | defined(__x86_64) || defined(__x86_64__) || \ | ||
44 | defined(__aarch64__) || \ | ||
45 | ((defined(__arm__) || defined(__arm)) && __ARM_ARCH >= 6) | ||
46 | #undef __STRICT_ALIGNMENT | ||
47 | #endif | ||
48 | #endif | ||
49 | |||
40 | #endif | 50 | #endif |