+ expression_and_evaluate (&fde->personality);
+ switch (fde->personality.X_op)
+ {
+ case O_symbol:
+ break;
+ case O_constant:
+ if ((encoding & 0x70) == DW_EH_PE_pcrel)
+ encoding = DW_EH_PE_omit;
+ break;
+ default:
+ encoding = DW_EH_PE_omit;
+ break;
+ }
+
+ fde->per_encoding = encoding;
+
+ if (encoding == DW_EH_PE_omit)
+ {
+ as_bad (_("wrong second argument to .cfi_personality"));
+ ignore_rest_of_line ();
+ return;
+ }
+
+ demand_empty_rest_of_line ();
+}
+
+static void
+dot_cfi_lsda (int ignored ATTRIBUTE_UNUSED)
+{
+ struct fde_entry *fde;
+ offsetT encoding;
+
+ if (frchain_now->frch_cfi_data == NULL)
+ {
+ as_bad (_("CFI instruction used without previous .cfi_startproc"));
+ ignore_rest_of_line ();
+ return;
+ }
+
+ fde = frchain_now->frch_cfi_data->cur_fde_data;
+ encoding = cfi_parse_const ();
+ if (encoding == DW_EH_PE_omit)
+ {
+ demand_empty_rest_of_line ();
+ fde->lsda_encoding = encoding;
+ return;
+ }
+
+ if ((encoding & 0xff) != encoding
+ || ((((encoding & 0x70) != 0
+#if CFI_DIFF_LSDA_OK || defined tc_cfi_emit_pcrel_expr
+ && (encoding & 0x70) != DW_EH_PE_pcrel
+#endif
+ )
+ /* leb128 can be handled, but does something actually need it? */
+ || (encoding & 7) == DW_EH_PE_uleb128
+ || (encoding & 7) > DW_EH_PE_udata8)
+ && tc_cfi_reloc_for_encoding (encoding) == BFD_RELOC_NONE))
+ {
+ as_bad (_("invalid or unsupported encoding in .cfi_lsda"));
+ ignore_rest_of_line ();
+ return;
+ }
+
+ if (*input_line_pointer++ != ',')
+ {
+ as_bad (_(".cfi_lsda requires encoding and symbol arguments"));
+ ignore_rest_of_line ();
+ return;
+ }
+
+ fde->lsda_encoding = encoding;
+
+ expression_and_evaluate (&fde->lsda);
+ switch (fde->lsda.X_op)
+ {
+ case O_symbol:
+ break;
+ case O_constant:
+ if ((encoding & 0x70) == DW_EH_PE_pcrel)
+ encoding = DW_EH_PE_omit;
+ break;
+ default:
+ encoding = DW_EH_PE_omit;
+ break;
+ }
+
+ fde->lsda_encoding = encoding;
+
+ if (encoding == DW_EH_PE_omit)
+ {
+ as_bad (_("wrong second argument to .cfi_lsda"));
+ ignore_rest_of_line ();
+ return;
+ }
+
+ demand_empty_rest_of_line ();
+}
+
+static void
+dot_cfi_val_encoded_addr (int ignored ATTRIBUTE_UNUSED)
+{
+ struct cfi_insn_data *insn_ptr;
+ offsetT encoding;
+
+ if (frchain_now->frch_cfi_data == NULL)
+ {
+ as_bad (_("CFI instruction used without previous .cfi_startproc"));
+ ignore_rest_of_line ();
+ return;
+ }
+
+ /* If the last address was not at the current PC, advance to current. */
+ if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
+ || (S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
+ != frag_now_fix ()))
+ cfi_add_advance_loc (symbol_temp_new_now ());
+
+ insn_ptr = alloc_cfi_insn_data ();
+ insn_ptr->insn = CFI_val_encoded_addr;
+
+ insn_ptr->u.ea.reg = cfi_parse_reg ();
+
+ cfi_parse_separator ();
+ encoding = cfi_parse_const ();
+ if ((encoding & 0xff) != encoding
+ || ((encoding & 0x70) != 0
+#if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
+ && (encoding & 0x70) != DW_EH_PE_pcrel
+#endif
+ )
+ /* leb128 can be handled, but does something actually need it? */
+ || (encoding & 7) == DW_EH_PE_uleb128
+ || (encoding & 7) > DW_EH_PE_udata8)
+ {
+ as_bad (_("invalid or unsupported encoding in .cfi_lsda"));
+ encoding = DW_EH_PE_omit;
+ }
+
+ cfi_parse_separator ();
+ expression_and_evaluate (&insn_ptr->u.ea.exp);
+ switch (insn_ptr->u.ea.exp.X_op)
+ {
+ case O_symbol:
+ break;
+ case O_constant:
+ if ((encoding & 0x70) != DW_EH_PE_pcrel)
+ break;
+ /* Fall through. */
+ default:
+ encoding = DW_EH_PE_omit;
+ break;
+ }
+
+ insn_ptr->u.ea.encoding = encoding;
+ if (encoding == DW_EH_PE_omit)
+ {
+ as_bad (_("wrong third argument to .cfi_val_encoded_addr"));
+ ignore_rest_of_line ();
+ return;
+ }
+
+ demand_empty_rest_of_line ();
+}
+
+static void
+dot_cfi_label (int ignored ATTRIBUTE_UNUSED)
+{
+ char *name = read_symbol_name ();
+
+ if (name == NULL)
+ return;
+
+ /* If the last address was not at the current PC, advance to current. */
+ if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
+ || (S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
+ != frag_now_fix ()))
+ cfi_add_advance_loc (symbol_temp_new_now ());
+
+ cfi_add_label (name);
+ free (name);
+
+ demand_empty_rest_of_line ();
+}
+
+static void
+dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
+{
+ int sections = 0;
+
+ SKIP_WHITESPACE ();
+ if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
+ while (1)
+ {
+ char * saved_ilp;
+ char *name, c;
+
+ saved_ilp = input_line_pointer;
+ c = get_symbol_name (& name);
+
+ if (strncmp (name, ".eh_frame", sizeof ".eh_frame") == 0
+ && name[9] != '_')
+ sections |= CFI_EMIT_eh_frame;
+ else if (strncmp (name, ".debug_frame", sizeof ".debug_frame") == 0)
+ sections |= CFI_EMIT_debug_frame;
+#if SUPPORT_COMPACT_EH
+ else if (strncmp (name, ".eh_frame_entry",
+ sizeof ".eh_frame_entry") == 0)
+ {
+ compact_eh = TRUE;
+ sections |= CFI_EMIT_eh_frame_compact;
+ }
+#endif
+#ifdef tc_cfi_section_name
+ else if (strcmp (name, tc_cfi_section_name) == 0)
+ sections |= CFI_EMIT_target;
+#endif
+ else
+ {
+ *input_line_pointer = c;
+ input_line_pointer = saved_ilp;
+ break;
+ }
+
+ *input_line_pointer = c;
+ SKIP_WHITESPACE_AFTER_NAME ();
+ if (*input_line_pointer == ',')
+ {
+ name = input_line_pointer++;
+ SKIP_WHITESPACE ();
+ if (!is_name_beginner (*input_line_pointer)
+ && *input_line_pointer != '"')
+ {
+ input_line_pointer = name;
+ break;
+ }
+ }
+ else if (is_name_beginner (*input_line_pointer)
+ || *input_line_pointer == '"')
+ break;
+ }
+
+ demand_empty_rest_of_line ();
+ if (cfi_sections_set
+ && (sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))
+ && ((cfi_sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))
+ != (sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))))
+ as_bad (_("inconsistent uses of .cfi_sections"));
+ cfi_sections = sections;
+}
+
+static void
+dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED)
+{
+ int simple = 0;
+
+ if (frchain_now->frch_cfi_data != NULL)
+ {
+ as_bad (_("previous CFI entry not closed (missing .cfi_endproc)"));
+ ignore_rest_of_line ();
+ return;
+ }
+
+ cfi_new_fde (symbol_temp_new_now ());
+
+ SKIP_WHITESPACE ();
+ if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
+ {
+ char * saved_ilp = input_line_pointer;
+ char *name, c;
+
+ c = get_symbol_name (& name);
+
+ if (strcmp (name, "simple") == 0)
+ {
+ simple = 1;
+ restore_line_pointer (c);
+ }
+ else
+ input_line_pointer = saved_ilp;
+ }
+ demand_empty_rest_of_line ();
+
+ cfi_sections_set = TRUE;
+ all_cfi_sections |= cfi_sections;
+ cfi_set_sections ();
+ 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 ();