[openssl-users] PerlASM for x64

Richard Levitte levitte at openssl.org
Sun Dec 23 20:08:15 UTC 2018


In message <f1a2ec24-b3c4-b980-3fae-9e9ab25c4e78 at gmail.com> on Fri, 21 Dec 2018 15:45:23 +0100, Gisle Vanem <gisle.vanem at gmail.com> said:

> I'm trying to understand how the generation of ASM-files
> are done on x64. (I have no problems on x86).
> 
> With the generated Nmake makefile from a
>   perl Configure VC-WIN64A-ONECORE
> 
> when doing a:
>   nmake crypto\aes\libcrypto-lib-aesni-x86_64.obj
> 
> seems to do this:
>   set ASM=nasm
>   "f:/util/StrawberryPerl/perl/bin/perl.exe"
>   "crypto\aes\asm\aesni-x86_64.pl" auto crypto\aes\aesni-x86_64.asm
>   nasm -Ox -f win64 -DNEAR -g -o
>   crypto\aes\libcrypto-lib-aesni-x86_64.obj
>   "crypto\aes\aesni-x86_64.asm"
> 
> Except for some warnings, nasm generates a valid
> libcrypto-lib-aesni-x86_64.obj.
> 
> BUT, doing the same on the cmd-line:
>   set ASM=nasm
>   f:\util\StrawberryPerl\perl\bin\perl crypto\aes\asm\aesni-x86_64.pl
>   auto tmp-file.s
> 
> Generates a totally invalid 'tmp-file.s' file:
> 
> --- tmp-file.s                  2018-12-21 13:12:19
> +++ crypto/aes/aesni-x86_64.asm 2018-12-21 13:11:47
> @@ -1,4432 +1,5051 @@
> -.text
> +default        rel
> +%define XMMWORD
> +%define YMMWORD
> +%define ZMMWORD
> +section        .text code align=64
> 
> -.globl aesni_encrypt
> -.type  aesni_encrypt, at function
> -.align 16
> +EXTERN OPENSSL_ia32cap_P
> +global aesni_encrypt
> +
> 
> What is going on here? Some other exported env-var playing
> tricks?
> 
> I experimented some more. I figured the "auto" does not work.
> But this works:
>   perl crypto\aes\asm\aesni-x86_64.pl nasm > tmp-file.s
>   diff tmp-file.s crypto\aes\aesni-x86_64.asm
> 
> No diffs.
> 
> Why does the the generation of .asm-files be so damn hard to
> figure out? Some cmd-line help to show what "auto" does would
> be nice.

The "auto" flavor takes note of the output file extension.  .asm vs .s
in this case.

Cheers,
Richard

-- 
Richard Levitte         levitte at openssl.org
OpenSSL Project         http://www.openssl.org/~levitte/


More information about the openssl-users mailing list