[PATCH] C6X unwinding table generation

Paul Brook paul@codesourcery.com
Thu Apr 7 12:55:00 GMT 2011


The attached patch teaches gas how to generate C6X unwinding tables.

In principle these are very similar to the ARM EABI unwinding tables. However 
instead of inventing a whole new set of directives, we derive the frame layout 
from the existing dwarf frame information/directives.

This requires a couple of additional hooks in common dwarf2 CFI code.  The new 
tables are enabled via the existing .cfi_sections directive.

There is one major limitation to this code:  It assumes that only the function 
prologue is described by the CFI directives, and that the state at the end of 
the function is that which should be unwound.  Currently I believe this is 
true.  If we start encountering compilers that also annotate function epilogue 
then we'll probably want an additional directive to mark which state 
represents the body of the function.

The ABI defined unwinding opcodes can only describe a fairly limited set of 
frame layouts.  Frames that cannot be represented will generate an error.

Ok?

Paul

2011-04-07  Paul Brook  <paul@codesourcery.com>

	bfd/
	* elf32-tic6x.c (is_tic6x_elf_unwind_section_name,
	elf32_tic6x_fake_sections): New functions.
	(elf_backend_fake_sections): Define.

	gas/
	* config/tc-tic6x.c (streq): Define.
	(unwind): New variable.
	(s_tic6x_cantunwind, s_tic6x_handlerdata, s_tic6x_endp,
	s_tic6x_personalityindex, s_tic6x_personality): New functions.
	(md_pseudo_table): Add "endp", "handlerdata", "personalityindex",
	"personality" and "cantunwind".
	(tic6x_regname_to_dw2regnum, tic6x_frame_initial_instructions,
	start_unwind_section, unwind_frame_regs, pop_rts_offset_little,
	pop_rts_offset_big, unwind_reg_from_dwarf, flush_unwind_word,
	unwind_byte, unwind_2byte, unwind_uleb, tic6x_cfi_startproc,
	output_exidx_entry, tic6x_output_unwinding, tic6x_cfi_endproc,
	* config/tc-tic6x.h (tic6x_segment_info_type): Add
	marked_pr_dependency.
	(TARGET_USE_CFIPOP, tc_regname_to_dw2regnum,
	tc_cfi_frame_initial_instructions, DWARF2_DEFAULT_RETURN_COLUMN,
	DWARF2_CIE_DATA_ALIGNMENT, tc_cfi_startproc, tc_cfi_endproc,
	tc_cfi_section_name): Define.
	* doc/c-tic6x.texi: Document new unwinding directives.
	* dw2gencfi.c (tc_cfi_startproc, tc_cfi_endproc): Add default
	definitions.
	(cfi_insn_data, fde_entry, CFI_adjust_cfa_offset, CFI_return_column,
	CFI_rel_offset, CFI_escape, CFI_signal_frame, CFI_val_encoded_addr):
	Move to dw2gencfi.h.
	(CFI_EMIT_target): Define.
	(dot_cfi_sections): Check tc_cfi_section_name.
	(dot_cfi_startproc): Use tc_cfi_startproc.
	(dot_cfi_endproc): Use tc_cfi_endproc.
	* dw2gencfi.h (cfi_insn_data, fde_entry, CFI_adjust_cfa_offset,
	CFI_return_column, CFI_rel_offset, CFI_escape, CFI_signal_frame,
	CFI_val_encoded_addr):  Move to here from dw2gencfi.c.

	gas/testsuite:
	* gas/tic6x/unwind-1.d: New test.
	* gas/tic6x/unwind-1.s: New test.
	* gas/tic6x/unwind-2.d: New test.
	* gas/tic6x/unwind-2.s: New test.

	include/
	* elf/tic6x.h (ELF_STRING_C6000_unwind,
	ELF_STRING_C6000_unwind_info, ELF_STRING_C6000_unwind_once,
	ELF_STRING_C6000_unwind_info_once): Define.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.unwinder
Type: text/x-patch
Size: 48856 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20110407/89640de1/attachment.bin>


More information about the Binutils mailing list