summaryrefslogtreecommitdiff
path: root/gas/dw2gencfi.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2011-05-09 13:17:55 +0000
committerPaul Brook <paul@codesourcery.com>2011-05-09 13:17:55 +0000
commit97056b16f5cc4986a9762d3b745f16b914c1c966 (patch)
tree8c08c44cd6533fadd694ee14fa4acdecc8088029 /gas/dw2gencfi.c
parent2c329ecfb11c0bc400d956c57e5f9fdaf725469f (diff)
downloadbinutils-redhat-97056b16f5cc4986a9762d3b745f16b914c1c966.tar.gz
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.
Diffstat (limited to 'gas/dw2gencfi.c')
-rw-r--r--gas/dw2gencfi.c98
1 files changed, 23 insertions, 75 deletions
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index 705157bff1..c35240bb35 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -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);
}