From 5c9d411e145d97698cdd12419edf581dfd9cd050 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 2 Feb 2017 16:37:19 -0500 Subject: [PATCH] Fix some compact unwind errors. The Mac ld gets unhappy about "weird" unwind directives: In chacha20_poly1305_x86_64.pl, $keyp is being pushed on the stack (according to the comment) because it gets clobbered in the computation somewhere. $keyp is %r9 which is not callee-saved (it's an argument register), so we don't need to tag it with .cfi_offset. In x25519-asm-x86_64.S, x25519_x86_64_mul saves %rdi on the stack. However it too is not callee-saved (it's an argument register) and should not have a .cfi_offset. %rdi also does not appear to be written to anywhere in the function, so there's no need to save it at all. (This does not resolve the "r15 is saved too far from return address" errors. Just the non-standard register ones.) BUG=176 Change-Id: I53f3f7db3d1745384fb47cb52cd6536aabb5065e Reviewed-on: https://boringssl-review.googlesource.com/13560 Commit-Queue: David Benjamin Reviewed-by: Adam Langley --- crypto/cipher/asm/chacha20_poly1305_x86_64.pl | 2 -- crypto/curve25519/asm/x25519-asm-x86_64.S | 2 -- 2 files changed, 4 deletions(-) diff --git a/crypto/cipher/asm/chacha20_poly1305_x86_64.pl b/crypto/cipher/asm/chacha20_poly1305_x86_64.pl index 4a206b899..44590c2fa 100644 --- a/crypto/cipher/asm/chacha20_poly1305_x86_64.pl +++ b/crypto/cipher/asm/chacha20_poly1305_x86_64.pl @@ -453,7 +453,6 @@ chacha20_poly1305_open: .cfi_offset r13, -40 .cfi_offset r14, -48 .cfi_offset r15, -56 -.cfi_offset $keyp, -64 lea 32(%rsp), %rbp and \$-32, %rbp mov %rdx, 8+$len_store @@ -852,7 +851,6 @@ chacha20_poly1305_seal: .cfi_offset r13, -40 .cfi_offset r14, -48 .cfi_offset r15, -56 -.cfi_offset $keyp, -64 lea 32(%rsp), %rbp and \$-32, %rbp mov %rdx, 8+$len_store diff --git a/crypto/curve25519/asm/x25519-asm-x86_64.S b/crypto/curve25519/asm/x25519-asm-x86_64.S index 72f69dbcd..dc8df94f7 100644 --- a/crypto/curve25519/asm/x25519-asm-x86_64.S +++ b/crypto/curve25519/asm/x25519-asm-x86_64.S @@ -143,8 +143,6 @@ movq %rbx,-40(%rsp) .cfi_rel_offset rbx, -40 movq %rbp,-48(%rsp) .cfi_rel_offset rbp, -48 -movq %rdi,-56(%rsp) -.cfi_rel_offset rdi, -56 mov %rdx,%rcx movq 24(%rsi),%rdx imulq $19,%rdx,%rax