From c48c8b6f64a6cda5ed54434abae51c5c96a49f34 Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Wed, 9 Oct 2019 16:05:00 -0700 Subject: [PATCH] Move no-exec-stack sections outside of #ifs. When building with |OPENSSL_NO_ASM|, the section that marks assembly files as no-exec-stack will currently be omitted. That results in an empty assembly file but that's still enough to trigger warnings: warning: crypto_tests/trampoline-x86_64.o: missing .note.GNU-stack section implies executable stack This change makes it so that the section marker will always be emitted, even if the file is otherwise empty. Change-Id: I2d08d34ed9dbe9e9592c88dcd42d3ba4fa3d7652 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/38084 Commit-Queue: David Benjamin Reviewed-by: David Benjamin --- crypto/curve25519/asm/x25519-asm-arm.S | 4 ++-- crypto/hrss/asm/poly_rq_mul.S | 4 ++-- crypto/perlasm/arm-xlate.pl | 6 +++--- crypto/perlasm/ppc-xlate.pl | 4 ++-- crypto/perlasm/x86_64-xlate.pl | 3 +-- crypto/perlasm/x86asm.pl | 2 +- crypto/poly1305/poly1305_arm_asm.S | 4 ++-- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/crypto/curve25519/asm/x25519-asm-arm.S b/crypto/curve25519/asm/x25519-asm-arm.S index 9a26adda3..41bc0c6e8 100644 --- a/crypto/curve25519/asm/x25519-asm-arm.S +++ b/crypto/curve25519/asm/x25519-asm-arm.S @@ -2129,8 +2129,8 @@ mov sp,r12 vpop {q4,q5,q6,q7} bx lr +#endif /* !OPENSSL_NO_ASM && __arm__ && !__APPLE__ */ + #if defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif - -#endif /* !OPENSSL_NO_ASM && __arm__ && !__APPLE__ */ diff --git a/crypto/hrss/asm/poly_rq_mul.S b/crypto/hrss/asm/poly_rq_mul.S index 0b684c384..d38462797 100644 --- a/crypto/hrss/asm/poly_rq_mul.S +++ b/crypto/hrss/asm/poly_rq_mul.S @@ -8460,8 +8460,8 @@ ret .cfi_endproc .size poly_Rq_mul,.-poly_Rq_mul +#endif + #if defined(__ELF__) .section .note.GNU-stack,"",@progbits #endif - -#endif diff --git a/crypto/perlasm/arm-xlate.pl b/crypto/perlasm/arm-xlate.pl index adbd239e3..58904d085 100755 --- a/crypto/perlasm/arm-xlate.pl +++ b/crypto/perlasm/arm-xlate.pl @@ -228,10 +228,10 @@ while(my $line=<>) { print "\n"; } -# See https://www.airs.com/blog/archives/518. -print ".section\t.note.GNU-stack,\"\",\%progbits\n" if ($flavour =~ /linux/); - print "#endif\n" if ($flavour eq "linux32" || $flavour eq "linux64"); print "#endif // !OPENSSL_NO_ASM\n"; +# See https://www.airs.com/blog/archives/518. +print ".section\t.note.GNU-stack,\"\",\%progbits\n" if ($flavour =~ /linux/); + close STDOUT; diff --git a/crypto/perlasm/ppc-xlate.pl b/crypto/perlasm/ppc-xlate.pl index f8e42a22d..4f22c36dc 100644 --- a/crypto/perlasm/ppc-xlate.pl +++ b/crypto/perlasm/ppc-xlate.pl @@ -309,9 +309,9 @@ while($line=<>) { print "\n"; } +print "#endif // !OPENSSL_NO_ASM && __powerpc64__\n"; + # See https://www.airs.com/blog/archives/518. print ".section\t.note.GNU-stack,\"\",\@progbits\n" if ($flavour =~ /linux/); -print "#endif // !OPENSSL_NO_ASM && __powerpc64__\n"; - close STDOUT; diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl index d2854cf49..4a41a2413 100755 --- a/crypto/perlasm/x86_64-xlate.pl +++ b/crypto/perlasm/x86_64-xlate.pl @@ -1260,10 +1260,9 @@ while(defined(my $line=<>)) { print "\n$current_segment\tENDS\n" if ($current_segment && $masm); print "END\n" if ($masm); +print "#endif\n" if ($gas); # See https://www.airs.com/blog/archives/518. print ".section\t.note.GNU-stack,\"\",\@progbits\n" if ($elf); -print "#endif\n" if ($gas); - close STDOUT; diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl index b331cd4fd..2d19425ff 100644 --- a/crypto/perlasm/x86asm.pl +++ b/crypto/perlasm/x86asm.pl @@ -297,9 +297,9 @@ ___ ___ } print @out; + print "#endif\n" unless ($win32 || $netware); # See https://www.airs.com/blog/archives/518. print ".section\t.note.GNU-stack,\"\",\@progbits\n" if ($elf); - print "#endif\n" unless ($win32 || $netware); } sub ::asm_init diff --git a/crypto/poly1305/poly1305_arm_asm.S b/crypto/poly1305/poly1305_arm_asm.S index 77b3c48e3..80a4b31fa 100644 --- a/crypto/poly1305/poly1305_arm_asm.S +++ b/crypto/poly1305/poly1305_arm_asm.S @@ -2022,8 +2022,8 @@ vst1.8 d4,[r0,: 64] add sp,sp,#0 bx lr +#endif /* __arm__ && !OPENSSL_NO_ASM && !__APPLE__ */ + #if defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif - -#endif /* __arm__ && !OPENSSL_NO_ASM && !__APPLE__ */