Unfortunately, adding those flags alone isn't enough to get Crypto++ to use the AES-NI intrinsics when Clang is used as the compiler. Mainly, the macro checking for (CRYPTOPP_GCC_VERSION >= 40400 || _MSC_FULL_VER >= 150030729 || __INTEL_COMPILER >= 1110) fails, so CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE fails to get activated. Hacking around that is easy enough, but compilation ends up dieing a terrible death like what I'm including at the end of this email. Thus, I think I give up on clang++ for this library.
Regards,
Gabe
clang++ -DNDEBUG -O2 -gdwarf-2 -maes -mpclmul -pipe -c camellia.cpp
In file included from camellia.cpp:16:
./cpu.h:33:64: warning: unknown attribute '__artificial__' ignored [-Wunknown-attributes]
__inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
^
./cpu.h:40:68: warning: unknown attribute '__artificial__' ignored [-Wunknown-attributes]
__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
^
./cpu.h:37:7: error: invalid operand for inline asm constraint 'i'
asm ("pextrd %2, %1, %0" : "=rm"(r) : "x"(a), "i"(i));
^
./cpu.h:43:7: error: invalid operand for inline asm constraint 'i'
asm ("pinsrd %2, %1, %0" : "+x"(a) : "rm"(b), "i"(i));
^
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name camellia.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-feature +aes -target-feature +pclmul -target-linker-version 242 -gdwarf-2 -dwarf-column-info -coverage-file /Users/ghackebeil/Courses/AppliedCrypto_CS519_W2015/DynamicSearchableEncryption/DSE_cpp/Thirdparty/cryptopp562/camellia.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0 -D NDEBUG -stdlib=libc++ -O2 -fdeprecated-macro -fdebug-compilation-dir /Users/ghackebeil/Courses/AppliedCrypto_CS519_W2015/DynamicSearchableEncryption/DSE_cpp/Thirdparty/cryptopp562 -ferror-limit 19 -fmessage-length 130 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o camellia.o -x c++ camellia.cpp
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'camellia.cpp'.
4. Running pass 'Simple Register Coalescing' on function '@_Z16_mm_insert_epi32Dv2_xii'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/p5/4dj9d59x27v7_5_ddgn8r8zm0000gn/T/camellia-031900.cpp
clang: note: diagnostic msg: /var/folders/p5/4dj9d59x27v7_5_ddgn8r8zm0000gn/T/camellia-031900.sh
clang: note: diagnostic msg:
********************
make: *** [camellia.o] Error 254