2007-05-17 H.J. Lu <hongjiu.lu@intel.com>

PR gas/4517
	2003-06-05  Michal Ludvig  <mludvig@suse.cz>
	* as.texinfo: Document new directives: .cfi_restore,
	.cfi_undefined, .cfi_same_value, .cfi_return_column,
	.cfi_remember_state and .cfi_restore_state.

2007-05-17  H.J. Lu  <hongjiu.lu@intel.com>

	2003-06-05  Michal Ludvig  <mludvig@suse.cz>
	* testsuite/gas/cfi/cfi-x86_64.s: Test new directives
	and different writings of registers and numbers.
	* testsuite/gas/cfi/cfi-x86_64.d: Updated pattern to
	match the above change.
This commit is contained in:
H.J. Lu 2007-05-17 17:27:26 +00:00
parent 30618a1e61
commit 4b7d318b85
4 changed files with 125 additions and 14 deletions

View File

@ -1,3 +1,19 @@
2007-05-17 H.J. Lu <hongjiu.lu@intel.com>
PR gas/4517
2003-06-05 Michal Ludvig <mludvig@suse.cz>
* as.texinfo: Document new directives: .cfi_restore,
.cfi_undefined, .cfi_same_value, .cfi_return_column,
.cfi_remember_state and .cfi_restore_state.
2007-05-17 H.J. Lu <hongjiu.lu@intel.com>
2003-06-05 Michal Ludvig <mludvig@suse.cz>
* testsuite/gas/cfi/cfi-x86_64.s: Test new directives
and different writings of registers and numbers.
* testsuite/gas/cfi/cfi-x86_64.d: Updated pattern to
match the above change.
2007-05-17 Nathan Sidwell <nathan@codesourcery.com>
* config/tc-m68k.c (md_apply_fix): Show value of out of range

View File

@ -3790,7 +3790,7 @@ Some machine configurations provide additional directives.
* Byte:: @code{.byte @var{expressions}}
* Comm:: @code{.comm @var{symbol} , @var{length} }
* CFI directives:: @code{.cfi_startproc}, @code{.cfi_endproc}, etc.
* CFI directives:: @code{.cfi_startproc [simple]}, @code{.cfi_endproc}, etc.
* Data:: @code{.data @var{subsection}}
@ifset COFF
@ -4109,14 +4109,16 @@ The syntax for @code{.comm} differs slightly on the HPPA. The syntax is
@end ifset
@node CFI directives
@section @code{.cfi_startproc}
@section @code{.cfi_startproc [simple]}
@cindex @code{cfi_startproc} directive
@code{.cfi_startproc} is used at the beginning of each function that
should have an entry in @code{.eh_frame}. It initializes some internal
data structures and emits architecture dependent initial CFI instructions.
Don't forget to close the function by
data structures. Don't forget to close the function by
@code{.cfi_endproc}.
Unless @code{.cfi_startproc} is used along with parameter @code{simple}
it also emits some architecture dependent initial CFI instructions.
@section @code{.cfi_endproc}
@cindex @code{cfi_endproc} directive
@code{.cfi_endproc} is used at the end of a function where it closes its
@ -4172,6 +4174,31 @@ using the known displacement of the CFA register from the CFA.
This is often easier to use, because the number will match the
code it's annotating.
@section @code{.cfi_register @var{register1}, @var{register2}}
Previous value of @var{register1} is saved in register @var{register2}.
@section @code{.cfi_restore @var{register}}
@code{.cfi_restore} says that the rule for @var{register} is now the
same as it was at the beginning of the function, after all initial
instruction added by @code{.cfi_startproc} were executed.
@section @code{.cfi_undefined @var{register}}
From now on the previous value of @var{register} can't be restored anymore.
@section @code{.cfi_same_value @var{register}}
Current value of @var{register} is the same like in the previous frame,
i.e. no restoration needed.
@section @code{.cfi_remember_state},
First save all current rules for all registers by @code{.cfi_remember_state},
then totally screw them up by subsequent @code{.cfi_*} directives and when
everything is hopelessly bad, use @code{.cfi_restore_state} to restore
the previous saved state.
@section @code{.cfi_return_column @var{register}}
Change return column @var{register}, i.e. the return address is either
directly in @var{register} or can be accessed by rules for @var{register}.
@section @code{.cfi_signal_frame}
Mark current function as signal trampoline.

View File

@ -35,7 +35,7 @@ The section .eh_frame contains:
00000050 00000014 00000054 FDE cie=00000000 pc=00000022..00000035
DW_CFA_advance_loc: 3 to 00000025
DW_CFA_def_cfa_reg: r12
DW_CFA_def_cfa_reg: r8
DW_CFA_advance_loc: 15 to 00000034
DW_CFA_def_cfa_reg: r7
DW_CFA_nop
@ -50,3 +50,40 @@ The section .eh_frame contains:
DW_CFA_nop
DW_CFA_nop
00000090 00000010 00000000 CIE
Version: 1
Augmentation: "zR"
Code alignment factor: 1
Data alignment factor: -8
Return address column: 16
Augmentation data: 1b
DW_CFA_def_cfa: r7 ofs 8
000000a4 00000030 00000018 FDE cie=00000090 pc=0000004d..00000058
DW_CFA_advance_loc: 1 to 0000004e
DW_CFA_def_cfa_offset: 16
DW_CFA_advance_loc: 1 to 0000004f
DW_CFA_def_cfa_reg: r8
DW_CFA_advance_loc: 1 to 00000050
DW_CFA_def_cfa_offset: 4676
DW_CFA_advance_loc: 1 to 00000051
DW_CFA_offset_extended_sf: r4 at cfa\+16
DW_CFA_advance_loc: 1 to 00000052
DW_CFA_register: r8 in r9
DW_CFA_advance_loc: 1 to 00000053
DW_CFA_remember_state
DW_CFA_advance_loc: 1 to 00000054
DW_CFA_restore: r6
DW_CFA_advance_loc: 1 to 00000055
DW_CFA_undefined: r16
DW_CFA_advance_loc: 1 to 00000056
DW_CFA_same_value: r3
DW_CFA_advance_loc: 1 to 00000057
DW_CFA_restore_state
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop

View File

@ -35,9 +35,9 @@ func_prologue:
#; each instruction.
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset rbp,-16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register rbp
.cfi_def_cfa_register %rbp
#; function body
call func_locvars
@ -46,7 +46,7 @@ func_prologue:
#; epilogue with valid CFI
#; (we're better than gcc :-)
leaveq
.cfi_def_cfa rsp,8
.cfi_def_cfa %rsp, 8
ret
.cfi_endproc
@ -59,21 +59,21 @@ func_prologue:
func_otherreg:
.cfi_startproc
#; save frame pointer to r12
movq %rsp,%r12
.cfi_def_cfa_register r12
#; save frame pointer to r8
movq %rsp,%r8
.cfi_def_cfa_register r8
#; alocate space for local vars
#; (no .cfi_{def,adjust}_cfa_offset here,
#; because CFA is computed from r12!)
#; because CFA is computed from r8!)
sub $100,%rsp
#; function body
call func_prologue
addl $2, %eax
#; restore frame pointer from r12
movq %r12,%rsp
#; restore frame pointer from r8
movq %r8,%rsp
.cfi_def_cfa_register rsp
ret
.cfi_endproc
@ -105,3 +105,34 @@ _start:
syscall
hlt
.cfi_endproc
#; func_alldirectives
#; - test for all .cfi directives.
#; This function is never called and the CFI info doesn't make sense.
.type func_alldirectives,@function
func_alldirectives:
.cfi_startproc simple
.cfi_def_cfa rsp,8
nop
.cfi_def_cfa_offset 16
nop
.cfi_def_cfa_register r8
nop
.cfi_adjust_cfa_offset 0x1234
nop
.cfi_offset %rsi, 0x10
nop
.cfi_register %r8, %r9
nop
.cfi_remember_state
nop
.cfi_restore %rbp
nop
.cfi_undefined %rip
nop
.cfi_same_value rbx
nop
.cfi_restore_state
ret
.cfi_endproc