2011-05-09 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.
	(tic6x_get_unwind): New.
	(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,
	tic6x_start_unwind_section, tic6x_unwind_frame_regs,
	tic6x_pop_rts_offset_little, tic6x_pop_rts_offset_big,
	tic6x_unwind_reg_from_dwarf, tic6x_flush_unwind_word,
	tic6x_unwind_byte, tic6x_unwind_2byte, tic6x_unwind_uleb,
	tic6x_cfi_startproc, output_exidx_entry, tic6x_output_unwinding,
	tic6x_cfi_endproc): New.
	* config/tc-tic6x.h (TIC6X_NUM_UNWIND_REGS): Define.
	(tic6x_unwind_info): New.
	(tic6x_segment_info_type): Add marked_pr_dependency, unwind and
	text_unwind.
	(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.
	* gas/tic6x/unwind-3.d: New test.
	* gas/tic6x/unwind-3.s: New test.
	* gas/tic6x/unwind-bad-1.d: New test.
	* gas/tic6x/unwind-bad-1.s: New test.
	* gas/tic6x/unwind-bad-1.l: New test.
	* gas/tic6x/unwind-bad-2.d: New test.
	* gas/tic6x/unwind-bad-2.s: New test.
	* gas/tic6x/unwind-bad-2.l: 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.
This commit is contained in:
Paul Brook 2011-05-09 13:17:58 +00:00
parent 9cf0e28212
commit 1bce6bd86f
23 changed files with 2236 additions and 76 deletions

View File

@ -1,3 +1,9 @@
2011-05-09 Paul Brook <paul@codesourcery.com>
* elf32-tic6x.c (is_tic6x_elf_unwind_section_name,
elf32_tic6x_fake_sections): New functions.
(elf_backend_fake_sections): Define.
2011-05-09 Paul Brook <paul@codesourcery.com>
* elf32-tic6x.c (elf32_tic6x_gc_mark_extra_sections): New function.

View File

@ -1886,6 +1886,36 @@ elf32_tic6x_gc_mark_extra_sections (struct bfd_link_info *info,
return TRUE;
}
/* Return TRUE if this is an unwinding table index. */
static bfd_boolean
is_tic6x_elf_unwind_section_name (const char *name)
{
return (CONST_STRNEQ (name, ELF_STRING_C6000_unwind)
|| CONST_STRNEQ (name, ELF_STRING_C6000_unwind_once));
}
/* Set the type and flags for an unwinding index table. We do this by
the section name, which is a hack, but ought to work. */
static bfd_boolean
elf32_tic6x_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
Elf_Internal_Shdr *hdr, asection *sec)
{
const char * name;
name = bfd_get_section_name (abfd, sec);
if (is_tic6x_elf_unwind_section_name (name))
{
hdr->sh_type = SHT_C6000_UNWIND;
hdr->sh_flags |= SHF_LINK_ORDER;
}
return TRUE;
}
/* Update the got entry reference counts for the section being removed. */
static bfd_boolean
@ -3979,6 +4009,7 @@ elf32_tic6x_copy_private_data (bfd * ibfd, bfd * obfd)
#define elf_backend_plt_readonly 1
#define elf_backend_rela_normal 1
#define elf_backend_got_header_size 8
#define elf_backend_fake_sections elf32_tic6x_fake_sections
#define elf_backend_gc_sweep_hook elf32_tic6x_gc_sweep_hook
#define elf_backend_gc_mark_extra_sections elf32_tic6x_gc_mark_extra_sections
#define elf_backend_modify_program_headers \

View File

@ -1,3 +1,40 @@
2011-05-09 Paul Brook <paul@codesourcery.com>
* config/tc-tic6x.c (streq): Define.
(tic6x_get_unwind): New.
(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,
tic6x_start_unwind_section, tic6x_unwind_frame_regs,
tic6x_pop_rts_offset_little, tic6x_pop_rts_offset_big,
tic6x_unwind_reg_from_dwarf, tic6x_flush_unwind_word,
tic6x_unwind_byte, tic6x_unwind_2byte, tic6x_unwind_uleb,
tic6x_cfi_startproc, output_exidx_entry, tic6x_output_unwinding,
tic6x_cfi_endproc): New.
* config/tc-tic6x.h (TIC6X_NUM_UNWIND_REGS): Define.
(tic6x_unwind_info): New.
(tic6x_segment_info_type): Add marked_pr_dependency, unwind and
text_unwind.
(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.
2011-05-07 Alan Modra <amodra@gmail.com>
* dw2gencfi.c (CUR_SEG, SET_CUR_SEG, HANDLED, SET_HANDLED): Define.

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,38 @@ typedef struct tic6x_label_list
symbolS *label;
} tic6x_label_list;
/* Must be consistent with the enum in tc-tic6x.c. */
#define TIC6X_NUM_UNWIND_REGS 13
/* Unwinding information state. */
typedef struct tic6x_unwind_info {
int personality_index;
symbolS *personality_routine;
symbolS *function_start;
segT saved_seg;
subsegT saved_subseg;
/* NULL if table entry is inline. */
symbolS *table_entry;
char *frag_start;
valueT data;
/* 0 before .cfi_startproc
-1 between .cfi_startproc and .handlerdata
>0 between .handlerdata and .endp */
int data_bytes;
offsetT reg_offset[TIC6X_NUM_UNWIND_REGS];
bfd_boolean reg_saved[TIC6X_NUM_UNWIND_REGS];
int cfa_reg;
int return_reg;
unsigned safe_mask;
unsigned compact_mask;
unsigned reg_saved_mask;
offsetT cfa_offset;
bfd_boolean pop_rts;
/* Only valid for UNWIND_OP_POP_REG */
int saved_reg_count;
} tic6x_unwind_info;
typedef struct
{
/* Any labels seen since the last instruction or data. If not NULL,
@ -77,6 +109,14 @@ typedef struct
from the SPLOOP instruction (in the range 1 to 14); otherwise
0. */
int sploop_ii;
/* Bit N indicates that an R_C6000_NONE relocation has been output for
__c6xabi_unwind_cpp_prN already if set. This enables dependencies to be
emitted only once per section, to save unnecessary bloat. */
unsigned int marked_pr_dependency;
tic6x_unwind_info *unwind;
tic6x_unwind_info *text_unwind;
} tic6x_segment_info_type;
#define TC_SEGMENT_INFO_TYPE tic6x_segment_info_type
@ -158,3 +198,28 @@ extern void tic6x_init_after_args (void);
#define tc_unrecognized_line(c) tic6x_unrecognized_line (c)
extern int tic6x_unrecognized_line (int c);
/* We want .cfi_* pseudo-ops for generating unwind info. */
#define TARGET_USE_CFIPOP 1
/* CFI hooks. */
#define tc_regname_to_dw2regnum tic6x_regname_to_dw2regnum
int tic6x_regname_to_dw2regnum (char *regname);
#define tc_cfi_frame_initial_instructions tic6x_frame_initial_instructions
void tic6x_frame_initial_instructions (void);
/* The return register is B3. */
#define DWARF2_DEFAULT_RETURN_COLUMN (16 + 3)
/* Registers are generally saved at negative offsets to the CFA. */
#define DWARF2_CIE_DATA_ALIGNMENT (-4)
#define tc_cfi_startproc tic6x_cfi_startproc
void tic6x_cfi_startproc (void);
#define tc_cfi_endproc tic6x_cfi_endproc
struct fde_entry;
void tic6x_cfi_endproc (struct fde_entry *fde);
#define tc_cfi_section_name ".c6xabi.exidx"

View File

@ -131,6 +131,14 @@ subsequent directive overriding it.
@item .arch @var{arch}
This has the same effect as @option{-march=@var{arch}}.
@cindex @code{.cantunwind} directive, TIC6X
@item .cantunwind
Prevents unwinding through the current function. No personality routine
or exception table data is required or permitted.
If this is not specified then frame unwinding information will be
constructed from CFI directives. @pxref{CFI directives}.
@cindex @code{.c6xabi_attribute} directive, TIC6X
@item .c6xabi_attribute @var{tag}, @var{value}
Set the C6000 EABI build attribute @var{tag} to @var{value}.
@ -150,11 +158,35 @@ The @var{tag} is either an attribute number or one of
@item .ehtype @var{symbol}
Output an exception type table reference to @var{symbol}.
@cindex @code{.endp} directive, TIC6X
@item .endp
Marks the end of and exception table or function. If preceeded by a
@code{.handlerdata} directive then this also switched back to the previous
text section.
@cindex @code{.handlerdata} directive, TIC6X
@item .handlerdata
Marks the end of the current function, and the start of the exception table
entry for that function. Anything between this directive and the
@code{.endp} directive will be added to the exception table entry.
Must be preceded by a CFI block containing a @code{.cfi_lsda} directive.
directive.
@cindex @code{.nocmp} directive, TIC6X
@item .nocmp
Disallow use of C64x+ compact instructions in the current text
section.
@cindex @code{.personalityindex} directive, TIC6X
@item .personalityindex @var{index}
Sets the personality routine for the current function to the ABI specified
compact routine number @var{index}
@cindex @code{.personality} directive, TIC6X
@item .personality @var{name}
Sets the personality routine for the current function to @var{name}.
@cindex @code{.scomm} directive, TIC6X
@item .scomm @var{symbol}, @var{size}, @var{align}
Like @code{.comm}, creating a common symbol @var{symbol} with size @var{size}

View File

@ -68,6 +68,14 @@
#define tc_cfi_frame_initial_instructions() ((void)0)
#endif
#ifndef tc_cfi_startproc
# define tc_cfi_startproc() ((void)0)
#endif
#ifndef tc_cfi_endproc
# define tc_cfi_endproc(fde) ((void)0)
#endif
#ifndef DWARF2_FORMAT
#define DWARF2_FORMAT(SEC) dwarf2_format_32bit
#endif
@ -76,12 +84,6 @@
#define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8)
#endif
#if defined (TE_PE) || defined (TE_PEP)
#define SUPPORT_FRAME_LINKONCE 1
#else
#define SUPPORT_FRAME_LINKONCE 0
#endif
#if SUPPORT_FRAME_LINKONCE
#define CUR_SEG(structp) structp->cur_seg
#define SET_CUR_SEG(structp, seg) structp->cur_seg = seg
@ -268,67 +270,6 @@ struct cfi_escape_data
expressionS exp;
};
struct cfi_insn_data
{
struct cfi_insn_data *next;
#if SUPPORT_FRAME_LINKONCE
segT cur_seg;
#endif
int insn;
union
{
struct
{
unsigned reg;
offsetT offset;
} ri;
struct
{
unsigned reg1;
unsigned reg2;
} rr;
unsigned r;
offsetT i;
struct
{
symbolS *lab1;
symbolS *lab2;
} ll;
struct cfi_escape_data *esc;
struct
{
unsigned reg, encoding;
expressionS exp;
} ea;
} u;
};
struct fde_entry
{
struct fde_entry *next;
#if SUPPORT_FRAME_LINKONCE
segT cur_seg;
#endif
symbolS *start_address;
symbolS *end_address;
struct cfi_insn_data *data;
struct cfi_insn_data **last;
unsigned char per_encoding;
unsigned char lsda_encoding;
expressionS personality;
expressionS lsda;
unsigned int return_column;
unsigned int signal_frame;
#if SUPPORT_FRAME_LINKONCE
int handled;
#endif
};
struct cie_entry
{
struct cie_entry *next;
@ -611,14 +552,6 @@ static void dot_cfi_personality (int);
static void dot_cfi_lsda (int);
static void dot_cfi_val_encoded_addr (int);
/* Fake CFI type; outside the byte range of any real CFI insn. */
#define CFI_adjust_cfa_offset 0x100
#define CFI_return_column 0x101
#define CFI_rel_offset 0x102
#define CFI_escape 0x103
#define CFI_signal_frame 0x104
#define CFI_val_encoded_addr 0x105
const pseudo_typeS cfi_pseudo_table[] =
{
{ "cfi_sections", dot_cfi_sections, 0 },
@ -1087,6 +1020,7 @@ dot_cfi_val_encoded_addr (int ignored ATTRIBUTE_UNUSED)
/* By default emit .eh_frame only, not .debug_frame. */
#define CFI_EMIT_eh_frame (1 << 0)
#define CFI_EMIT_debug_frame (1 << 1)
#define CFI_EMIT_target (1 << 2)
static int cfi_sections = CFI_EMIT_eh_frame;
static void
@ -1108,6 +1042,10 @@ dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
sections |= CFI_EMIT_eh_frame;
else if (strncmp (name, ".debug_frame", sizeof ".debug_frame") == 0)
sections |= CFI_EMIT_debug_frame;
#ifdef tc_cfi_section_name
else if (strcmp (name, tc_cfi_section_name) == 0)
sections |= CFI_EMIT_target;
#endif
else
{
*input_line_pointer = c;
@ -1170,11 +1108,16 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED)
frchain_now->frch_cfi_data->cur_cfa_offset = 0;
if (!simple)
tc_cfi_frame_initial_instructions ();
if ((cfi_sections & CFI_EMIT_target) != 0)
tc_cfi_startproc ();
}
static void
dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED)
{
struct fde_entry *fde;
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_(".cfi_endproc without corresponding .cfi_startproc"));
@ -1182,9 +1125,14 @@ dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED)
return;
}
fde = frchain_now->frch_cfi_data->cur_fde_data;
cfi_end_fde (symbol_temp_new_now ());
demand_empty_rest_of_line ();
if ((cfi_sections & CFI_EMIT_target) != 0)
tc_cfi_endproc (fde);
}

View File

@ -49,4 +49,81 @@ extern void cfi_add_CFA_same_value (unsigned);
extern void cfi_add_CFA_remember_state (void);
extern void cfi_add_CFA_restore_state (void);
/* Structures for md_cfi_end. */
#if defined (TE_PE) || defined (TE_PEP)
#define SUPPORT_FRAME_LINKONCE 1
#else
#define SUPPORT_FRAME_LINKONCE 0
#endif
struct cfi_insn_data
{
struct cfi_insn_data *next;
#if SUPPORT_FRAME_LINKONCE
segT cur_seg;
#endif
int insn;
union
{
struct
{
unsigned reg;
offsetT offset;
} ri;
struct
{
unsigned reg1;
unsigned reg2;
} rr;
unsigned r;
offsetT i;
struct
{
symbolS *lab1;
symbolS *lab2;
} ll;
struct cfi_escape_data *esc;
struct
{
unsigned reg, encoding;
expressionS exp;
} ea;
} u;
};
struct fde_entry
{
struct fde_entry *next;
#if SUPPORT_FRAME_LINKONCE
segT cur_seg;
#endif
symbolS *start_address;
symbolS *end_address;
struct cfi_insn_data *data;
struct cfi_insn_data **last;
unsigned char per_encoding;
unsigned char lsda_encoding;
expressionS personality;
expressionS lsda;
unsigned int return_column;
unsigned int signal_frame;
#if SUPPORT_FRAME_LINKONCE
int handled;
#endif
};
/* Fake CFI type; outside the byte range of any real CFI insn. */
#define CFI_adjust_cfa_offset 0x100
#define CFI_return_column 0x101
#define CFI_rel_offset 0x102
#define CFI_escape 0x103
#define CFI_signal_frame 0x104
#define CFI_val_encoded_addr 0x105
#endif /* DW2GENCFI_H */

View File

@ -1,3 +1,18 @@
2011-05-09 Paul Brook <paul@codesourcery.com>
* 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.
* gas/tic6x/unwind-3.d: New test.
* gas/tic6x/unwind-3.s: New test.
* gas/tic6x/unwind-bad-1.d: New test.
* gas/tic6x/unwind-bad-1.s: New test.
* gas/tic6x/unwind-bad-1.l: New test.
* gas/tic6x/unwind-bad-2.d: New test.
* gas/tic6x/unwind-bad-2.s: New test.
* gas/tic6x/unwind-bad-2.l: New test.
2011-04-29 Hans-Peter Nilsson <hp@axis.com>
* gas/elf/dwarf2-1.d, gas/elf/dwarf2-2.d: Adjust for change in

View File

@ -0,0 +1,100 @@
#readelf: -u
#name: C6X unwinding directives 1 (little endian)
#as: -mlittle-endian
#source: unwind-1.s
Unwind table index '.c6xabi.exidx' .*
0x0: 0x83020227
Compact model 3
Stack increment 8
Registers restored: A11, B3
Return register: B3
0x100: 0x808003e7
Compact model 0
0x80 0x03 pop {A10, A11}
0xe7 RETURN
0x200: 0x81008863
Compact model 1
0x88 0x63 pop {A10, A11, B3, B10, B15}
0x300: 0x83020227
Compact model 3
Stack increment 8
Registers restored: A11, B3
Return register: B3
0x400: 0x84000227
Compact model 4
Stack increment 0
Registers restored: \(compact\) A11, B3
Return register: B3
0x500: 0x80a022e7
Compact model 0
0xa0 0x22 pop compact {A11, B3}
0xe7 RETURN
0x600: 0x84000227
Compact model 4
Stack increment 0
Registers restored: \(compact\) A11, B3
Return register: B3
0x700: 0x84000637
Compact model 4
Stack increment 0
Registers restored: \(compact\) A10, A11, B3, B10
Return register: B3
0x800: 0x840002d7
Compact model 4
Stack increment 0
Registers restored: \(compact\) A10, A12, A13, B3
Return register: B3
0x900: 0x84000c07
Compact model 4
Stack increment 0
Registers restored: \(compact\) B10, B11
Return register: B3
0xa00: 0x83ff0027
Compact model 3
Restore stack from frame pointer
Registers restored: A11, A15
Return register: B3
0xb00: 0x84ff0027
Compact model 4
Restore stack from frame pointer
Registers restored: \(compact\) A11, A15
Return register: B3
0xc00: 0x8001c1f7
Compact model 0
0x01 sp = sp \+ 16
0xc1 0xf7 pop frame {B3, \[pad\]}
0xd00: @0x.*
Compact model 1
0x01 sp = sp \+ 16
0xc2 0xf7 0xbf pop frame {\[pad\], A11, B3, \[pad\]}
0xe7 RETURN
0xe7 RETURN
0xe00: @0x.*
Compact model 1
0x01 sp = sp \+ 16
0xc2 0xf7 0xfb pop frame {A11, \[pad\], B3, \[pad\]}
0xe7 RETURN
0xe7 RETURN
0xf00: @0x.*
Compact model 1
0x02 sp = sp \+ 24
0xc2 0x7f 0xff 0xfb pop frame {A11, \[pad\], \[pad\], \[pad\], \[pad\], B3}
0xe7 RETURN

View File

@ -0,0 +1,242 @@
.cfi_sections .c6xabi.exidx
# standard layout
.p2align 8
f0:
.cfi_startproc
stw .d2t2 B3, *B15--(16)
.cfi_def_cfa_offset 16
.cfi_offset 19, 0
stw .d2t1 A11, *+B15(12)
.cfi_offset 11, -4
nop 4
.cfi_endproc
.endp
# standard layout (pr0)
.p2align 8
f1:
.cfi_startproc
.cfi_def_cfa_offset 8
stw .d2t1 A11, *+B15(8)
.cfi_offset 11, -0
stw .d2t1 A10, *+B15(4)
.cfi_offset 10, -4
nop 4
.cfi_endproc
.personalityindex 0
.endp
# standard layout (pr1)
.p2align 8
f2:
.cfi_startproc
stw .d2t2 B15, *B15--(24)
.cfi_def_cfa_offset 24
.cfi_offset 31, 0
stw .d2t2 B10, *+B15(20)
.cfi_offset 26, -4
stw .d2t2 B3, *+B15(16)
.cfi_offset 19, -8
stdw .d2t1 A11:A10, *+B15(8)
.cfi_offset 11, -12
.cfi_offset 10, -16
nop 4
.cfi_endproc
.personalityindex 1
.endp
# standard layout (pr3)
.p2align 8
f3:
.cfi_startproc
stw .d2t2 B3, *B15--(16)
.cfi_def_cfa_offset 16
.cfi_offset 19, 0
stw .d2t1 A11, *+B15(12)
.cfi_offset 11, -4
nop 4
.cfi_endproc
.personalityindex 3
.endp
# compact layout
.p2align 8
f4:
.cfi_startproc
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, 0
.cfi_def_cfa_offset 8
stw .d2t1 A11, *B15--(8)
.cfi_offset 11, -8
.cfi_def_cfa_offset 16
nop 4
.cfi_endproc
.endp
# compact layout (pr0)
.p2align 8
f5:
.cfi_startproc
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, 0
.cfi_def_cfa_offset 8
stw .d2t1 A11, *B15--(8)
.cfi_offset 11, -8
.cfi_def_cfa_offset 16
nop 4
.cfi_endproc
.personalityindex 0
.endp
# compact layout (pr4)
.p2align 8
f6:
.cfi_startproc
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, 0
.cfi_def_cfa_offset 8
stw .d2t1 A11, *B15--(8)
.cfi_offset 11, -8
.cfi_def_cfa_offset 16
nop 4
.cfi_endproc
.personalityindex 4
.endp
# compact layout (aligned pair)
.p2align 8
f7:
.cfi_startproc
stw .d2t2 B10, *B15--(8)
.cfi_offset 26, 0
.cfi_def_cfa_offset 8
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, -8
.cfi_def_cfa_offset 8
stdw .d2t1 A11:A10, *B15--(8)
.cfi_offset 11, -12
.cfi_offset 10, -16
.cfi_def_cfa_offset 24
nop 4
.cfi_endproc
.endp
# compact layout (aligned pair + 1)
.p2align 8
f8:
.cfi_startproc
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, 0
.cfi_def_cfa_offset 8
stdw .d2t1 A13:A12, *B15--(8)
.cfi_offset 13, -4
.cfi_offset 12, -8
.cfi_def_cfa_offset 16
stw .d2t1 A10, *B15--(8)
.cfi_offset 10, -16
.cfi_def_cfa_offset 24
nop 4
.cfi_endproc
.endp
# compact layout (misaligned pair)
.p2align 8
f9:
.cfi_startproc
stw .d2t2 B11, *B15--(8)
.cfi_offset 27, 0
.cfi_def_cfa_offset 8
stw .d2t2 B10, *B15--(8)
.cfi_offset 26, -8
.cfi_def_cfa_offset 16
nop 4
.cfi_endproc
.endp
# standard frame pointer
.p2align 8
fa:
.cfi_startproc
stw .d2t1 A15, *B15--(16)
.cfi_def_cfa_offset 8
.cfi_offset 15, 0
mv .s1x B15, A15
addk .s1 16, A15
.cfi_def_cfa 15, 0
stw .d2t1 A11, *+B15(12)
.cfi_offset 11, -4
nop 4
.cfi_endproc
.endp
# compact frame pointer
.p2align 8
fb:
.cfi_startproc
stw .d2t1 A15, *B15--(8)
.cfi_def_cfa_offset 8
.cfi_offset 15, 0
mv .s1x B15, A15
addk .s1 16, A15
.cfi_def_cfa 15, 0
stw .d2t1 A11, *B15--(8)
.cfi_offset 11, -8
nop 4
.cfi_endproc
.endp
# custom layout
.p2align 8
fc:
.cfi_startproc
sub .s2 B15, 16, B15
stw .d2t2 B3, *+B15(12)
.cfi_def_cfa_offset 16
.cfi_offset 19, -4
nop 4
.cfi_endproc
.endp
# custom layout
.p2align 8
fd:
.cfi_startproc
sub .s2 B15, 16, B15
stw .d2t2 B3, *+B15(12)
.cfi_def_cfa_offset 16
.cfi_offset 19, -4
stw .d2t1 A11, *+B15(8)
.cfi_offset 11, -8
nop 4
.cfi_endproc
.endp
# custom layout
.p2align 8
fe:
.cfi_startproc
sub .s2 B15, 16, B15
stw .d2t2 B3, *+B15(12)
.cfi_def_cfa_offset 16
.cfi_offset 19, -4
stw .d2t1 A11, *+B15(4)
.cfi_offset 11, -12
nop 4
.cfi_endproc
.endp
# custom layout
.p2align 8
ff:
.cfi_startproc
addk .s2 -24, B15
stw .d2t2 B3, *+B15(24)
.cfi_def_cfa_offset 24
.cfi_offset 19, 0
stw .d2t1 A11, *+B15(4)
.cfi_offset 11, -20
nop 4
.cfi_endproc
.endp

View File

@ -0,0 +1,100 @@
#readelf: -u
#name: C6X unwinding directives 2 (big endian)
#as: -mbig-endian
#source: unwind-2.s
Unwind table index '.c6xabi.exidx' .*
0x0: 0x83020227
Compact model 3
Stack increment 8
Registers restored: A11, B3
Return register: B3
0x100: 0x808003e7
Compact model 0
0x80 0x03 pop {A10, A11}
0xe7 RETURN
0x200: 0x81008863
Compact model 1
0x88 0x63 pop {A10, A11, B3, B10, B15}
0x300: 0x83020227
Compact model 3
Stack increment 8
Registers restored: A11, B3
Return register: B3
0x400: 0x84000227
Compact model 4
Stack increment 0
Registers restored: \(compact\) A11, B3
Return register: B3
0x500: 0x80a022e7
Compact model 0
0xa0 0x22 pop compact {A11, B3}
0xe7 RETURN
0x600: 0x84000227
Compact model 4
Stack increment 0
Registers restored: \(compact\) A11, B3
Return register: B3
0x700: 0x84000637
Compact model 4
Stack increment 0
Registers restored: \(compact\) A10, A11, B3, B10
Return register: B3
0x800: 0x840002d7
Compact model 4
Stack increment 0
Registers restored: \(compact\) A10, A12, A13, B3
Return register: B3
0x900: 0x84000c07
Compact model 4
Stack increment 0
Registers restored: \(compact\) B10, B11
Return register: B3
0xa00: 0x83ff0027
Compact model 3
Restore stack from frame pointer
Registers restored: A11, A15
Return register: B3
0xb00: 0x84ff0027
Compact model 4
Restore stack from frame pointer
Registers restored: \(compact\) A11, A15
Return register: B3
0xc00: 0x8001c1f7
Compact model 0
0x01 sp = sp \+ 16
0xc1 0xf7 pop frame {B3, \[pad\]}
0xd00: @0x.*
Compact model 1
0x01 sp = sp \+ 16
0xc2 0xf7 0xbf pop frame {\[pad\], A11, B3, \[pad\]}
0xe7 RETURN
0xe7 RETURN
0xe00: @0x.*
Compact model 1
0x01 sp = sp \+ 16
0xc2 0xf7 0xfb pop frame {A11, \[pad\], B3, \[pad\]}
0xe7 RETURN
0xe7 RETURN
0xf00: @0x.*
Compact model 1
0x02 sp = sp \+ 24
0xc2 0x7f 0xff 0xfb pop frame {A11, \[pad\], \[pad\], \[pad\], \[pad\], B3}
0xe7 RETURN

View File

@ -0,0 +1,242 @@
.cfi_sections .c6xabi.exidx
# standard layout
.p2align 8
f0:
.cfi_startproc
stw .d2t2 B3, *B15--(16)
.cfi_def_cfa_offset 16
.cfi_offset 19, 0
stw .d2t1 A11, *+B15(12)
.cfi_offset 11, -4
nop 4
.cfi_endproc
.endp
# standard layout (pr0)
.p2align 8
f1:
.cfi_startproc
.cfi_def_cfa_offset 8
stw .d2t1 A11, *+B15(8)
.cfi_offset 11, -0
stw .d2t1 A10, *+B15(4)
.cfi_offset 10, -4
nop 4
.cfi_endproc
.personalityindex 0
.endp
# standard layout (pr1)
.p2align 8
f2:
.cfi_startproc
stw .d2t2 B15, *B15--(24)
.cfi_def_cfa_offset 24
.cfi_offset 31, 0
stw .d2t2 B10, *+B15(20)
.cfi_offset 26, -4
stw .d2t2 B3, *+B15(16)
.cfi_offset 19, -8
stdw .d2t1 A11:A10, *+B15(8)
.cfi_offset 11, -16
.cfi_offset 10, -12
nop 4
.cfi_endproc
.personalityindex 1
.endp
# standard layout (pr3)
.p2align 8
f3:
.cfi_startproc
stw .d2t2 B3, *B15--(16)
.cfi_def_cfa_offset 16
.cfi_offset 19, 0
stw .d2t1 A11, *+B15(12)
.cfi_offset 11, -4
nop 4
.cfi_endproc
.personalityindex 3
.endp
# compact layout
.p2align 8
f4:
.cfi_startproc
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, 0
.cfi_def_cfa_offset 8
stw .d2t1 A11, *B15--(8)
.cfi_offset 11, -8
.cfi_def_cfa_offset 16
nop 4
.cfi_endproc
.endp
# compact layout (pr0)
.p2align 8
f5:
.cfi_startproc
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, 0
.cfi_def_cfa_offset 8
stw .d2t1 A11, *B15--(8)
.cfi_offset 11, -8
.cfi_def_cfa_offset 16
nop 4
.cfi_endproc
.personalityindex 0
.endp
# compact layout (pr4)
.p2align 8
f6:
.cfi_startproc
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, 0
.cfi_def_cfa_offset 8
stw .d2t1 A11, *B15--(8)
.cfi_offset 11, -8
.cfi_def_cfa_offset 16
nop 4
.cfi_endproc
.personalityindex 4
.endp
# compact layout (aligned pair)
.p2align 8
f7:
.cfi_startproc
stw .d2t2 B10, *B15--(8)
.cfi_offset 26, 0
.cfi_def_cfa_offset 8
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, -8
.cfi_def_cfa_offset 8
stdw .d2t1 A11:A10, *B15--(8)
.cfi_offset 11, -16
.cfi_offset 10, -12
.cfi_def_cfa_offset 24
nop 4
.cfi_endproc
.endp
# compact layout (aligned pair + 1)
.p2align 8
f8:
.cfi_startproc
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, 0
.cfi_def_cfa_offset 8
stdw .d2t1 A13:A12, *B15--(8)
.cfi_offset 13, -8
.cfi_offset 12, -4
.cfi_def_cfa_offset 16
stw .d2t1 A10, *B15--(8)
.cfi_offset 10, -16
.cfi_def_cfa_offset 24
nop 4
.cfi_endproc
.endp
# compact layout (misaligned pair)
.p2align 8
f9:
.cfi_startproc
stw .d2t2 B11, *B15--(8)
.cfi_offset 27, 0
.cfi_def_cfa_offset 8
stw .d2t2 B10, *B15--(8)
.cfi_offset 26, -8
.cfi_def_cfa_offset 16
nop 4
.cfi_endproc
.endp
# standard frame pointer
.p2align 8
fa:
.cfi_startproc
stw .d2t1 A15, *B15--(16)
.cfi_def_cfa_offset 8
.cfi_offset 15, 0
mv .s1x B15, A15
addk .s1 16, A15
.cfi_def_cfa 15, 0
stw .d2t1 A11, *+B15(12)
.cfi_offset 11, -4
nop 4
.cfi_endproc
.endp
# compact frame pointer
.p2align 8
fb:
.cfi_startproc
stw .d2t1 A15, *B15--(8)
.cfi_def_cfa_offset 8
.cfi_offset 15, 0
mv .s1x B15, A15
addk .s1 16, A15
.cfi_def_cfa 15, 0
stw .d2t1 A11, *B15--(8)
.cfi_offset 11, -8
nop 4
.cfi_endproc
.endp
# custom layout
.p2align 8
fc:
.cfi_startproc
sub .s2 B15, 16, B15
stw .d2t2 B3, *+B15(12)
.cfi_def_cfa_offset 16
.cfi_offset 19, -4
nop 4
.cfi_endproc
.endp
# custom layout
.p2align 8
fd:
.cfi_startproc
sub .s2 B15, 16, B15
stw .d2t2 B3, *+B15(12)
.cfi_def_cfa_offset 16
.cfi_offset 19, -4
stw .d2t1 A11, *+B15(8)
.cfi_offset 11, -8
nop 4
.cfi_endproc
.endp
# custom layout
.p2align 8
fe:
.cfi_startproc
sub .s2 B15, 16, B15
stw .d2t2 B3, *+B15(12)
.cfi_def_cfa_offset 16
.cfi_offset 19, -4
stw .d2t1 A11, *+B15(4)
.cfi_offset 11, -12
nop 4
.cfi_endproc
.endp
# custom layout
.p2align 8
ff:
.cfi_startproc
addk .s2 -24, B15
stw .d2t2 B3, *+B15(24)
.cfi_def_cfa_offset 24
.cfi_offset 19, 0
stw .d2t1 A11, *+B15(4)
.cfi_offset 11, -20
nop 4
.cfi_endproc
.endp

View File

@ -0,0 +1,18 @@
#readelf: -u
#name: C6X unwinding directives 3 (segment change)
#source: unwind-3.s
Unwind table index '.c6xabi.exidx.text.bar' .*
0x0: 0x830e2807
Compact model 3
Stack increment 56
Registers restored: B11, B13
Return register: B3
Unwind table index '.c6xabi.exidx' .*
0x0: 0x80008021
Compact model 0
0x00 sp = sp \+ 8
0x80 0x21 pop {A10, B3}

View File

@ -0,0 +1,33 @@
.cfi_sections .c6xabi.exidx
.text
# standard layout
.p2align 8
foo:
.cfi_startproc
.personalityindex 0
stw .d2t2 B3, *B15--(16)
.cfi_def_cfa_offset 16
.cfi_offset B3, 0
.section .text.bar, "ax"
bar:
.cfi_startproc
stw .d2t2 B13, *B15--(16)
.cfi_def_cfa_offset 64
.cfi_offset B13, 0
stw .d2t2 B13, *+B15(12)
.cfi_offset B11, -4
nop 4
.cfi_endproc
.endp
.text
stw .d2t1 A10, *+B15(12)
.cfi_offset A10, -4
nop 4
.cfi_endproc
.endp

View File

@ -0,0 +1,3 @@
#name: C6X unwinding directive errors
#error-output: unwind-bad-1.l

View File

@ -0,0 +1,12 @@
[^:]*: Assembler messages:
[^:]*:4: Error: unexpected \.handlerdata directive
[^:]*:9: Error: duplicate \.personalityindex directive
[^:]*:11: Error: personality routine specified for cantunwind frame
[^:]*:19: Error: personality routine specified for cantunwind frame
[^:]*:29: Error: duplicate \.personality directive
[^:]*:32: Error: unexpected \.cantunwind directive
[^:]*:34: Error: duplicate \.handlerdata directive
[^:]*:41: Error: personality routine required before \.handlerdata directive
[^:]*:48: Error: bad personality routine number
[^:]*:50: Error: bad personality routine number
[^:]*:59: Error: missing \.endp before \.cfi_startproc

View File

@ -0,0 +1,62 @@
.cfi_sections .c6xabi.exidx
# unexpected .handlerdata directive
.handlerdata
.cfi_startproc
.personalityindex 0
# duplicate .personalityindex directive
.personalityindex 1
# personality routine specified for cantunwind frame
.cantunwind
nop
.cfi_endproc
.endp
.cfi_startproc
.personality foo
# personality routine specified for cantunwind frame
.cantunwind
nop
.cfi_endproc
.endp
.cfi_startproc
nop
.cfi_endproc
.personality foo
# duplicate .personality directive
.personality bar
.handlerdata
# unexpected .cantunwind directive
.cantunwind
# duplicate .handlerdata directive
.handlerdata
.endp
.cfi_startproc
nop
.cfi_endproc
# personality routine required before .handlerdata directive
.handlerdata
.endp
.cfi_startproc
nop
.cfi_endproc
# bad personality routine number
.personalityindex 16
# bad personality routine number
.personalityindex -1
.endp
.cfi_startproc
nop
.cfi_endproc
.personalityindex 1
.handlerdata
# missing .endp before .cfi_startproc
.cfi_startproc
.cfi_endproc
.endp

View File

@ -0,0 +1,3 @@
#name: C6X unwinding bad frame layouts
#error-output: unwind-bad-2.l

View File

@ -0,0 +1,14 @@
[^:]*: Assembler messages:
[^:]*:8: Error: stack pointer offset too large for personality routine
[^:]*:20: Error: stack frame layout does not match personality routine
[^:]*:33: Error: stack frame layout does not match personality routine
[^:]*:39: Error: unable to generate unwinding opcode for reg 20
[^:]*:46: Error: unable to generate unwinding opcode for reg 20
[^:]*:53: Error: unable to generate unwinding opcode for reg 20
[^:]*:63: Error: unable to restore return address from previously restored reg
[^:]*:70: Error: unhandled CFA insn for unwinding \(259\)
[^:]*:77: Error: unable to generate unwinding opcode for frame pointer reg 14
[^:]*:84: Error: unable to generate unwinding opcode for frame pointer offset
[^:]*:91: Error: unwound stack pointer not doubleword aligned
[^:]*:100: Error: stack frame layout too complex for unwinder
[^:]*:110: Error: unwound frame has negative size

View File

@ -0,0 +1,113 @@
.cfi_sections .c6xabi.exidx
.cfi_startproc
# stack pointer offset too large for personality routine
.cfi_def_cfa_offset 0x3f8
.cfi_endproc
.personalityindex 3
.endp
.cfi_startproc
.cfi_def_cfa_offset 8
stw .d2t1 A11, *+B15(8)
.cfi_offset 11, -0
stw .d2t1 A10, *+B15(4)
.cfi_offset 10, -4
nop 4
.cfi_endproc
# stack frame layout does not match personality routine
.personalityindex 4
.endp
.cfi_startproc
stw .d2t2 B3, *B15--(8)
.cfi_offset 19, 0
.cfi_def_cfa_offset 8
stw .d2t1 A11, *B15--(8)
.cfi_offset 11, -8
.cfi_def_cfa_offset 16
nop 4
.cfi_endproc
# stack frame layout does not match personality routine
.personalityindex 3
.endp
.cfi_startproc
stw .d2t2 B4, *B15--(8)
# unable to generate unwinding opcode for reg 20
.cfi_offset 20, 0
.cfi_endproc
.endp
.cfi_startproc
mv .s2 B3, B4
# unable to generate unwinding opcode for reg 20
.cfi_register 19, 20
.cfi_endproc
.endp
.cfi_startproc
mv .s2 B4, B3
# unable to generate unwinding opcode for reg 20
.cfi_register 20, 19
.cfi_endproc
.endp
.cfi_startproc
stw .d2t2 B10, *B15--(8)
# unable to generate unwinding opcode for reg 20
.cfi_offset 26, 0
mv .s2 B3, B10
# unable to restore return address from previously restored reg
.cfi_register 19, 26
.cfi_endproc
.endp
.cfi_startproc
nop
# unhandled CFA insn for unwinding (259)
.cfi_escape 42
.cfi_endproc
.endp
.cfi_startproc
nop
# unable to generate unwinding opcode for frame pointer reg 14
.cfi_def_cfa_register 14
.cfi_endproc
.endp
.cfi_startproc
nop
# unable to generate unwinding opcode for frame pointer offset
.cfi_def_cfa 15, 8
.cfi_endproc
.endp
.cfi_startproc
nop
# unwound stack pointer not doubleword aligned
.cfi_def_cfa_offset 12
.cfi_endproc
.endp
.cfi_startproc
nop
.cfi_offset 10, 0
# stack frame layout too complex for unwinder
.cfi_offset 11, -0x808
.cfi_def_cfa_offset 0x10000
.cfi_endproc
.endp
.cfi_startproc
nop
.cfi_offset 12, -0
.cfi_offset 11, -4
.cfi_offset 10, -8
.cfi_def_cfa_offset 8
# unwound frame has negative size
.cfi_endproc
.endp

View File

@ -1,3 +1,9 @@
2011-05-09 Paul Brook <paul@codesourcery.com>
* elf/tic6x.h (ELF_STRING_C6000_unwind,
ELF_STRING_C6000_unwind_info, ELF_STRING_C6000_unwind_once,
ELF_STRING_C6000_unwind_info_once): Define.
2011-04-30 Jakub Jelinek <jakub@redhat.com>
* dwarf2.h (DW_OP_GNU_const_type, DW_OP_GNU_regval_type,

View File

@ -158,4 +158,10 @@ enum
C6XABI_Tag_ISA_C674X = 8
};
/* Special section names. */
#define ELF_STRING_C6000_unwind ".c6xabi.exidx"
#define ELF_STRING_C6000_unwind_info ".c6xabi.extab"
#define ELF_STRING_C6000_unwind_once ".gnu.linkonce.c6xabi.exidx."
#define ELF_STRING_C6000_unwind_info_once ".gnu.linkonce.c6xabi.extab."
#endif /* _ELF_TIC6X_H */