Revert "Work around a NASM bug" This reverts commit abb9af83bc223eca0ffffce246ed551f2fcd11e1. NASM 2.15.04 is six years old now. Hopefully we can just assume it at this point. Change-Id: I202387ad772db089c74d476ce2e066dad7c92bb2 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/100468 Reviewed-by: Lily Chen <chlily@google.com> Commit-Queue: Lily Chen <chlily@google.com> Auto-Submit: David Benjamin <davidben@google.com> Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl index affebf1..e663561 100755 --- a/crypto/perlasm/x86_64-xlate.pl +++ b/crypto/perlasm/x86_64-xlate.pl
@@ -1062,27 +1062,6 @@ } } { package directive; # pick up directives, which start with . - my %sections; - sub nasm_section { - my ($name, $qualifiers) = @_; - my $ret = "section\t$name"; - if (exists $sections{$name}) { - # Work around https://bugzilla.nasm.us/show_bug.cgi?id=3392701. Only - # emit section qualifiers the first time a section is referenced. - # For all subsequent references, require the qualifiers match and - # omit them. - # - # See also https://crbug.com/1422018 and b/270643835. - my $old = $sections{$name}; - die "Inconsistent qualifiers: $qualifiers vs $old" if ($qualifiers ne "" && $qualifiers ne $old); - } else { - $sections{$name} = $qualifiers; - if ($qualifiers ne "") { - $ret .= " $qualifiers"; - } - } - return $ret; - } sub re { my ($class, $line) = @_; my $self = {}; @@ -1191,7 +1170,7 @@ SWITCH: for ($dir) { /\.text/ && do { my $v=undef; if ($nasm) { - $v=nasm_section(".text", "code align=64")."\n"; + $v="section .text code align=64\n"; } else { $v="$current_segment\tENDS\n" if ($current_segment); $current_segment = ".text\$"; @@ -1204,7 +1183,7 @@ }; /\.data/ && do { my $v=undef; if ($nasm) { - $v=nasm_section(".data", "data align=8")."\n"; + $v="section .data data align=8\n"; } else { $v="$current_segment\tENDS\n" if ($current_segment); $current_segment = "_DATA"; @@ -1218,14 +1197,13 @@ $$line = ".CRT\$XCU" if ($$line eq ".init"); $$line = ".rdata" if ($$line eq ".rodata"); if ($nasm) { - my $qualifiers = ""; + $v="section $$line"; if ($$line=~/\.([prx])data/) { - $qualifiers = "rdata align="; - $qualifiers .= $1 eq "p"? 4 : 8; + $v.=" rdata align="; + $v.=$1 eq "p"? 4 : 8; } elsif ($$line=~/\.CRT\$/i) { - $qualifiers = "rdata align=8"; + $v.=" rdata align=8"; } - $v = nasm_section($$line, $qualifiers); } else { $v="$current_segment\tENDS\n" if ($current_segment); $v.="$$line\tSEGMENT";
diff --git a/gen/bcm/aesni-gcm-x86_64-win.asm b/gen/bcm/aesni-gcm-x86_64-win.asm index a17d4f4..258862e 100644 --- a/gen/bcm/aesni-gcm-x86_64-win.asm +++ b/gen/bcm/aesni-gcm-x86_64-win.asm
@@ -967,7 +967,7 @@ DB 89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112 DB 114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 ALIGN 64 -section .text +section .text code align=64 section .pdata rdata align=4 ALIGN 4
diff --git a/gen/bcm/aesni-x86_64-win.asm b/gen/bcm/aesni-x86_64-win.asm index 7f55ea4..9a79ff0 100644 --- a/gen/bcm/aesni-x86_64-win.asm +++ b/gen/bcm/aesni-x86_64-win.asm
@@ -2499,7 +2499,7 @@ DB 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115 DB 115,108,46,111,114,103,62,0 ALIGN 64 -section .text +section .text code align=64 EXTERN __imp_RtlVirtualUnwind @@ -2695,7 +2695,7 @@ $L$SEH_info_cbc: DB 9,0,0,0 DD cbc_se_handler wrt ..imagebase -section .pdata +section .pdata rdata align=4 ALIGN 4 DD $L$SEH_begin_aes_hw_set_encrypt_key_base_1 wrt ..imagebase DD $L$SEH_end_aes_hw_set_encrypt_key_base_4 wrt ..imagebase @@ -2706,7 +2706,7 @@ DD $L$SEH_info_aes_hw_set_encrypt_key_alt_0 wrt ..imagebase -section .xdata +section .xdata rdata align=8 ALIGN 4 $L$SEH_info_aes_hw_set_encrypt_key_base_0: DB 1 ; version 1, no flags
diff --git a/gen/bcm/ghash-ssse3-x86_64-win.asm b/gen/bcm/ghash-ssse3-x86_64-win.asm index 4794beb..64faab6 100644 --- a/gen/bcm/ghash-ssse3-x86_64-win.asm +++ b/gen/bcm/ghash-ssse3-x86_64-win.asm
@@ -450,7 +450,7 @@ ; .Llow4_mask is an XMM mask which selects the low four bits of each byte. $L$low4_mask: DQ 0x0f0f0f0f0f0f0f0f,0x0f0f0f0f0f0f0f0f -section .text +section .text code align=64 section .pdata rdata align=4 ALIGN 4
diff --git a/gen/bcm/ghash-x86_64-win.asm b/gen/bcm/ghash-x86_64-win.asm index eacd900..abdbb70 100644 --- a/gen/bcm/ghash-x86_64-win.asm +++ b/gen/bcm/ghash-x86_64-win.asm
@@ -1214,7 +1214,7 @@ DB 60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111 DB 114,103,62,0 ALIGN 64 -section .text +section .text code align=64 section .pdata rdata align=4 ALIGN 4
diff --git a/gen/bcm/p256-x86_64-asm-win.asm b/gen/bcm/p256-x86_64-asm-win.asm index 9976ab3..c82ea79 100644 --- a/gen/bcm/p256-x86_64-asm-win.asm +++ b/gen/bcm/p256-x86_64-asm-win.asm
@@ -35,7 +35,7 @@ DQ 0xf3b9cac2fc632551,0xbce6faada7179e84,0xffffffffffffffff,0xffffffff00000000 $L$ordK: DQ 0xccd1c8aaee00bc4f -section .text +section .text code align=64 ; ###############################################################################
diff --git a/gen/bcm/rsaz-avx2-win.asm b/gen/bcm/rsaz-avx2-win.asm index a142c27..4272093 100644 --- a/gen/bcm/rsaz-avx2-win.asm +++ b/gen/bcm/rsaz-avx2-win.asm
@@ -1846,7 +1846,7 @@ DD 2,2,2,2,3,3,3,3 DD 4,4,4,4,4,4,4,4 ALIGN 64 -section .text +section .text code align=64 EXTERN __imp_RtlVirtualUnwind
diff --git a/gen/bcm/sha1-x86_64-win.asm b/gen/bcm/sha1-x86_64-win.asm index b59fb5d..b3a9225 100644 --- a/gen/bcm/sha1-x86_64-win.asm +++ b/gen/bcm/sha1-x86_64-win.asm
@@ -5560,7 +5560,7 @@ DB 97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114 DB 103,62,0 ALIGN 64 -section .text +section .text code align=64 EXTERN __imp_RtlVirtualUnwind
diff --git a/gen/bcm/sha256-x86_64-win.asm b/gen/bcm/sha256-x86_64-win.asm index 339f23a..7f3a21b 100644 --- a/gen/bcm/sha256-x86_64-win.asm +++ b/gen/bcm/sha256-x86_64-win.asm
@@ -1785,7 +1785,7 @@ DB 52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121 DB 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46 DB 111,114,103,62,0 -section .text +section .text code align=64 global sha256_block_data_order_hw
diff --git a/gen/bcm/sha512-x86_64-win.asm b/gen/bcm/sha512-x86_64-win.asm index 2e6760c..9f79afb 100644 --- a/gen/bcm/sha512-x86_64-win.asm +++ b/gen/bcm/sha512-x86_64-win.asm
@@ -1829,7 +1829,7 @@ DB 52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121 DB 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46 DB 111,114,103,62,0 -section .text +section .text code align=64 global sha512_block_data_order_avx
diff --git a/gen/bcm/vpaes-x86_64-win.asm b/gen/bcm/vpaes-x86_64-win.asm index 001618c..cea2195 100644 --- a/gen/bcm/vpaes-x86_64-win.asm +++ b/gen/bcm/vpaes-x86_64-win.asm
@@ -1348,7 +1348,7 @@ DB 85,110,105,118,101,114,115,105,116,121,41,0 ALIGN 64 -section .text +section .text code align=64 EXTERN __imp_RtlVirtualUnwind
diff --git a/gen/bcm/x86_64-mont5-win.asm b/gen/bcm/x86_64-mont5-win.asm index 05e9759..4b73b80 100644 --- a/gen/bcm/x86_64-mont5-win.asm +++ b/gen/bcm/x86_64-mont5-win.asm
@@ -3698,7 +3698,7 @@ DB 114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79 DB 71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111 DB 112,101,110,115,115,108,46,111,114,103,62,0 -section .text +section .text code align=64 EXTERN __imp_RtlVirtualUnwind
diff --git a/gen/crypto/chacha-x86_64-win.asm b/gen/crypto/chacha-x86_64-win.asm index e37e31f..9cd683b 100644 --- a/gen/crypto/chacha-x86_64-win.asm +++ b/gen/crypto/chacha-x86_64-win.asm
@@ -50,7 +50,7 @@ DB 95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32 DB 98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115 DB 108,46,111,114,103,62,0 -section .text +section .text code align=64 global ChaCha20_ctr32_nohw