For all assembler scripts where it matters, recognise clang > 9.x
[openssl.git] / crypto / aes / asm / aesni-sha1-x86_64.pl
index eb8364feb068086b7bde755724da78df89e923d0..6bf295565b9e37101358149c39d64c8cc8e32ccc 100644 (file)
 # (**) Execution is fully dominated by integer code sequence and
 #      SIMD still hardly shows [in single-process benchmark;-]
 
-$flavour = shift;
-$output  = shift;
-if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
+# $output is the last argument if it looks like a file (it has an extension)
+# $flavour is the first argument if it doesn't look like a file
+$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
+$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
 
 $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
 
@@ -108,13 +109,14 @@ $avx=1 if (!$avx && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
 $avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
           `ml64 2>&1` =~ /Version ([0-9]+)\./ &&
           $1>=10);
-$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/ && $2>=3.0);
+$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/ && $2>=3.0);
 
 $shaext=1;     ### set to zero if compiling for 1.0.1
 
 $stitched_decrypt=0;
 
-open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\"";
+open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
+    or die "can't call $xlate: $!";
 *STDOUT=*OUT;
 
 # void aesni_cbc_sha1_enc(const void *inp,
@@ -133,6 +135,7 @@ $code.=<<___;
 .type  aesni_cbc_sha1_enc,\@abi-omnipotent
 .align 32
 aesni_cbc_sha1_enc:
+.cfi_startproc
        # caller should check for SSSE3 and AES-NI bits
        mov     OPENSSL_ia32cap_P+0(%rip),%r10d
        mov     OPENSSL_ia32cap_P+4(%rip),%r11
@@ -151,6 +154,7 @@ ___
 $code.=<<___;
        jmp     aesni_cbc_sha1_enc_ssse3
        ret
+.cfi_endproc
 .size  aesni_cbc_sha1_enc,.-aesni_cbc_sha1_enc
 ___
 
@@ -840,6 +844,7 @@ $code.=<<___;
 .type  aesni256_cbc_sha1_dec,\@abi-omnipotent
 .align 32
 aesni256_cbc_sha1_dec:
+.cfi_startproc
        # caller should check for SSSE3 and AES-NI bits
        mov     OPENSSL_ia32cap_P+0(%rip),%r10d
        mov     OPENSSL_ia32cap_P+4(%rip),%r11d
@@ -854,6 +859,7 @@ ___
 $code.=<<___;
        jmp     aesni256_cbc_sha1_dec_ssse3
        ret
+.cfi_endproc
 .size  aesni256_cbc_sha1_dec,.-aesni256_cbc_sha1_dec
 
 .type  aesni256_cbc_sha1_dec_ssse3,\@function,6
@@ -1760,6 +1766,7 @@ $code.=<<___;
 .type  aesni_cbc_sha1_enc_shaext,\@function,6
 .align 32
 aesni_cbc_sha1_enc_shaext:
+.cfi_startproc
        mov     `($win64?56:8)`(%rsp),$inp      # load 7th argument
 ___
 $code.=<<___ if ($win64);
@@ -1911,6 +1918,7 @@ $code.=<<___ if ($win64);
 ___
 $code.=<<___;
        ret
+.cfi_endproc
 .size  aesni_cbc_sha1_enc_shaext,.-aesni_cbc_sha1_enc_shaext
 ___
                                                }}}