Work around nasm bug with empty assembly files

If you pass an empty assembly file into nasm, it crashes. Add a dummy
instruction which the static linker will hopefully dropped. (This is a
no-op unless you try to link all the assembly files together for a
simpler build.)

Bug: 542
Change-Id: Idd2b96c129a3a39d5f21e3905762cc34c720f6b2
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56326
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl
index f906828..68f1a69 100755
--- a/crypto/perlasm/x86_64-xlate.pl
+++ b/crypto/perlasm/x86_64-xlate.pl
@@ -1609,7 +1609,12 @@
 #endif
 ___
 } elsif ($nasm) {
-    print "\%endif\n";
+    print <<___;
+\%else
+; Work around https://bugzilla.nasm.us/show_bug.cgi?id=3392738
+ret
+\%endif
+___
 } else {
     die "unknown assembler";
 }
diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl
index 743c792..d66255e 100644
--- a/crypto/perlasm/x86asm.pl
+++ b/crypto/perlasm/x86asm.pl
@@ -290,7 +290,12 @@
 \%ifidn __OUTPUT_FORMAT__, win32
 ___
         print @out;
-        print "\%endif\n";
+        print <<___ unless $masm;
+\%else
+; Work around https://bugzilla.nasm.us/show_bug.cgi?id=3392738
+ret
+\%endif
+___
     } else {
         my $target;
         if ($elf) {