perlasm/x86_64-xlate.pl: recognize DWARF CFI directives.
authorAndy Polyakov <appro@openssl.org>
Mon, 6 Feb 2017 07:58:34 +0000 (08:58 +0100)
committerAndy Polyakov <appro@openssl.org>
Thu, 9 Feb 2017 19:00:33 +0000 (20:00 +0100)
commita3b5684fc1d4f3aabdf68dcf6c577f6dd24d2b2d
treee80fb5354a4a1d35c422781768a99521e93dd76a
parent9d301cfea7181766b79ba31ed257d30fb84b1b0f
perlasm/x86_64-xlate.pl: recognize DWARF CFI directives.

CFI directives annotate instructions that are significant for stack
unwinding procedure. In addition to directives recognized by GNU
assembler this module implements three synthetic ones:

- .cfi_push annotates push instructions in prologue and translates to
  .cfi_adjust_cfa_offset (if needed) and .cfi_offset;
- .cfi_pop annotates pop instructions in epilogue and translates to
  .cfi_adjust_cfs_offset (if needed) and .cfi_restore;
- .cfi_cfa_expression encodes DW_CFA_def_cfa_expression and passes it
  to .cfi_escape as byte vector;

CFA expression syntax is made up mix of DWARF operator suffixes [subset
of] and references to registers with optional bias. Following example
describes offloaded original stack pointer at specific offset from
current stack pointer:

.cfi_cfa_expression %rsp+40,deref,+8

Final +8 has everything to do with the fact that CFA, Canonical Frame
Address, is reference to top of caller's stack, and on x86_64 call to
subroutine pushes 8-byte return address.

Triggered by request from Adam Langley.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/perlasm/x86_64-xlate.pl