Fix race for X509 store found by thread sanitizer
[openssl.git] / crypto / aes / asm / aesni-sha256-x86_64.pl
index 8f230855c3f19776eb96831643fa05a4781cf8d1..5c8bb0fbccc6009b4efe58b64c33916d62da4dfb 100644 (file)
@@ -1,5 +1,5 @@
 #! /usr/bin/env perl
-# Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2013-2020 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the Apache License 2.0 (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
@@ -71,7 +71,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
        $avx = ($1>=10) + ($1>=12);
 }
 
-if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) {
+if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) {
        $avx = ($2>=3.0) + ($2>3.0);
 }
 
@@ -168,6 +168,7 @@ $code.=<<___;
 .cfi_endproc
 .size  $func,.-$func
 
+.section .rodata align=64
 .align 64
 .type  $TABLE,\@object
 $TABLE:
@@ -210,6 +211,7 @@ $TABLE:
        .long   0,0,0,0,   0,0,0,0
        .asciz  "AESNI-CBC+SHA256 stitch for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
 .align 64
+.previous
 ___
 
 ######################################################################
@@ -1801,4 +1803,4 @@ sub rex {
 $code =~ s/\`([^\`]*)\`/eval $1/gem;
 $code =~ s/\b(sha256[^\s]*)\s+(.*)/sha256op38($1,$2)/gem;
 print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";