summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2019-01-29 17:41:39 -0600
committerKurt Roeckx <kurt@roeckx.be>2019-02-17 23:41:14 +0100
commit2e826078410bdb117710890b0e99bbdbbbf7e95d (patch)
treee2db128637b59e4b4777baadaff06ecc6aec378e
parent2086edb799acf6ad5ef0bb53aa3b17abf4f7f992 (diff)
Check for unpaired .cfi_remember_state
Reviewed-by: Richard Levitte <levitte@openssl.org> GH: #8109 (cherry picked from commit e09633107b7e987b2179850715ba60d8fb069278)
-rwxr-xr-xcrypto/perlasm/x86_64-xlate.pl8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl
index b81d03a753..1b0bf42f8c 100755
--- a/crypto/perlasm/x86_64-xlate.pl
+++ b/crypto/perlasm/x86_64-xlate.pl
@@ -649,7 +649,13 @@ my %globals;
# why it starts with -8. Recall that CFA is top of caller's
# stack...
/startproc/ && do { ($cfa_reg, $cfa_rsp) = ("%rsp", -8); last; };
- /endproc/ && do { ($cfa_reg, $cfa_rsp) = ("%rsp", 0); last; };
+ /endproc/ && do { ($cfa_reg, $cfa_rsp) = ("%rsp", 0);
+ # .cfi_remember_state directives that are not
+ # matched with .cfi_restore_state are
+ # unnecessary.
+ die "unpaired .cfi_remember_state" if (@cfa_stack);
+ last;
+ };
/def_cfa_register/
&& do { $cfa_reg = $$line; last; };
/def_cfa_offset/