Hi.  I'm trying to get cryptopp562 built with the AES-NI instructions used 
in rijndael.cpp on FreeBSD with either the 3.3 version of clang that comes 
with FreeBSD 10.0 or with the 3.4 version built from ports but even just 
getting the rijndael.cpp asm to compile with clang's internal assembler is 
a problem.

The file compiles, and the entire test suite passes, when asm is disabled. 
 And a disabled asm is the default for now when CXX points to clang because 
the GNUmakefile tries to read the assembler version by passing -v to it, 
but the clang internal assembler doesn't accept -v as an option.  So all 
three version checks fail, and the three variables are set to 0.

By adding -no-integrated-as to CXXFLAGS and also to the compiler lines that 
test for the version number with EGREP, I'm able to get GAS210_OR_LATER and 
GAS217_OR_LATER set to 1, but GAS219_OR_LATER is still 0 because the 
version info returned by the external linker is

GNU assembler version 2.17.50 [FreeBSD] 2007-07-03 (x86_64-unknown-freebsd) 
> using BFD version 2.17.50 [FreeBSD] 2007-07-03
>

 
and it is this last version check that should pass, else AESNI is disabled 
as I guess 2.19 of the assembler is needed.

So I don't have an external assembler new enough.  But I thought the clang 
internal assembler should be new enough, so I hardwired the version test 
variables to be true and let clang use its internal assembler.  But the asm 
code that is generated doesn't parse:

$ CXX=clang++34 CC=clang34 gmake rijndael.o
>
> clang++34 -DNDEBUG -g -O2  -ferror-limit=1 -pipe -Wno-tautological-compare 
> -c rijndael.cpp
>
> *rijndael.cpp:639:2: **error: **unknown token in expression*
>
>         ASL(0)
>
> *        ^*
>
> *./cpu.h:224:17: note: *expanded from macro 'ASL'
>
>         #define ASL(x) GNU_ASL(x)
>
> *                       ^*
>
> *./cpu.h:218:26: note: *expanded from macro 'GNU_ASL'
>
>         #define GNU_ASL(x) "\n" #x ":"
>
> *                                ^*
>
> *<scratch space>:404:2: note: *expanded from here
>
> "0"
>
> * ^*
>
> *<inline asm>:2:84: note: *instantiated into assembly here
>
> 0:movdqa xmm0, [rax+rsi];movdqa [(r8+0)+rsi], xmm0;add rsi, 16;cmp rsi, 
> 16*12;jl 0b;movdqa xmm4, ...
>
> *                                                                         
>           ^*
>
> *fatal error: **too many errors emitted, stopping now [-ferror-limit=]*
>
> 2 errors generated.
>
> gmake: *** [rijndael.o] Error 1
>
Should the assembly be legal for clang? (The last arrow points to the 
semicolon after 'jl 0b' in the actual output.)

Thanks,
-Frank

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to