From 08dee19b7bd40bc77ce668e3085ed2fd33227b6a Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Tue, 19 Oct 2021 15:42:05 -0400 Subject: [PATCH] Use C preprocessor comments in assembly headers. We generate .S files for assembly, which means they run through the C preprocessor first. In gas targets where # is the comment marker, there is a conflict with cpp directives. The comments actually rely on #This and #source not being directives. If I begin a line with "if", the build fails. Since the C preprocessor is responsible for removing C preprocessor comments, we should be able to safely use // everywhere with less ambiguity. (In fact, we were already relying on this for 32-bit ARM. The 32-bit ARM gas line comment marker is @. 64-bit ARM uses //, and x86/x86_64/ppc64 use #.) This reportedly causes issues for goma. See https://bugs.chromium.org/p/boringssl/issues/detail?id=448#c3 Bug: 448 Change-Id: Ib58f3152691c1dbcccfc045f21f486b56824283d Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49965 Reviewed-by: Adam Langley --- crypto/perlasm/ppc-xlate.pl | 4 ++-- crypto/perlasm/x86_64-xlate.pl | 2 +- crypto/perlasm/x86asm.pl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto/perlasm/ppc-xlate.pl b/crypto/perlasm/ppc-xlate.pl index d62ae0106..fff9c004f 100644 --- a/crypto/perlasm/ppc-xlate.pl +++ b/crypto/perlasm/ppc-xlate.pl @@ -256,8 +256,8 @@ my $darn = sub { }; print <<___; -# This file is generated from a similarly-named Perl script in the BoringSSL -# source tree. Do not edit by hand. +// This file is generated from a similarly-named Perl script in the BoringSSL +// source tree. Do not edit by hand. #if defined(__has_feature) #if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM) diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl index 04abd0b44..e3745f898 100755 --- a/crypto/perlasm/x86_64-xlate.pl +++ b/crypto/perlasm/x86_64-xlate.pl @@ -1136,7 +1136,7 @@ my $endbranch = sub { ######################################################################## { - my $comment = "#"; + my $comment = "//"; $comment = ";" if ($masm || $nasm); print <<___; $comment This file is generated from a similarly-named Perl script in the BoringSSL diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl index 51f37664c..c22421f9a 100644 --- a/crypto/perlasm/x86asm.pl +++ b/crypto/perlasm/x86asm.pl @@ -275,7 +275,7 @@ sub ::asciz sub ::asm_finish { &file_end(); - my $comment = "#"; + my $comment = "//"; $comment = ";" if ($win32); print <<___; $comment This file is generated from a similarly-named Perl script in the BoringSSL