diff options
author | Vitaly Chikunov <vt@altlinux.org> | 2020-09-18 01:47:27 +0300 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@users.noreply.github.com> | 2020-09-18 16:25:44 +0300 |
commit | d2810d23a9f30ae885f9bf0783f0847a12972ff3 (patch) | |
tree | a151af3246fe4721e0a8ddf48f3c72492890e9fb | |
parent | f1f47c6c7710291157aa863768d9048aaeaa9530 (diff) | |
download | gost-engine-d2810d23a9f30ae885f9bf0783f0847a12972ff3.zip gost-engine-d2810d23a9f30ae885f9bf0783f0847a12972ff3.tar.gz gost-engine-d2810d23a9f30ae885f9bf0783f0847a12972ff3.tar.bz2 |
Provide cmake test if alignment requirement is strict
This is based on AX_CHECK_ALIGNED_ACCESS_REQUIRED from autoconf-archive.
Note, that on some arches unaligned access behavior could be changed at
runtime via prctl(1). Also, unaligned memory access is still slower (and
very slow on some arches) even if it's not strictly required.
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d4d65b..3b8891d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,18 @@ if (ADDCARRY_U64) add_definitions(-DHAVE_ADDCARRY_U64) endif() +check_c_source_runs(" + int main(void) { + char buf[16] = { 0, 1, 2 }; + int *p = buf + 1; + int *q = buf + 2; + return (*p == *q); + } + " RELAXED_ALIGNMENT) +if (NOT RELAXED_ALIGNMENT) + add_definitions(-DSTRICT_ALIGNMENT) +endif() + set(BIN_DIRECTORY bin) # Same soversion as OpenSSL |