Subversion Repositories Kolibri OS

Rev

Rev 5222 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /* dw2gencfi.c - Support for generating Dwarf2 CFI information.
  2.    Copyright (C) 2003-2015 Free Software Foundation, Inc.
  3.    Contributed by Michal Ludvig <mludvig@suse.cz>
  4.  
  5.    This file is part of GAS, the GNU Assembler.
  6.  
  7.    GAS is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 3, or (at your option)
  10.    any later version.
  11.  
  12.    GAS is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with GAS; see the file COPYING.  If not, write to the Free
  19.    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
  20.    02110-1301, USA.  */
  21.  
  22. #include "as.h"
  23. #include "dw2gencfi.h"
  24. #include "subsegs.h"
  25. #include "dwarf2dbg.h"
  26.  
  27. #ifdef TARGET_USE_CFIPOP
  28.  
  29. /* By default, use difference expressions if DIFF_EXPR_OK is defined.  */
  30. #ifndef CFI_DIFF_EXPR_OK
  31. # ifdef DIFF_EXPR_OK
  32. #  define CFI_DIFF_EXPR_OK 1
  33. # else
  34. #  define CFI_DIFF_EXPR_OK 0
  35. # endif
  36. #endif
  37.  
  38. #ifndef CFI_DIFF_LSDA_OK
  39. #define CFI_DIFF_LSDA_OK CFI_DIFF_EXPR_OK
  40. #endif
  41.  
  42. #if CFI_DIFF_EXPR_OK == 1 && CFI_DIFF_LSDA_OK == 0
  43. # error "CFI_DIFF_EXPR_OK should imply CFI_DIFF_LSDA_OK"
  44. #endif
  45.  
  46. /* We re-use DWARF2_LINE_MIN_INSN_LENGTH for the code alignment field
  47.    of the CIE.  Default to 1 if not otherwise specified.  */
  48. #ifndef DWARF2_LINE_MIN_INSN_LENGTH
  49. #define DWARF2_LINE_MIN_INSN_LENGTH 1
  50. #endif
  51.  
  52. /* By default, use 32-bit relocations from .eh_frame into .text.  */
  53. #ifndef DWARF2_FDE_RELOC_SIZE
  54. #define DWARF2_FDE_RELOC_SIZE 4
  55. #endif
  56.  
  57. /* By default, use a read-only .eh_frame section.  */
  58. #ifndef DWARF2_EH_FRAME_READ_ONLY
  59. #define DWARF2_EH_FRAME_READ_ONLY SEC_READONLY
  60. #endif
  61.  
  62. #ifndef EH_FRAME_ALIGNMENT
  63. #define EH_FRAME_ALIGNMENT (bfd_get_arch_size (stdoutput) == 64 ? 3 : 2)
  64. #endif
  65.  
  66. #ifndef tc_cfi_frame_initial_instructions
  67. #define tc_cfi_frame_initial_instructions() ((void)0)
  68. #endif
  69.  
  70. #ifndef tc_cfi_startproc
  71. # define tc_cfi_startproc() ((void)0)
  72. #endif
  73.  
  74. #ifndef tc_cfi_endproc
  75. # define tc_cfi_endproc(fde) ((void) (fde))
  76. #endif
  77.  
  78. #define EH_FRAME_LINKONCE (SUPPORT_FRAME_LINKONCE || compact_eh)
  79.  
  80. #ifndef DWARF2_FORMAT
  81. #define DWARF2_FORMAT(SEC) dwarf2_format_32bit
  82. #endif
  83.  
  84. #ifndef DWARF2_ADDR_SIZE
  85. #define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8)
  86. #endif
  87.  
  88. #if MULTIPLE_FRAME_SECTIONS
  89. #define CUR_SEG(structp) structp->cur_seg
  90. #define SET_CUR_SEG(structp, seg) structp->cur_seg = seg
  91. #define HANDLED(structp) structp->handled
  92. #define SET_HANDLED(structp, val) structp->handled = val
  93. #else
  94. #define CUR_SEG(structp) NULL
  95. #define SET_CUR_SEG(structp, seg) (void) (0 && seg)
  96. #define HANDLED(structp) 0
  97. #define SET_HANDLED(structp, val) (void) (0 && val)
  98. #endif
  99.  
  100. #ifndef tc_cfi_reloc_for_encoding
  101. #define tc_cfi_reloc_for_encoding(e) BFD_RELOC_NONE
  102. #endif
  103.  
  104. /* Private segment collection list.  */
  105. struct dwcfi_seg_list
  106. {
  107.   segT   seg;
  108.   int    subseg;
  109.   char * seg_name;
  110. };
  111.  
  112. #ifdef SUPPORT_COMPACT_EH
  113. static bfd_boolean compact_eh;
  114. #else
  115. #define compact_eh 0
  116. #endif
  117.  
  118. static struct hash_control *dwcfi_hash;
  119. /* Emit a single byte into the current segment.  */
  120.  
  121. static inline void
  122. out_one (int byte)
  123. {
  124.   FRAG_APPEND_1_CHAR (byte);
  125. }
  126.  
  127. /* Emit a two-byte word into the current segment.  */
  128.  
  129. static inline void
  130. out_two (int data)
  131. {
  132.   md_number_to_chars (frag_more (2), data, 2);
  133. }
  134.  
  135. /* Emit a four byte word into the current segment.  */
  136.  
  137. static inline void
  138. out_four (int data)
  139. {
  140.   md_number_to_chars (frag_more (4), data, 4);
  141. }
  142.  
  143. /* Emit an unsigned "little-endian base 128" number.  */
  144.  
  145. static void
  146. out_uleb128 (addressT value)
  147. {
  148.   output_leb128 (frag_more (sizeof_leb128 (value, 0)), value, 0);
  149. }
  150.  
  151. /* Emit an unsigned "little-endian base 128" number.  */
  152.  
  153. static void
  154. out_sleb128 (offsetT value)
  155. {
  156.   output_leb128 (frag_more (sizeof_leb128 (value, 1)), value, 1);
  157. }
  158.  
  159. static offsetT
  160. encoding_size (unsigned char encoding)
  161. {
  162.   if (encoding == DW_EH_PE_omit)
  163.     return 0;
  164.   switch (encoding & 0x7)
  165.     {
  166.     case 0:
  167.       return bfd_get_arch_size (stdoutput) == 64 ? 8 : 4;
  168.     case DW_EH_PE_udata2:
  169.       return 2;
  170.     case DW_EH_PE_udata4:
  171.       return 4;
  172.     case DW_EH_PE_udata8:
  173.       return 8;
  174.     default:
  175.       abort ();
  176.     }
  177. }
  178.  
  179. /* Emit expression EXP in ENCODING.  If EMIT_ENCODING is true, first
  180.    emit a byte containing ENCODING.  */
  181.  
  182. static void
  183. emit_expr_encoded (expressionS *exp, int encoding, bfd_boolean emit_encoding)
  184. {
  185.   offsetT size = encoding_size (encoding);
  186.   bfd_reloc_code_real_type code;
  187.  
  188.   if (encoding == DW_EH_PE_omit)
  189.     return;
  190.  
  191.   if (emit_encoding)
  192.     out_one (encoding);
  193.  
  194.   code = tc_cfi_reloc_for_encoding (encoding);
  195.   if (code != BFD_RELOC_NONE)
  196.     {
  197.       reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, code);
  198.       char *p = frag_more (size);
  199.       md_number_to_chars (p, 0, size);
  200.       fix_new (frag_now, p - frag_now->fr_literal, size, exp->X_add_symbol,
  201.                exp->X_add_number, howto->pc_relative, code);
  202.     }
  203.   else if ((encoding & 0x70) == DW_EH_PE_pcrel)
  204.     {
  205. #if CFI_DIFF_EXPR_OK
  206.       expressionS tmp = *exp;
  207.       tmp.X_op = O_subtract;
  208.       tmp.X_op_symbol = symbol_temp_new_now ();
  209.       emit_expr (&tmp, size);
  210. #elif defined (tc_cfi_emit_pcrel_expr)
  211.       tc_cfi_emit_pcrel_expr (exp, size);
  212. #else
  213.       abort ();
  214. #endif
  215.     }
  216.   else
  217.     emit_expr (exp, size);
  218. }
  219. /* Build based on segment the derived .debug_...
  220.    segment name containing origin segment's postfix name part.  */
  221.  
  222. static char *
  223. get_debugseg_name (segT seg, const char *base_name)
  224. {
  225.   const char *name;
  226.  
  227.   if (!seg)
  228.     name = "";
  229.   else
  230.     {
  231.       const char * dollar;
  232.       const char * dot;
  233.  
  234.       name = bfd_get_section_name (stdoutput, seg);
  235.  
  236.       dollar = strchr (name, '$');
  237.       dot = strchr (name + 1, '.');
  238.  
  239.       if (!dollar && !dot)
  240.         {
  241.           if (!strcmp (base_name, ".eh_frame_entry")
  242.               && strcmp (name, ".text") != 0)
  243.             return concat (base_name, ".", name, NULL);
  244.  
  245.           name = "";
  246.         }
  247.       else if (!dollar)
  248.         name = dot;
  249.       else if (!dot)
  250.         name = dollar;
  251.       else if (dot < dollar)
  252.         name = dot;
  253.       else
  254.         name = dollar;
  255.     }
  256.  
  257.   return concat (base_name, name, NULL);
  258. }
  259.  
  260. /* Allocate a dwcfi_seg_list structure.  */
  261.  
  262. static struct dwcfi_seg_list *
  263. alloc_debugseg_item (segT seg, int subseg, char *name)
  264. {
  265.   struct dwcfi_seg_list *r;
  266.  
  267.   r = (struct dwcfi_seg_list *)
  268.     xmalloc (sizeof (struct dwcfi_seg_list) + strlen (name));
  269.   r->seg = seg;
  270.   r->subseg = subseg;
  271.   r->seg_name = name;
  272.   return r;
  273. }
  274.  
  275. static segT
  276. is_now_linkonce_segment (void)
  277. {
  278.   if (compact_eh)
  279.     return now_seg;
  280.  
  281.   if ((bfd_get_section_flags (stdoutput, now_seg)
  282.        & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
  283.           | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE
  284.           | SEC_LINK_DUPLICATES_SAME_CONTENTS)) != 0)
  285.     return now_seg;
  286.   return NULL;
  287. }
  288.  
  289. /* Generate debug... segment with same linkonce properties
  290.    of based segment.  */
  291.  
  292. static segT
  293. make_debug_seg (segT cseg, char *name, int sflags)
  294. {
  295.   segT save_seg = now_seg;
  296.   int save_subseg = now_subseg;
  297.   segT r;
  298.   flagword flags;
  299.  
  300.   r = subseg_new (name, 0);
  301.  
  302.   /* Check if code segment is marked as linked once.  */
  303.   if (!cseg)
  304.     flags = 0;
  305.   else
  306.     flags = bfd_get_section_flags (stdoutput, cseg)
  307.       & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
  308.          | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE
  309.          | SEC_LINK_DUPLICATES_SAME_CONTENTS);
  310.  
  311.   /* Add standard section flags.  */
  312.   flags |= sflags;
  313.  
  314.   /* Apply possibly linked once flags to new generated segment, too.  */
  315.   if (!bfd_set_section_flags (stdoutput, r, flags))
  316.     as_bad (_("bfd_set_section_flags: %s"),
  317.             bfd_errmsg (bfd_get_error ()));
  318.  
  319.   /* Restore to previous segment.  */
  320.   if (save_seg != NULL)
  321.     subseg_set (save_seg, save_subseg);
  322.   return r;
  323. }
  324.  
  325. static void
  326. dwcfi_hash_insert (const char *name, struct dwcfi_seg_list *item)
  327. {
  328.   const char *error_string;
  329.  
  330.   if ((error_string = hash_jam (dwcfi_hash, name, (char *) item)))
  331.     as_fatal (_("Inserting \"%s\" into structure table failed: %s"),
  332.               name, error_string);
  333. }
  334.  
  335. static struct dwcfi_seg_list *
  336. dwcfi_hash_find (char *name)
  337. {
  338.   return (struct dwcfi_seg_list *) hash_find (dwcfi_hash, name);
  339. }
  340.  
  341. static struct dwcfi_seg_list *
  342. dwcfi_hash_find_or_make (segT cseg, const char *base_name, int flags)
  343. {
  344.   struct dwcfi_seg_list *item;
  345.   char *name;
  346.  
  347.   /* Initialize dwcfi_hash once.  */
  348.   if (!dwcfi_hash)
  349.     dwcfi_hash = hash_new ();
  350.  
  351.   name = get_debugseg_name (cseg, base_name);
  352.  
  353.   item = dwcfi_hash_find (name);
  354.   if (!item)
  355.     {
  356.       item = alloc_debugseg_item (make_debug_seg (cseg, name, flags), 0, name);
  357.  
  358.       dwcfi_hash_insert (item->seg_name, item);
  359.     }
  360.   else
  361.     free (name);
  362.  
  363.   return item;
  364. }
  365.  
  366. /* ??? Share this with dwarf2cfg.c.  */
  367. #ifndef TC_DWARF2_EMIT_OFFSET
  368. #define TC_DWARF2_EMIT_OFFSET  generic_dwarf2_emit_offset
  369.  
  370. /* Create an offset to .dwarf2_*.  */
  371.  
  372. static void
  373. generic_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
  374. {
  375.   expressionS exp;
  376.  
  377.   exp.X_op = O_symbol;
  378.   exp.X_add_symbol = symbol;
  379.   exp.X_add_number = 0;
  380.   emit_expr (&exp, size);
  381. }
  382. #endif
  383.  
  384. struct cfi_escape_data
  385. {
  386.   struct cfi_escape_data *next;
  387.   expressionS exp;
  388. };
  389.  
  390. struct cie_entry
  391. {
  392.   struct cie_entry *next;
  393. #if MULTIPLE_FRAME_SECTIONS
  394.   segT cur_seg;
  395. #endif
  396.   symbolS *start_address;
  397.   unsigned int return_column;
  398.   unsigned int signal_frame;
  399.   unsigned char fde_encoding;
  400.   unsigned char per_encoding;
  401.   unsigned char lsda_encoding;
  402.   expressionS personality;
  403.   struct cfi_insn_data *first, *last;
  404. };
  405.  
  406. /* List of FDE entries.  */
  407.  
  408. struct fde_entry *all_fde_data;
  409. static struct fde_entry **last_fde_data = &all_fde_data;
  410.  
  411. /* List of CIEs so that they could be reused.  */
  412. static struct cie_entry *cie_root;
  413.  
  414. /* Stack of old CFI data, for save/restore.  */
  415. struct cfa_save_data
  416. {
  417.   struct cfa_save_data *next;
  418.   offsetT cfa_offset;
  419. };
  420.  
  421. /* Current open FDE entry.  */
  422. struct frch_cfi_data
  423. {
  424.   struct fde_entry *cur_fde_data;
  425.   symbolS *last_address;
  426.   offsetT cur_cfa_offset;
  427.   struct cfa_save_data *cfa_save_stack;
  428. };
  429. /* Construct a new FDE structure and add it to the end of the fde list.  */
  430.  
  431. static struct fde_entry *
  432. alloc_fde_entry (void)
  433. {
  434.   struct fde_entry *fde = (struct fde_entry *)
  435.       xcalloc (1, sizeof (struct fde_entry));
  436.  
  437.   frchain_now->frch_cfi_data = (struct frch_cfi_data *)
  438.       xcalloc (1, sizeof (struct frch_cfi_data));
  439.   frchain_now->frch_cfi_data->cur_fde_data = fde;
  440.   *last_fde_data = fde;
  441.   last_fde_data = &fde->next;
  442.   SET_CUR_SEG (fde, is_now_linkonce_segment ());
  443.   SET_HANDLED (fde, 0);
  444.   fde->last = &fde->data;
  445.   fde->return_column = DWARF2_DEFAULT_RETURN_COLUMN;
  446.   fde->per_encoding = DW_EH_PE_omit;
  447.   fde->lsda_encoding = DW_EH_PE_omit;
  448.   fde->eh_header_type = EH_COMPACT_UNKNOWN;
  449.  
  450.   return fde;
  451. }
  452.  
  453. /* The following functions are available for a backend to construct its
  454.    own unwind information, usually from legacy unwind directives.  */
  455.  
  456. /* Construct a new INSN structure and add it to the end of the insn list
  457.    for the currently active FDE.  */
  458.  
  459. static bfd_boolean cfi_sections_set = FALSE;
  460. static int cfi_sections = CFI_EMIT_eh_frame;
  461. int all_cfi_sections = 0;
  462. static struct fde_entry *last_fde;
  463.  
  464. static struct cfi_insn_data *
  465. alloc_cfi_insn_data (void)
  466. {
  467.   struct cfi_insn_data *insn = (struct cfi_insn_data *)
  468.       xcalloc (1, sizeof (struct cfi_insn_data));
  469.   struct fde_entry *cur_fde_data = frchain_now->frch_cfi_data->cur_fde_data;
  470.  
  471.   *cur_fde_data->last = insn;
  472.   cur_fde_data->last = &insn->next;
  473.   SET_CUR_SEG (insn, is_now_linkonce_segment ());
  474.   return insn;
  475. }
  476.  
  477. /* Construct a new FDE structure that begins at LABEL.  */
  478.  
  479. void
  480. cfi_new_fde (symbolS *label)
  481. {
  482.   struct fde_entry *fde = alloc_fde_entry ();
  483.   fde->start_address = label;
  484.   frchain_now->frch_cfi_data->last_address = label;
  485. }
  486.  
  487. /* End the currently open FDE.  */
  488.  
  489. void
  490. cfi_end_fde (symbolS *label)
  491. {
  492.   frchain_now->frch_cfi_data->cur_fde_data->end_address = label;
  493.   free (frchain_now->frch_cfi_data);
  494.   frchain_now->frch_cfi_data = NULL;
  495. }
  496.  
  497. /* Set the return column for the current FDE.  */
  498.  
  499. void
  500. cfi_set_return_column (unsigned regno)
  501. {
  502.   frchain_now->frch_cfi_data->cur_fde_data->return_column = regno;
  503. }
  504.  
  505. void
  506. cfi_set_sections (void)
  507. {
  508.   frchain_now->frch_cfi_data->cur_fde_data->sections = all_cfi_sections;
  509. }
  510.  
  511. /* Universal functions to store new instructions.  */
  512.  
  513. static void
  514. cfi_add_CFA_insn (int insn)
  515. {
  516.   struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  517.  
  518.   insn_ptr->insn = insn;
  519. }
  520.  
  521. static void
  522. cfi_add_CFA_insn_reg (int insn, unsigned regno)
  523. {
  524.   struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  525.  
  526.   insn_ptr->insn = insn;
  527.   insn_ptr->u.r = regno;
  528. }
  529.  
  530. static void
  531. cfi_add_CFA_insn_offset (int insn, offsetT offset)
  532. {
  533.   struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  534.  
  535.   insn_ptr->insn = insn;
  536.   insn_ptr->u.i = offset;
  537. }
  538.  
  539. static void
  540. cfi_add_CFA_insn_reg_reg (int insn, unsigned reg1, unsigned reg2)
  541. {
  542.   struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  543.  
  544.   insn_ptr->insn = insn;
  545.   insn_ptr->u.rr.reg1 = reg1;
  546.   insn_ptr->u.rr.reg2 = reg2;
  547. }
  548.  
  549. static void
  550. cfi_add_CFA_insn_reg_offset (int insn, unsigned regno, offsetT offset)
  551. {
  552.   struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  553.  
  554.   insn_ptr->insn = insn;
  555.   insn_ptr->u.ri.reg = regno;
  556.   insn_ptr->u.ri.offset = offset;
  557. }
  558.  
  559. /* Add a CFI insn to advance the PC from the last address to LABEL.  */
  560.  
  561. void
  562. cfi_add_advance_loc (symbolS *label)
  563. {
  564.   struct cfi_insn_data *insn = alloc_cfi_insn_data ();
  565.  
  566.   insn->insn = DW_CFA_advance_loc;
  567.   insn->u.ll.lab1 = frchain_now->frch_cfi_data->last_address;
  568.   insn->u.ll.lab2 = label;
  569.  
  570.   frchain_now->frch_cfi_data->last_address = label;
  571. }
  572.  
  573. /* Add a CFI insn to label the current position in the CFI segment.  */
  574.  
  575. void
  576. cfi_add_label (const char *name)
  577. {
  578.   unsigned int len = strlen (name) + 1;
  579.   struct cfi_insn_data *insn = alloc_cfi_insn_data ();
  580.  
  581.   insn->insn = CFI_label;
  582.   obstack_grow (&notes, name, len);
  583.   insn->u.sym_name = (char *) obstack_finish (&notes);
  584. }
  585.  
  586. /* Add a DW_CFA_offset record to the CFI data.  */
  587.  
  588. void
  589. cfi_add_CFA_offset (unsigned regno, offsetT offset)
  590. {
  591.   unsigned int abs_data_align;
  592.  
  593.   gas_assert (DWARF2_CIE_DATA_ALIGNMENT != 0);
  594.   cfi_add_CFA_insn_reg_offset (DW_CFA_offset, regno, offset);
  595.  
  596.   abs_data_align = (DWARF2_CIE_DATA_ALIGNMENT < 0
  597.                     ? -DWARF2_CIE_DATA_ALIGNMENT : DWARF2_CIE_DATA_ALIGNMENT);
  598.   if (offset % abs_data_align)
  599.     as_bad (_("register save offset not a multiple of %u"), abs_data_align);
  600. }
  601.  
  602. /* Add a DW_CFA_def_cfa record to the CFI data.  */
  603.  
  604. void
  605. cfi_add_CFA_def_cfa (unsigned regno, offsetT offset)
  606. {
  607.   cfi_add_CFA_insn_reg_offset (DW_CFA_def_cfa, regno, offset);
  608.   frchain_now->frch_cfi_data->cur_cfa_offset = offset;
  609. }
  610.  
  611. /* Add a DW_CFA_register record to the CFI data.  */
  612.  
  613. void
  614. cfi_add_CFA_register (unsigned reg1, unsigned reg2)
  615. {
  616.   cfi_add_CFA_insn_reg_reg (DW_CFA_register, reg1, reg2);
  617. }
  618.  
  619. /* Add a DW_CFA_def_cfa_register record to the CFI data.  */
  620.  
  621. void
  622. cfi_add_CFA_def_cfa_register (unsigned regno)
  623. {
  624.   cfi_add_CFA_insn_reg (DW_CFA_def_cfa_register, regno);
  625. }
  626.  
  627. /* Add a DW_CFA_def_cfa_offset record to the CFI data.  */
  628.  
  629. void
  630. cfi_add_CFA_def_cfa_offset (offsetT offset)
  631. {
  632.   cfi_add_CFA_insn_offset (DW_CFA_def_cfa_offset, offset);
  633.   frchain_now->frch_cfi_data->cur_cfa_offset = offset;
  634. }
  635.  
  636. void
  637. cfi_add_CFA_restore (unsigned regno)
  638. {
  639.   cfi_add_CFA_insn_reg (DW_CFA_restore, regno);
  640. }
  641.  
  642. void
  643. cfi_add_CFA_undefined (unsigned regno)
  644. {
  645.   cfi_add_CFA_insn_reg (DW_CFA_undefined, regno);
  646. }
  647.  
  648. void
  649. cfi_add_CFA_same_value (unsigned regno)
  650. {
  651.   cfi_add_CFA_insn_reg (DW_CFA_same_value, regno);
  652. }
  653.  
  654. void
  655. cfi_add_CFA_remember_state (void)
  656. {
  657.   struct cfa_save_data *p;
  658.  
  659.   cfi_add_CFA_insn (DW_CFA_remember_state);
  660.  
  661.   p = (struct cfa_save_data *) xmalloc (sizeof (*p));
  662.   p->cfa_offset = frchain_now->frch_cfi_data->cur_cfa_offset;
  663.   p->next = frchain_now->frch_cfi_data->cfa_save_stack;
  664.   frchain_now->frch_cfi_data->cfa_save_stack = p;
  665. }
  666.  
  667. void
  668. cfi_add_CFA_restore_state (void)
  669. {
  670.   struct cfa_save_data *p;
  671.  
  672.   cfi_add_CFA_insn (DW_CFA_restore_state);
  673.  
  674.   p = frchain_now->frch_cfi_data->cfa_save_stack;
  675.   if (p)
  676.     {
  677.       frchain_now->frch_cfi_data->cur_cfa_offset = p->cfa_offset;
  678.       frchain_now->frch_cfi_data->cfa_save_stack = p->next;
  679.       free (p);
  680.     }
  681.   else
  682.     as_bad (_("CFI state restore without previous remember"));
  683. }
  684.  
  685. /* Parse CFI assembler directives.  */
  686.  
  687. static void dot_cfi (int);
  688. static void dot_cfi_escape (int);
  689. static void dot_cfi_sections (int);
  690. static void dot_cfi_startproc (int);
  691. static void dot_cfi_endproc (int);
  692. static void dot_cfi_fde_data (int);
  693. static void dot_cfi_personality (int);
  694. static void dot_cfi_personality_id (int);
  695. static void dot_cfi_lsda (int);
  696. static void dot_cfi_val_encoded_addr (int);
  697. static void dot_cfi_inline_lsda (int);
  698. static void dot_cfi_label (int);
  699.  
  700. const pseudo_typeS cfi_pseudo_table[] =
  701.   {
  702.     { "cfi_sections", dot_cfi_sections, 0 },
  703.     { "cfi_startproc", dot_cfi_startproc, 0 },
  704.     { "cfi_endproc", dot_cfi_endproc, 0 },
  705.     { "cfi_fde_data", dot_cfi_fde_data, 0 },
  706.     { "cfi_def_cfa", dot_cfi, DW_CFA_def_cfa },
  707.     { "cfi_def_cfa_register", dot_cfi, DW_CFA_def_cfa_register },
  708.     { "cfi_def_cfa_offset", dot_cfi, DW_CFA_def_cfa_offset },
  709.     { "cfi_adjust_cfa_offset", dot_cfi, CFI_adjust_cfa_offset },
  710.     { "cfi_offset", dot_cfi, DW_CFA_offset },
  711.     { "cfi_rel_offset", dot_cfi, CFI_rel_offset },
  712.     { "cfi_register", dot_cfi, DW_CFA_register },
  713.     { "cfi_return_column", dot_cfi, CFI_return_column },
  714.     { "cfi_restore", dot_cfi, DW_CFA_restore },
  715.     { "cfi_undefined", dot_cfi, DW_CFA_undefined },
  716.     { "cfi_same_value", dot_cfi, DW_CFA_same_value },
  717.     { "cfi_remember_state", dot_cfi, DW_CFA_remember_state },
  718.     { "cfi_restore_state", dot_cfi, DW_CFA_restore_state },
  719.     { "cfi_window_save", dot_cfi, DW_CFA_GNU_window_save },
  720.     { "cfi_escape", dot_cfi_escape, 0 },
  721.     { "cfi_signal_frame", dot_cfi, CFI_signal_frame },
  722.     { "cfi_personality", dot_cfi_personality, 0 },
  723.     { "cfi_personality_id", dot_cfi_personality_id, 0 },
  724.     { "cfi_lsda", dot_cfi_lsda, 0 },
  725.     { "cfi_val_encoded_addr", dot_cfi_val_encoded_addr, 0 },
  726.     { "cfi_inline_lsda", dot_cfi_inline_lsda, 0 },
  727.     { "cfi_label", dot_cfi_label, 0 },
  728.     { NULL, NULL, 0 }
  729.   };
  730.  
  731. static void
  732. cfi_parse_separator (void)
  733. {
  734.   SKIP_WHITESPACE ();
  735.   if (*input_line_pointer == ',')
  736.     input_line_pointer++;
  737.   else
  738.     as_bad (_("missing separator"));
  739. }
  740.  
  741. #ifndef tc_parse_to_dw2regnum
  742. static void
  743. tc_parse_to_dw2regnum (expressionS *exp)
  744. {
  745. # ifdef tc_regname_to_dw2regnum
  746.   SKIP_WHITESPACE ();
  747.   if (is_name_beginner (*input_line_pointer)
  748.       || (*input_line_pointer == '%'
  749.           && is_name_beginner (*++input_line_pointer)))
  750.     {
  751.       char *name, c;
  752.  
  753.       c = get_symbol_name (& name);
  754.  
  755.       exp->X_op = O_constant;
  756.       exp->X_add_number = tc_regname_to_dw2regnum (name);
  757.  
  758.       restore_line_pointer (c);
  759.     }
  760.   else
  761. # endif
  762.     expression_and_evaluate (exp);
  763. }
  764. #endif
  765.  
  766. static unsigned
  767. cfi_parse_reg (void)
  768. {
  769.   int regno;
  770.   expressionS exp;
  771.  
  772.   tc_parse_to_dw2regnum (&exp);
  773.   switch (exp.X_op)
  774.     {
  775.     case O_register:
  776.     case O_constant:
  777.       regno = exp.X_add_number;
  778.       break;
  779.  
  780.     default:
  781.       regno = -1;
  782.       break;
  783.     }
  784.  
  785.   if (regno < 0)
  786.     {
  787.       as_bad (_("bad register expression"));
  788.       regno = 0;
  789.     }
  790.  
  791.   return regno;
  792. }
  793.  
  794. static offsetT
  795. cfi_parse_const (void)
  796. {
  797.   return get_absolute_expression ();
  798. }
  799.  
  800. static void
  801. dot_cfi (int arg)
  802. {
  803.   offsetT offset;
  804.   unsigned reg1, reg2;
  805.  
  806.   if (frchain_now->frch_cfi_data == NULL)
  807.     {
  808.       as_bad (_("CFI instruction used without previous .cfi_startproc"));
  809.       ignore_rest_of_line ();
  810.       return;
  811.     }
  812.  
  813.   /* If the last address was not at the current PC, advance to current.  */
  814.   if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
  815.       || S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
  816.          != frag_now_fix ())
  817.     cfi_add_advance_loc (symbol_temp_new_now ());
  818.  
  819.   switch (arg)
  820.     {
  821.     case DW_CFA_offset:
  822.       reg1 = cfi_parse_reg ();
  823.       cfi_parse_separator ();
  824.       offset = cfi_parse_const ();
  825.       cfi_add_CFA_offset (reg1, offset);
  826.       break;
  827.  
  828.     case CFI_rel_offset:
  829.       reg1 = cfi_parse_reg ();
  830.       cfi_parse_separator ();
  831.       offset = cfi_parse_const ();
  832.       cfi_add_CFA_offset (reg1,
  833.                           offset - frchain_now->frch_cfi_data->cur_cfa_offset);
  834.       break;
  835.  
  836.     case DW_CFA_def_cfa:
  837.       reg1 = cfi_parse_reg ();
  838.       cfi_parse_separator ();
  839.       offset = cfi_parse_const ();
  840.       cfi_add_CFA_def_cfa (reg1, offset);
  841.       break;
  842.  
  843.     case DW_CFA_register:
  844.       reg1 = cfi_parse_reg ();
  845.       cfi_parse_separator ();
  846.       reg2 = cfi_parse_reg ();
  847.       cfi_add_CFA_register (reg1, reg2);
  848.       break;
  849.  
  850.     case DW_CFA_def_cfa_register:
  851.       reg1 = cfi_parse_reg ();
  852.       cfi_add_CFA_def_cfa_register (reg1);
  853.       break;
  854.  
  855.     case DW_CFA_def_cfa_offset:
  856.       offset = cfi_parse_const ();
  857.       cfi_add_CFA_def_cfa_offset (offset);
  858.       break;
  859.  
  860.     case CFI_adjust_cfa_offset:
  861.       offset = cfi_parse_const ();
  862.       cfi_add_CFA_def_cfa_offset (frchain_now->frch_cfi_data->cur_cfa_offset
  863.                                   + offset);
  864.       break;
  865.  
  866.     case DW_CFA_restore:
  867.       for (;;)
  868.         {
  869.           reg1 = cfi_parse_reg ();
  870.           cfi_add_CFA_restore (reg1);
  871.           SKIP_WHITESPACE ();
  872.           if (*input_line_pointer != ',')
  873.             break;
  874.           ++input_line_pointer;
  875.         }
  876.       break;
  877.  
  878.     case DW_CFA_undefined:
  879.       for (;;)
  880.         {
  881.           reg1 = cfi_parse_reg ();
  882.           cfi_add_CFA_undefined (reg1);
  883.           SKIP_WHITESPACE ();
  884.           if (*input_line_pointer != ',')
  885.             break;
  886.           ++input_line_pointer;
  887.         }
  888.       break;
  889.  
  890.     case DW_CFA_same_value:
  891.       reg1 = cfi_parse_reg ();
  892.       cfi_add_CFA_same_value (reg1);
  893.       break;
  894.  
  895.     case CFI_return_column:
  896.       reg1 = cfi_parse_reg ();
  897.       cfi_set_return_column (reg1);
  898.       break;
  899.  
  900.     case DW_CFA_remember_state:
  901.       cfi_add_CFA_remember_state ();
  902.       break;
  903.  
  904.     case DW_CFA_restore_state:
  905.       cfi_add_CFA_restore_state ();
  906.       break;
  907.  
  908.     case DW_CFA_GNU_window_save:
  909.       cfi_add_CFA_insn (DW_CFA_GNU_window_save);
  910.       break;
  911.  
  912.     case CFI_signal_frame:
  913.       frchain_now->frch_cfi_data->cur_fde_data->signal_frame = 1;
  914.       break;
  915.  
  916.     default:
  917.       abort ();
  918.     }
  919.  
  920.   demand_empty_rest_of_line ();
  921. }
  922.  
  923. static void
  924. dot_cfi_escape (int ignored ATTRIBUTE_UNUSED)
  925. {
  926.   struct cfi_escape_data *head, **tail, *e;
  927.   struct cfi_insn_data *insn;
  928.  
  929.   if (frchain_now->frch_cfi_data == NULL)
  930.     {
  931.       as_bad (_("CFI instruction used without previous .cfi_startproc"));
  932.       ignore_rest_of_line ();
  933.       return;
  934.     }
  935.  
  936.   /* If the last address was not at the current PC, advance to current.  */
  937.   if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
  938.       || S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
  939.          != frag_now_fix ())
  940.     cfi_add_advance_loc (symbol_temp_new_now ());
  941.  
  942.   tail = &head;
  943.   do
  944.     {
  945.       e = (struct cfi_escape_data *) xmalloc (sizeof (*e));
  946.       do_parse_cons_expression (&e->exp, 1);
  947.       *tail = e;
  948.       tail = &e->next;
  949.     }
  950.   while (*input_line_pointer++ == ',');
  951.   *tail = NULL;
  952.  
  953.   insn = alloc_cfi_insn_data ();
  954.   insn->insn = CFI_escape;
  955.   insn->u.esc = head;
  956.  
  957.   --input_line_pointer;
  958.   demand_empty_rest_of_line ();
  959. }
  960.  
  961. static void
  962. dot_cfi_personality (int ignored ATTRIBUTE_UNUSED)
  963. {
  964.   struct fde_entry *fde;
  965.   offsetT encoding;
  966.  
  967.   if (frchain_now->frch_cfi_data == NULL)
  968.     {
  969.       as_bad (_("CFI instruction used without previous .cfi_startproc"));
  970.       ignore_rest_of_line ();
  971.       return;
  972.     }
  973.  
  974.   fde = frchain_now->frch_cfi_data->cur_fde_data;
  975.   encoding = cfi_parse_const ();
  976.   if (encoding == DW_EH_PE_omit)
  977.     {
  978.       demand_empty_rest_of_line ();
  979.       fde->per_encoding = encoding;
  980.       return;
  981.     }
  982.  
  983.   if ((encoding & 0xff) != encoding
  984.       || ((((encoding & 0x70) != 0
  985. #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
  986.            && (encoding & 0x70) != DW_EH_PE_pcrel
  987. #endif
  988.           )
  989.          /* leb128 can be handled, but does something actually need it?  */
  990.            || (encoding & 7) == DW_EH_PE_uleb128
  991.            || (encoding & 7) > DW_EH_PE_udata8)
  992.         && tc_cfi_reloc_for_encoding (encoding) == BFD_RELOC_NONE))
  993.     {
  994.       as_bad (_("invalid or unsupported encoding in .cfi_personality"));
  995.       ignore_rest_of_line ();
  996.       return;
  997.     }
  998.  
  999.   if (*input_line_pointer++ != ',')
  1000.     {
  1001.       as_bad (_(".cfi_personality requires encoding and symbol arguments"));
  1002.       ignore_rest_of_line ();
  1003.       return;
  1004.     }
  1005.  
  1006.   expression_and_evaluate (&fde->personality);
  1007.   switch (fde->personality.X_op)
  1008.     {
  1009.     case O_symbol:
  1010.       break;
  1011.     case O_constant:
  1012.       if ((encoding & 0x70) == DW_EH_PE_pcrel)
  1013.         encoding = DW_EH_PE_omit;
  1014.       break;
  1015.     default:
  1016.       encoding = DW_EH_PE_omit;
  1017.       break;
  1018.     }
  1019.  
  1020.   fde->per_encoding = encoding;
  1021.  
  1022.   if (encoding == DW_EH_PE_omit)
  1023.     {
  1024.       as_bad (_("wrong second argument to .cfi_personality"));
  1025.       ignore_rest_of_line ();
  1026.       return;
  1027.     }
  1028.  
  1029.   demand_empty_rest_of_line ();
  1030. }
  1031.  
  1032. static void
  1033. dot_cfi_lsda (int ignored ATTRIBUTE_UNUSED)
  1034. {
  1035.   struct fde_entry *fde;
  1036.   offsetT encoding;
  1037.  
  1038.   if (frchain_now->frch_cfi_data == NULL)
  1039.     {
  1040.       as_bad (_("CFI instruction used without previous .cfi_startproc"));
  1041.       ignore_rest_of_line ();
  1042.       return;
  1043.     }
  1044.  
  1045.   fde = frchain_now->frch_cfi_data->cur_fde_data;
  1046.   encoding = cfi_parse_const ();
  1047.   if (encoding == DW_EH_PE_omit)
  1048.     {
  1049.       demand_empty_rest_of_line ();
  1050.       fde->lsda_encoding = encoding;
  1051.       return;
  1052.     }
  1053.  
  1054.   if ((encoding & 0xff) != encoding
  1055.       || ((((encoding & 0x70) != 0
  1056. #if CFI_DIFF_LSDA_OK || defined tc_cfi_emit_pcrel_expr
  1057.             && (encoding & 0x70) != DW_EH_PE_pcrel
  1058. #endif
  1059.            )
  1060.          /* leb128 can be handled, but does something actually need it?  */
  1061.            || (encoding & 7) == DW_EH_PE_uleb128
  1062.            || (encoding & 7) > DW_EH_PE_udata8)
  1063.           && tc_cfi_reloc_for_encoding (encoding) == BFD_RELOC_NONE))
  1064.     {
  1065.       as_bad (_("invalid or unsupported encoding in .cfi_lsda"));
  1066.       ignore_rest_of_line ();
  1067.       return;
  1068.     }
  1069.  
  1070.   if (*input_line_pointer++ != ',')
  1071.     {
  1072.       as_bad (_(".cfi_lsda requires encoding and symbol arguments"));
  1073.       ignore_rest_of_line ();
  1074.       return;
  1075.     }
  1076.  
  1077.   fde->lsda_encoding = encoding;
  1078.  
  1079.   expression_and_evaluate (&fde->lsda);
  1080.   switch (fde->lsda.X_op)
  1081.     {
  1082.     case O_symbol:
  1083.       break;
  1084.     case O_constant:
  1085.       if ((encoding & 0x70) == DW_EH_PE_pcrel)
  1086.         encoding = DW_EH_PE_omit;
  1087.       break;
  1088.     default:
  1089.       encoding = DW_EH_PE_omit;
  1090.       break;
  1091.     }
  1092.  
  1093.   fde->lsda_encoding = encoding;
  1094.  
  1095.   if (encoding == DW_EH_PE_omit)
  1096.     {
  1097.       as_bad (_("wrong second argument to .cfi_lsda"));
  1098.       ignore_rest_of_line ();
  1099.       return;
  1100.     }
  1101.  
  1102.   demand_empty_rest_of_line ();
  1103. }
  1104.  
  1105. static void
  1106. dot_cfi_val_encoded_addr (int ignored ATTRIBUTE_UNUSED)
  1107. {
  1108.   struct cfi_insn_data *insn_ptr;
  1109.   offsetT encoding;
  1110.  
  1111.   if (frchain_now->frch_cfi_data == NULL)
  1112.     {
  1113.       as_bad (_("CFI instruction used without previous .cfi_startproc"));
  1114.       ignore_rest_of_line ();
  1115.       return;
  1116.     }
  1117.  
  1118.   /* If the last address was not at the current PC, advance to current.  */
  1119.   if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
  1120.       || S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
  1121.          != frag_now_fix ())
  1122.     cfi_add_advance_loc (symbol_temp_new_now ());
  1123.  
  1124.   insn_ptr = alloc_cfi_insn_data ();
  1125.   insn_ptr->insn = CFI_val_encoded_addr;
  1126.  
  1127.   insn_ptr->u.ea.reg = cfi_parse_reg ();
  1128.  
  1129.   cfi_parse_separator ();
  1130.   encoding = cfi_parse_const ();
  1131.   if ((encoding & 0xff) != encoding
  1132.       || ((encoding & 0x70) != 0
  1133. #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
  1134.           && (encoding & 0x70) != DW_EH_PE_pcrel
  1135. #endif
  1136.           )
  1137.          /* leb128 can be handled, but does something actually need it?  */
  1138.       || (encoding & 7) == DW_EH_PE_uleb128
  1139.       || (encoding & 7) > DW_EH_PE_udata8)
  1140.     {
  1141.       as_bad (_("invalid or unsupported encoding in .cfi_lsda"));
  1142.       encoding = DW_EH_PE_omit;
  1143.     }
  1144.  
  1145.   cfi_parse_separator ();
  1146.   expression_and_evaluate (&insn_ptr->u.ea.exp);
  1147.   switch (insn_ptr->u.ea.exp.X_op)
  1148.     {
  1149.     case O_symbol:
  1150.       break;
  1151.     case O_constant:
  1152.       if ((encoding & 0x70) != DW_EH_PE_pcrel)
  1153.         break;
  1154.     default:
  1155.       encoding = DW_EH_PE_omit;
  1156.       break;
  1157.     }
  1158.  
  1159.   insn_ptr->u.ea.encoding = encoding;
  1160.   if (encoding == DW_EH_PE_omit)
  1161.     {
  1162.       as_bad (_("wrong third argument to .cfi_val_encoded_addr"));
  1163.       ignore_rest_of_line ();
  1164.       return;
  1165.     }
  1166.  
  1167.   demand_empty_rest_of_line ();
  1168. }
  1169.  
  1170. static void
  1171. dot_cfi_label (int ignored ATTRIBUTE_UNUSED)
  1172. {
  1173.   char *name = read_symbol_name ();
  1174.  
  1175.   if (name == NULL)
  1176.     return;
  1177.  
  1178.   /* If the last address was not at the current PC, advance to current.  */
  1179.   if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
  1180.       || S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
  1181.          != frag_now_fix ())
  1182.     cfi_add_advance_loc (symbol_temp_new_now ());
  1183.  
  1184.   cfi_add_label (name);
  1185.  
  1186.   demand_empty_rest_of_line ();
  1187. }
  1188.  
  1189. static void
  1190. dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
  1191. {
  1192.   int sections = 0;
  1193.  
  1194.   SKIP_WHITESPACE ();
  1195.   if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
  1196.     while (1)
  1197.       {
  1198.         char * saved_ilp;
  1199.         char *name, c;
  1200.  
  1201.         saved_ilp = input_line_pointer;
  1202.         c = get_symbol_name (& name);
  1203.  
  1204.         if (strncmp (name, ".eh_frame", sizeof ".eh_frame") == 0
  1205.             && name[9] != '_')
  1206.           sections |= CFI_EMIT_eh_frame;
  1207.         else if (strncmp (name, ".debug_frame", sizeof ".debug_frame") == 0)
  1208.           sections |= CFI_EMIT_debug_frame;
  1209. #if SUPPORT_COMPACT_EH
  1210.         else if (strncmp (name, ".eh_frame_entry", sizeof ".eh_frame_entry") == 0)
  1211.           {
  1212.             compact_eh = TRUE;
  1213.             sections |= CFI_EMIT_eh_frame_compact;
  1214.           }
  1215. #endif
  1216. #ifdef tc_cfi_section_name
  1217.         else if (strcmp (name, tc_cfi_section_name) == 0)
  1218.           sections |= CFI_EMIT_target;
  1219. #endif
  1220.         else
  1221.           {
  1222.             *input_line_pointer = c;
  1223.             input_line_pointer = saved_ilp;
  1224.             break;
  1225.           }
  1226.  
  1227.         *input_line_pointer = c;
  1228.         SKIP_WHITESPACE_AFTER_NAME ();
  1229.         if (*input_line_pointer == ',')
  1230.           {
  1231.             name = input_line_pointer++;
  1232.             SKIP_WHITESPACE ();
  1233.             if (!is_name_beginner (*input_line_pointer) && *input_line_pointer != '"')
  1234.               {
  1235.                 input_line_pointer = name;
  1236.                 break;
  1237.               }
  1238.           }
  1239.         else if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
  1240.           break;
  1241.       }
  1242.  
  1243.   demand_empty_rest_of_line ();
  1244.   if (cfi_sections_set && cfi_sections != sections)
  1245.     as_bad (_("inconsistent uses of .cfi_sections"));
  1246.   cfi_sections_set = TRUE;
  1247.   cfi_sections = sections;
  1248. }
  1249.  
  1250. static void
  1251. dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED)
  1252. {
  1253.   int simple = 0;
  1254.  
  1255.   if (frchain_now->frch_cfi_data != NULL)
  1256.     {
  1257.       as_bad (_("previous CFI entry not closed (missing .cfi_endproc)"));
  1258.       ignore_rest_of_line ();
  1259.       return;
  1260.     }
  1261.  
  1262.   cfi_new_fde (symbol_temp_new_now ());
  1263.  
  1264.   SKIP_WHITESPACE ();
  1265.   if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
  1266.     {
  1267.       char * saved_ilp = input_line_pointer;
  1268.       char *name, c;
  1269.  
  1270.       c = get_symbol_name (& name);
  1271.  
  1272.       if (strcmp (name, "simple") == 0)
  1273.         {
  1274.           simple = 1;
  1275.           restore_line_pointer (c);
  1276.         }
  1277.       else
  1278.         input_line_pointer = saved_ilp;
  1279.     }
  1280.   demand_empty_rest_of_line ();
  1281.  
  1282.   all_cfi_sections |= cfi_sections;
  1283.   cfi_set_sections ();
  1284.   frchain_now->frch_cfi_data->cur_cfa_offset = 0;
  1285.   if (!simple)
  1286.     tc_cfi_frame_initial_instructions ();
  1287.  
  1288.   if ((cfi_sections & CFI_EMIT_target) != 0)
  1289.     tc_cfi_startproc ();
  1290. }
  1291.  
  1292. static void
  1293. dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED)
  1294. {
  1295.   if (frchain_now->frch_cfi_data == NULL)
  1296.     {
  1297.       as_bad (_(".cfi_endproc without corresponding .cfi_startproc"));
  1298.       ignore_rest_of_line ();
  1299.       return;
  1300.     }
  1301.  
  1302.   last_fde = frchain_now->frch_cfi_data->cur_fde_data;
  1303.  
  1304.   cfi_end_fde (symbol_temp_new_now ());
  1305.  
  1306.   demand_empty_rest_of_line ();
  1307.  
  1308.   if ((cfi_sections & CFI_EMIT_target) != 0)
  1309.     tc_cfi_endproc (last_fde);
  1310. }
  1311.  
  1312. static segT
  1313. get_cfi_seg (segT cseg, const char *base, flagword flags, int align)
  1314. {
  1315.   /* Exclude .debug_frame sections for Compact EH.  */
  1316.   if (SUPPORT_FRAME_LINKONCE || ((flags & SEC_DEBUGGING) == 0 && compact_eh))
  1317.     {
  1318.       struct dwcfi_seg_list *l;
  1319.  
  1320.       l = dwcfi_hash_find_or_make (cseg, base, flags);
  1321.  
  1322.       cseg = l->seg;
  1323.       subseg_set (cseg, l->subseg);
  1324.     }
  1325.   else
  1326.     {
  1327.       cseg = subseg_new (base, 0);
  1328.       bfd_set_section_flags (stdoutput, cseg, flags);
  1329.     }
  1330.   record_alignment (cseg, align);
  1331.   return cseg;
  1332. }
  1333.  
  1334. #if SUPPORT_COMPACT_EH
  1335. static void
  1336. dot_cfi_personality_id (int ignored ATTRIBUTE_UNUSED)
  1337. {
  1338.   struct fde_entry *fde;
  1339.  
  1340.   if (frchain_now->frch_cfi_data == NULL)
  1341.     {
  1342.       as_bad (_("CFI instruction used without previous .cfi_startproc"));
  1343.       ignore_rest_of_line ();
  1344.       return;
  1345.     }
  1346.  
  1347.   fde = frchain_now->frch_cfi_data->cur_fde_data;
  1348.   fde->personality_id = cfi_parse_const ();
  1349.   demand_empty_rest_of_line ();
  1350.  
  1351.   if (fde->personality_id == 0 || fde->personality_id > 3)
  1352.     {
  1353.       as_bad (_("wrong argument to .cfi_personality_id"));
  1354.       return;
  1355.     }
  1356. }
  1357.  
  1358. static void
  1359. dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED)
  1360. {
  1361.   if (frchain_now->frch_cfi_data == NULL)
  1362.     {
  1363.       as_bad (_(".cfi_fde_data without corresponding .cfi_startproc"));
  1364.       ignore_rest_of_line ();
  1365.       return;
  1366.     }
  1367.  
  1368.   last_fde = frchain_now->frch_cfi_data->cur_fde_data;
  1369.  
  1370.   if ((cfi_sections & CFI_EMIT_target) != 0
  1371.       || (cfi_sections & CFI_EMIT_eh_frame_compact) != 0)
  1372.     {
  1373.       struct cfi_escape_data *head, **tail, *e;
  1374.       int num_ops = 0;
  1375.  
  1376.       tail = &head;
  1377.       if (!is_it_end_of_statement ())
  1378.         {
  1379.           num_ops = 0;
  1380.           do
  1381.             {
  1382.               e = (struct cfi_escape_data *) xmalloc (sizeof (*e));
  1383.               do_parse_cons_expression (&e->exp, 1);
  1384.               *tail = e;
  1385.               tail = &e->next;
  1386.               num_ops++;
  1387.             }
  1388.           while (*input_line_pointer++ == ',');
  1389.           --input_line_pointer;
  1390.         }
  1391.       *tail = NULL;
  1392.  
  1393.       if (last_fde->lsda_encoding != DW_EH_PE_omit)
  1394.         last_fde->eh_header_type = EH_COMPACT_HAS_LSDA;
  1395.       else if (num_ops <= 3 && last_fde->per_encoding == DW_EH_PE_omit)
  1396.         last_fde->eh_header_type = EH_COMPACT_INLINE;
  1397.       else
  1398.         last_fde->eh_header_type = EH_COMPACT_OUTLINE;
  1399.  
  1400.       if (last_fde->eh_header_type == EH_COMPACT_INLINE)
  1401.         num_ops = 3;
  1402.  
  1403.       last_fde->eh_data_size = num_ops;
  1404.       last_fde->eh_data = (bfd_byte *) xmalloc (num_ops);
  1405.       num_ops = 0;
  1406.       while (head)
  1407.         {
  1408.           e = head;
  1409.           head = e->next;
  1410.           last_fde->eh_data[num_ops++] = e->exp.X_add_number;
  1411.           free (e);
  1412.         }
  1413.       if (last_fde->eh_header_type == EH_COMPACT_INLINE)
  1414.         while (num_ops < 3)
  1415.           last_fde->eh_data[num_ops++] = tc_compact_eh_opcode_stop;
  1416.     }
  1417.  
  1418.   demand_empty_rest_of_line ();
  1419. }
  1420.  
  1421. /* Function to emit the compact unwinding opcodes stored in the
  1422.    fde's eh_data field.  The end of the opcode data will be
  1423.    padded to the value in align.  */
  1424.  
  1425. static void
  1426. output_compact_unwind_data (struct fde_entry *fde, int align)
  1427. {
  1428.   int data_size = fde->eh_data_size + 2;
  1429.   int align_padding;
  1430.   int amask;
  1431.   char *p;
  1432.  
  1433.   fde->eh_loc = symbol_temp_new_now ();
  1434.  
  1435.   p = frag_more (1);
  1436.   if (fde->personality_id != 0)
  1437.     *p = fde->personality_id;
  1438.   else if (fde->per_encoding != DW_EH_PE_omit)
  1439.     {
  1440.       *p = 0;
  1441.       emit_expr_encoded (&fde->personality, fde->per_encoding, FALSE);
  1442.       data_size += encoding_size (fde->per_encoding);
  1443.     }
  1444.   else
  1445.     *p = 1;
  1446.  
  1447.   amask = (1 << align) - 1;
  1448.   align_padding = ((data_size + amask) & ~amask) - data_size;
  1449.  
  1450.   p = frag_more (fde->eh_data_size + 1 + align_padding);
  1451.   memcpy (p, fde->eh_data, fde->eh_data_size);
  1452.   p += fde->eh_data_size;
  1453.  
  1454.   while (align_padding-- > 0)
  1455.     *(p++) = tc_compact_eh_opcode_pad;
  1456.  
  1457.   *(p++) = tc_compact_eh_opcode_stop;
  1458.   fde->eh_header_type = EH_COMPACT_OUTLINE_DONE;
  1459. }
  1460.  
  1461. /* Handle the .cfi_inline_lsda directive.  */
  1462. static void
  1463. dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED)
  1464. {
  1465.   segT ccseg;
  1466.   int align;
  1467.   long max_alignment = 28;
  1468.  
  1469.   if (!last_fde)
  1470.     {
  1471.       as_bad (_("unexpected .cfi_inline_lsda"));
  1472.       ignore_rest_of_line ();
  1473.       return;
  1474.     }
  1475.  
  1476.   if ((last_fde->sections & CFI_EMIT_eh_frame_compact) == 0)
  1477.     {
  1478.       as_bad (_(".cfi_inline_lsda not valid for this frame"));
  1479.       ignore_rest_of_line ();
  1480.       return;
  1481.     }
  1482.  
  1483.   if (last_fde->eh_header_type != EH_COMPACT_UNKNOWN
  1484.       && last_fde->eh_header_type != EH_COMPACT_HAS_LSDA)
  1485.     {
  1486.       as_bad (_(".cfi_inline_lsda seen for frame without .cfi_lsda"));
  1487.       ignore_rest_of_line ();
  1488.       return;
  1489.     }
  1490.  
  1491. #ifdef md_flush_pending_output
  1492.   md_flush_pending_output ();
  1493. #endif
  1494.  
  1495.   align = get_absolute_expression ();
  1496.   if (align > max_alignment)
  1497.     {
  1498.       align = max_alignment;
  1499.       as_bad (_("Alignment too large: %d. assumed."), align);
  1500.     }
  1501.   else if (align < 0)
  1502.     {
  1503.       as_warn (_("Alignment negative: 0 assumed."));
  1504.       align = 0;
  1505.     }
  1506.  
  1507.   demand_empty_rest_of_line ();
  1508.   ccseg = CUR_SEG (last_fde);
  1509.  
  1510.   /* Open .gnu_extab section.  */
  1511.   get_cfi_seg (ccseg, ".gnu_extab",
  1512.                (SEC_ALLOC | SEC_LOAD | SEC_DATA
  1513.                 | DWARF2_EH_FRAME_READ_ONLY),
  1514.                1);
  1515.  
  1516.   frag_align (align, 0, 0);
  1517.   record_alignment (now_seg, align);
  1518.   if (last_fde->eh_header_type == EH_COMPACT_HAS_LSDA)
  1519.     output_compact_unwind_data (last_fde, align);
  1520.  
  1521.   last_fde = NULL;
  1522.  
  1523.   return;
  1524. }
  1525. #else /* !SUPPORT_COMPACT_EH */
  1526. static void
  1527. dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED)
  1528. {
  1529.   as_bad (_(".cfi_inline_lsda is not supported for this target"));
  1530.   ignore_rest_of_line ();
  1531. }
  1532.  
  1533. static void
  1534. dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED)
  1535. {
  1536.   as_bad (_(".cfi_fde_data is not supported for this target"));
  1537.   ignore_rest_of_line ();
  1538. }
  1539.  
  1540. static void
  1541. dot_cfi_personality_id (int ignored ATTRIBUTE_UNUSED)
  1542. {
  1543.   as_bad (_(".cfi_personality_id is not supported for this target"));
  1544.   ignore_rest_of_line ();
  1545. }
  1546. #endif
  1547. static void
  1548. output_cfi_insn (struct cfi_insn_data *insn)
  1549. {
  1550.   offsetT offset;
  1551.   unsigned int regno;
  1552.  
  1553.   switch (insn->insn)
  1554.     {
  1555.     case DW_CFA_advance_loc:
  1556.       {
  1557.         symbolS *from = insn->u.ll.lab1;
  1558.         symbolS *to = insn->u.ll.lab2;
  1559.  
  1560.         if (symbol_get_frag (to) == symbol_get_frag (from))
  1561.           {
  1562.             addressT delta = S_GET_VALUE (to) - S_GET_VALUE (from);
  1563.             addressT scaled = delta / DWARF2_LINE_MIN_INSN_LENGTH;
  1564.  
  1565.             if (scaled <= 0x3F)
  1566.               out_one (DW_CFA_advance_loc + scaled);
  1567.             else if (scaled <= 0xFF)
  1568.               {
  1569.                 out_one (DW_CFA_advance_loc1);
  1570.                 out_one (scaled);
  1571.               }
  1572.             else if (scaled <= 0xFFFF)
  1573.               {
  1574.                 out_one (DW_CFA_advance_loc2);
  1575.                 out_two (scaled);
  1576.               }
  1577.             else
  1578.               {
  1579.                 out_one (DW_CFA_advance_loc4);
  1580.                 out_four (scaled);
  1581.               }
  1582.           }
  1583.         else
  1584.           {
  1585.             expressionS exp;
  1586.  
  1587.             exp.X_op = O_subtract;
  1588.             exp.X_add_symbol = to;
  1589.             exp.X_op_symbol = from;
  1590.             exp.X_add_number = 0;
  1591.  
  1592.             /* The code in ehopt.c expects that one byte of the encoding
  1593.                is already allocated to the frag.  This comes from the way
  1594.                that it scans the .eh_frame section looking first for the
  1595.                .byte DW_CFA_advance_loc4.  */
  1596.             *frag_more (1) = DW_CFA_advance_loc4;
  1597.  
  1598.             frag_var (rs_cfa, 4, 0, DWARF2_LINE_MIN_INSN_LENGTH << 3,
  1599.                       make_expr_symbol (&exp), frag_now_fix () - 1,
  1600.                       (char *) frag_now);
  1601.           }
  1602.       }
  1603.       break;
  1604.  
  1605.     case DW_CFA_def_cfa:
  1606.       offset = insn->u.ri.offset;
  1607.       if (offset < 0)
  1608.         {
  1609.           out_one (DW_CFA_def_cfa_sf);
  1610.           out_uleb128 (insn->u.ri.reg);
  1611.           out_sleb128 (offset / DWARF2_CIE_DATA_ALIGNMENT);
  1612.         }
  1613.       else
  1614.         {
  1615.           out_one (DW_CFA_def_cfa);
  1616.           out_uleb128 (insn->u.ri.reg);
  1617.           out_uleb128 (offset);
  1618.         }
  1619.       break;
  1620.  
  1621.     case DW_CFA_def_cfa_register:
  1622.     case DW_CFA_undefined:
  1623.     case DW_CFA_same_value:
  1624.       out_one (insn->insn);
  1625.       out_uleb128 (insn->u.r);
  1626.       break;
  1627.  
  1628.     case DW_CFA_def_cfa_offset:
  1629.       offset = insn->u.i;
  1630.       if (offset < 0)
  1631.         {
  1632.           out_one (DW_CFA_def_cfa_offset_sf);
  1633.           out_sleb128 (offset / DWARF2_CIE_DATA_ALIGNMENT);
  1634.         }
  1635.       else
  1636.         {
  1637.           out_one (DW_CFA_def_cfa_offset);
  1638.           out_uleb128 (offset);
  1639.         }
  1640.       break;
  1641.  
  1642.     case DW_CFA_restore:
  1643.       regno = insn->u.r;
  1644.       if (regno <= 0x3F)
  1645.         {
  1646.           out_one (DW_CFA_restore + regno);
  1647.         }
  1648.       else
  1649.         {
  1650.           out_one (DW_CFA_restore_extended);
  1651.           out_uleb128 (regno);
  1652.         }
  1653.       break;
  1654.  
  1655.     case DW_CFA_offset:
  1656.       regno = insn->u.ri.reg;
  1657.       offset = insn->u.ri.offset / DWARF2_CIE_DATA_ALIGNMENT;
  1658.       if (offset < 0)
  1659.         {
  1660.           out_one (DW_CFA_offset_extended_sf);
  1661.           out_uleb128 (regno);
  1662.           out_sleb128 (offset);
  1663.         }
  1664.       else if (regno <= 0x3F)
  1665.         {
  1666.           out_one (DW_CFA_offset + regno);
  1667.           out_uleb128 (offset);
  1668.         }
  1669.       else
  1670.         {
  1671.           out_one (DW_CFA_offset_extended);
  1672.           out_uleb128 (regno);
  1673.           out_uleb128 (offset);
  1674.         }
  1675.       break;
  1676.  
  1677.     case DW_CFA_register:
  1678.       out_one (DW_CFA_register);
  1679.       out_uleb128 (insn->u.rr.reg1);
  1680.       out_uleb128 (insn->u.rr.reg2);
  1681.       break;
  1682.  
  1683.     case DW_CFA_remember_state:
  1684.     case DW_CFA_restore_state:
  1685.       out_one (insn->insn);
  1686.       break;
  1687.  
  1688.     case DW_CFA_GNU_window_save:
  1689.       out_one (DW_CFA_GNU_window_save);
  1690.       break;
  1691.  
  1692.     case CFI_escape:
  1693.       {
  1694.         struct cfi_escape_data *e;
  1695.         for (e = insn->u.esc; e ; e = e->next)
  1696.           emit_expr (&e->exp, 1);
  1697.         break;
  1698.       }
  1699.  
  1700.     case CFI_val_encoded_addr:
  1701.       {
  1702.         unsigned encoding = insn->u.ea.encoding;
  1703.         offsetT enc_size;
  1704.  
  1705.         if (encoding == DW_EH_PE_omit)
  1706.           break;
  1707.         out_one (DW_CFA_val_expression);
  1708.         out_uleb128 (insn->u.ea.reg);
  1709.  
  1710.         switch (encoding & 0x7)
  1711.           {
  1712.           case DW_EH_PE_absptr:
  1713.             enc_size = DWARF2_ADDR_SIZE (stdoutput);
  1714.             break;
  1715.           case DW_EH_PE_udata2:
  1716.             enc_size = 2;
  1717.             break;
  1718.           case DW_EH_PE_udata4:
  1719.             enc_size = 4;
  1720.             break;
  1721.           case DW_EH_PE_udata8:
  1722.             enc_size = 8;
  1723.             break;
  1724.           default:
  1725.             abort ();
  1726.           }
  1727.  
  1728.         /* If the user has requested absolute encoding,
  1729.            then use the smaller DW_OP_addr encoding.  */
  1730.         if (insn->u.ea.encoding == DW_EH_PE_absptr)
  1731.           {
  1732.             out_uleb128 (1 + enc_size);
  1733.             out_one (DW_OP_addr);
  1734.           }
  1735.         else
  1736.           {
  1737.             out_uleb128 (1 + 1 + enc_size);
  1738.             out_one (DW_OP_GNU_encoded_addr);
  1739.             out_one (encoding);
  1740.  
  1741.             if ((encoding & 0x70) == DW_EH_PE_pcrel)
  1742.               {
  1743. #if CFI_DIFF_EXPR_OK
  1744.                 insn->u.ea.exp.X_op = O_subtract;
  1745.                 insn->u.ea.exp.X_op_symbol = symbol_temp_new_now ();
  1746. #elif defined (tc_cfi_emit_pcrel_expr)
  1747.                 tc_cfi_emit_pcrel_expr (&insn->u.ea.exp, enc_size);
  1748.                 break;
  1749. #else
  1750.                 abort ();
  1751. #endif
  1752.               }
  1753.           }
  1754.         emit_expr (&insn->u.ea.exp, enc_size);
  1755.       }
  1756.       break;
  1757.  
  1758.     case CFI_label:
  1759.       colon (insn->u.sym_name);
  1760.       break;
  1761.  
  1762.     default:
  1763.       abort ();
  1764.     }
  1765. }
  1766.  
  1767. static void
  1768. output_cie (struct cie_entry *cie, bfd_boolean eh_frame, int align)
  1769. {
  1770.   symbolS *after_size_address, *end_address;
  1771.   expressionS exp;
  1772.   struct cfi_insn_data *i;
  1773.   offsetT augmentation_size;
  1774.   int enc;
  1775.   enum dwarf2_format fmt = DWARF2_FORMAT (now_seg);
  1776.  
  1777.   cie->start_address = symbol_temp_new_now ();
  1778.   after_size_address = symbol_temp_make ();
  1779.   end_address = symbol_temp_make ();
  1780.  
  1781.   exp.X_op = O_subtract;
  1782.   exp.X_add_symbol = end_address;
  1783.   exp.X_op_symbol = after_size_address;
  1784.   exp.X_add_number = 0;
  1785.  
  1786.   if (eh_frame || fmt == dwarf2_format_32bit)
  1787.     emit_expr (&exp, 4);                        /* Length.  */
  1788.   else
  1789.     {
  1790.       if (fmt == dwarf2_format_64bit)
  1791.         out_four (-1);
  1792.       emit_expr (&exp, 8);                      /* Length.  */
  1793.     }
  1794.   symbol_set_value_now (after_size_address);
  1795.   if (eh_frame)
  1796.     out_four (0);                               /* CIE id.  */
  1797.   else
  1798.     {
  1799.       out_four (-1);                            /* CIE id.  */
  1800.       if (fmt != dwarf2_format_32bit)
  1801.         out_four (-1);
  1802.     }
  1803.   out_one (DW_CIE_VERSION);                     /* Version.  */
  1804.   if (eh_frame)
  1805.     {
  1806.       out_one ('z');                            /* Augmentation.  */
  1807.       if (cie->per_encoding != DW_EH_PE_omit)
  1808.         out_one ('P');
  1809.       if (cie->lsda_encoding != DW_EH_PE_omit)
  1810.         out_one ('L');
  1811.       out_one ('R');
  1812.     }
  1813.   if (cie->signal_frame)
  1814.     out_one ('S');
  1815.   out_one (0);
  1816.   out_uleb128 (DWARF2_LINE_MIN_INSN_LENGTH);    /* Code alignment.  */
  1817.   out_sleb128 (DWARF2_CIE_DATA_ALIGNMENT);      /* Data alignment.  */
  1818.   if (DW_CIE_VERSION == 1)                      /* Return column.  */
  1819.     out_one (cie->return_column);
  1820.   else
  1821.     out_uleb128 (cie->return_column);
  1822.   if (eh_frame)
  1823.     {
  1824.       augmentation_size = 1 + (cie->lsda_encoding != DW_EH_PE_omit);
  1825.       if (cie->per_encoding != DW_EH_PE_omit)
  1826.         augmentation_size += 1 + encoding_size (cie->per_encoding);
  1827.       out_uleb128 (augmentation_size);          /* Augmentation size.  */
  1828.  
  1829.       emit_expr_encoded (&cie->personality, cie->per_encoding, TRUE);
  1830.  
  1831.       if (cie->lsda_encoding != DW_EH_PE_omit)
  1832.         out_one (cie->lsda_encoding);
  1833.     }
  1834.  
  1835.   switch (DWARF2_FDE_RELOC_SIZE)
  1836.     {
  1837.     case 2:
  1838.       enc = DW_EH_PE_sdata2;
  1839.       break;
  1840.     case 4:
  1841.       enc = DW_EH_PE_sdata4;
  1842.       break;
  1843.     case 8:
  1844.       enc = DW_EH_PE_sdata8;
  1845.       break;
  1846.     default:
  1847.       abort ();
  1848.     }
  1849. #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
  1850.   enc |= DW_EH_PE_pcrel;
  1851. #endif
  1852. #ifdef DWARF2_FDE_RELOC_ENCODING
  1853.   /* Allow target to override encoding.  */
  1854.   enc = DWARF2_FDE_RELOC_ENCODING (enc);
  1855. #endif
  1856.   cie->fde_encoding = enc;
  1857.   if (eh_frame)
  1858.     out_one (enc);
  1859.  
  1860.   if (cie->first)
  1861.     {
  1862.       for (i = cie->first; i != cie->last; i = i->next)
  1863.         {
  1864.           if (CUR_SEG (i) != CUR_SEG (cie))
  1865.             continue;
  1866.           output_cfi_insn (i);
  1867.         }
  1868.     }
  1869.  
  1870.   frag_align (align, DW_CFA_nop, 0);
  1871.   symbol_set_value_now (end_address);
  1872. }
  1873.  
  1874. static void
  1875. output_fde (struct fde_entry *fde, struct cie_entry *cie,
  1876.             bfd_boolean eh_frame, struct cfi_insn_data *first,
  1877.             int align)
  1878. {
  1879.   symbolS *after_size_address, *end_address;
  1880.   expressionS exp;
  1881.   offsetT augmentation_size;
  1882.   enum dwarf2_format fmt = DWARF2_FORMAT (now_seg);
  1883.   int offset_size;
  1884.   int addr_size;
  1885.  
  1886.   after_size_address = symbol_temp_make ();
  1887.   end_address = symbol_temp_make ();
  1888.  
  1889.   exp.X_op = O_subtract;
  1890.   exp.X_add_symbol = end_address;
  1891.   exp.X_op_symbol = after_size_address;
  1892.   exp.X_add_number = 0;
  1893.   if (eh_frame || fmt == dwarf2_format_32bit)
  1894.     offset_size = 4;
  1895.   else
  1896.     {
  1897.       if (fmt == dwarf2_format_64bit)
  1898.         out_four (-1);
  1899.       offset_size = 8;
  1900.     }
  1901.   emit_expr (&exp, offset_size);                /* Length.  */
  1902.   symbol_set_value_now (after_size_address);
  1903.  
  1904.   if (eh_frame)
  1905.     {
  1906.       exp.X_op = O_subtract;
  1907.       exp.X_add_symbol = after_size_address;
  1908.       exp.X_op_symbol = cie->start_address;
  1909.       exp.X_add_number = 0;
  1910.       emit_expr (&exp, offset_size);            /* CIE offset.  */
  1911.     }
  1912.   else
  1913.     {
  1914.       TC_DWARF2_EMIT_OFFSET (cie->start_address, offset_size);
  1915.     }
  1916.  
  1917.   exp.X_op = O_symbol;
  1918.   if (eh_frame)
  1919.     {
  1920.       bfd_reloc_code_real_type code
  1921.         = tc_cfi_reloc_for_encoding (cie->fde_encoding);
  1922.       if (code != BFD_RELOC_NONE)
  1923.         {
  1924.           reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, code);
  1925.           char *p = frag_more (4);
  1926.           md_number_to_chars (p, 0, 4);
  1927.           fix_new (frag_now, p - frag_now->fr_literal, 4, fde->start_address,
  1928.                    0, howto->pc_relative, code);
  1929.         }
  1930.       else
  1931.         {
  1932.           exp.X_op = O_subtract;
  1933.           exp.X_add_number = 0;
  1934. #if CFI_DIFF_EXPR_OK
  1935.           exp.X_add_symbol = fde->start_address;
  1936.           exp.X_op_symbol = symbol_temp_new_now ();
  1937.           emit_expr (&exp, DWARF2_FDE_RELOC_SIZE);      /* Code offset.  */
  1938. #else
  1939.           exp.X_op = O_symbol;
  1940.           exp.X_add_symbol = fde->start_address;
  1941.  
  1942. #if defined(tc_cfi_emit_pcrel_expr)
  1943.           tc_cfi_emit_pcrel_expr (&exp, DWARF2_FDE_RELOC_SIZE);  /* Code offset.  */
  1944. #else
  1945.           emit_expr (&exp, DWARF2_FDE_RELOC_SIZE);      /* Code offset.  */
  1946. #endif
  1947. #endif
  1948.         }
  1949.       addr_size = DWARF2_FDE_RELOC_SIZE;
  1950.     }
  1951.   else
  1952.     {
  1953.       exp.X_add_number = 0;
  1954.       exp.X_add_symbol = fde->start_address;
  1955.       addr_size = DWARF2_ADDR_SIZE (stdoutput);
  1956.       emit_expr (&exp, addr_size);
  1957.     }
  1958.  
  1959.   exp.X_op = O_subtract;
  1960.   exp.X_add_symbol = fde->end_address;
  1961.   exp.X_op_symbol = fde->start_address;         /* Code length.  */
  1962.   exp.X_add_number = 0;
  1963.   emit_expr (&exp, addr_size);
  1964.  
  1965.   augmentation_size = encoding_size (fde->lsda_encoding);
  1966.   if (eh_frame)
  1967.     out_uleb128 (augmentation_size);            /* Augmentation size.  */
  1968.  
  1969.   emit_expr_encoded (&fde->lsda, cie->lsda_encoding, FALSE);
  1970.  
  1971.   for (; first; first = first->next)
  1972.     if (CUR_SEG (first) == CUR_SEG (fde))
  1973.       output_cfi_insn (first);
  1974.  
  1975.   frag_align (align, DW_CFA_nop, 0);
  1976.   symbol_set_value_now (end_address);
  1977. }
  1978.  
  1979. static struct cie_entry *
  1980. select_cie_for_fde (struct fde_entry *fde, bfd_boolean eh_frame,
  1981.                     struct cfi_insn_data **pfirst, int align)
  1982. {
  1983.   struct cfi_insn_data *i, *j;
  1984.   struct cie_entry *cie;
  1985.  
  1986.   for (cie = cie_root; cie; cie = cie->next)
  1987.     {
  1988.       if (CUR_SEG (cie) != CUR_SEG (fde))
  1989.         continue;
  1990.       if (cie->return_column != fde->return_column
  1991.           || cie->signal_frame != fde->signal_frame
  1992.           || cie->per_encoding != fde->per_encoding
  1993.           || cie->lsda_encoding != fde->lsda_encoding)
  1994.         continue;
  1995.       if (cie->per_encoding != DW_EH_PE_omit)
  1996.         {
  1997.           if (cie->personality.X_op != fde->personality.X_op
  1998.               || cie->personality.X_add_number
  1999.                  != fde->personality.X_add_number)
  2000.             continue;
  2001.           switch (cie->personality.X_op)
  2002.             {
  2003.             case O_constant:
  2004.               if (cie->personality.X_unsigned != fde->personality.X_unsigned)
  2005.                 continue;
  2006.               break;
  2007.             case O_symbol:
  2008.               if (cie->personality.X_add_symbol
  2009.                   != fde->personality.X_add_symbol)
  2010.                 continue;
  2011.               break;
  2012.             default:
  2013.               abort ();
  2014.             }
  2015.         }
  2016.       for (i = cie->first, j = fde->data;
  2017.            i != cie->last && j != NULL;
  2018.            i = i->next, j = j->next)
  2019.         {
  2020.           if (i->insn != j->insn)
  2021.             goto fail;
  2022.           switch (i->insn)
  2023.             {
  2024.             case DW_CFA_advance_loc:
  2025.             case DW_CFA_remember_state:
  2026.               /* We reached the first advance/remember in the FDE,
  2027.                  but did not reach the end of the CIE list.  */
  2028.               goto fail;
  2029.  
  2030.             case DW_CFA_offset:
  2031.             case DW_CFA_def_cfa:
  2032.               if (i->u.ri.reg != j->u.ri.reg)
  2033.                 goto fail;
  2034.               if (i->u.ri.offset != j->u.ri.offset)
  2035.                 goto fail;
  2036.               break;
  2037.  
  2038.             case DW_CFA_register:
  2039.               if (i->u.rr.reg1 != j->u.rr.reg1)
  2040.                 goto fail;
  2041.               if (i->u.rr.reg2 != j->u.rr.reg2)
  2042.                 goto fail;
  2043.               break;
  2044.  
  2045.             case DW_CFA_def_cfa_register:
  2046.             case DW_CFA_restore:
  2047.             case DW_CFA_undefined:
  2048.             case DW_CFA_same_value:
  2049.               if (i->u.r != j->u.r)
  2050.                 goto fail;
  2051.               break;
  2052.  
  2053.             case DW_CFA_def_cfa_offset:
  2054.               if (i->u.i != j->u.i)
  2055.                 goto fail;
  2056.               break;
  2057.  
  2058.             case CFI_escape:
  2059.             case CFI_val_encoded_addr:
  2060.             case CFI_label:
  2061.               /* Don't bother matching these for now.  */
  2062.               goto fail;
  2063.  
  2064.             default:
  2065.               abort ();
  2066.             }
  2067.         }
  2068.  
  2069.       /* Success if we reached the end of the CIE list, and we've either
  2070.          run out of FDE entries or we've encountered an advance,
  2071.          remember, or escape.  */
  2072.       if (i == cie->last
  2073.           && (!j
  2074.               || j->insn == DW_CFA_advance_loc
  2075.               || j->insn == DW_CFA_remember_state
  2076.               || j->insn == CFI_escape
  2077.               || j->insn == CFI_val_encoded_addr
  2078.               || j->insn == CFI_label))
  2079.         {
  2080.           *pfirst = j;
  2081.           return cie;
  2082.         }
  2083.  
  2084.     fail:;
  2085.     }
  2086.  
  2087.   cie = (struct cie_entry *) xmalloc (sizeof (struct cie_entry));
  2088.   cie->next = cie_root;
  2089.   cie_root = cie;
  2090.   SET_CUR_SEG (cie, CUR_SEG (fde));
  2091.   cie->return_column = fde->return_column;
  2092.   cie->signal_frame = fde->signal_frame;
  2093.   cie->per_encoding = fde->per_encoding;
  2094.   cie->lsda_encoding = fde->lsda_encoding;
  2095.   cie->personality = fde->personality;
  2096.   cie->first = fde->data;
  2097.  
  2098.   for (i = cie->first; i ; i = i->next)
  2099.     if (i->insn == DW_CFA_advance_loc
  2100.         || i->insn == DW_CFA_remember_state
  2101.         || i->insn == CFI_escape
  2102.         || i->insn == CFI_val_encoded_addr
  2103.         || i->insn == CFI_label)
  2104.       break;
  2105.  
  2106.   cie->last = i;
  2107.   *pfirst = i;
  2108.  
  2109.   output_cie (cie, eh_frame, align);
  2110.  
  2111.   return cie;
  2112. }
  2113.  
  2114. #ifdef md_reg_eh_frame_to_debug_frame
  2115. static void
  2116. cfi_change_reg_numbers (struct cfi_insn_data *insn, segT ccseg)
  2117. {
  2118.   for (; insn; insn = insn->next)
  2119.     {
  2120.       if (CUR_SEG (insn) != ccseg)
  2121.         continue;
  2122.       switch (insn->insn)
  2123.         {
  2124.         case DW_CFA_advance_loc:
  2125.         case DW_CFA_def_cfa_offset:
  2126.         case DW_CFA_remember_state:
  2127.         case DW_CFA_restore_state:
  2128.         case DW_CFA_GNU_window_save:
  2129.         case CFI_escape:
  2130.         case CFI_label:
  2131.           break;
  2132.  
  2133.         case DW_CFA_def_cfa:
  2134.         case DW_CFA_offset:
  2135.           insn->u.ri.reg = md_reg_eh_frame_to_debug_frame (insn->u.ri.reg);
  2136.           break;
  2137.  
  2138.         case DW_CFA_def_cfa_register:
  2139.         case DW_CFA_undefined:
  2140.         case DW_CFA_same_value:
  2141.         case DW_CFA_restore:
  2142.           insn->u.r = md_reg_eh_frame_to_debug_frame (insn->u.r);
  2143.           break;
  2144.  
  2145.         case DW_CFA_register:
  2146.           insn->u.rr.reg1 = md_reg_eh_frame_to_debug_frame (insn->u.rr.reg1);
  2147.           insn->u.rr.reg2 = md_reg_eh_frame_to_debug_frame (insn->u.rr.reg2);
  2148.           break;
  2149.  
  2150.         case CFI_val_encoded_addr:
  2151.           insn->u.ea.reg = md_reg_eh_frame_to_debug_frame (insn->u.ea.reg);
  2152.           break;
  2153.  
  2154.         default:
  2155.           abort ();
  2156.         }
  2157.     }
  2158. }
  2159. #else
  2160. #define cfi_change_reg_numbers(insn, cseg) do { } while (0)
  2161. #endif
  2162.  
  2163. #if SUPPORT_COMPACT_EH
  2164. static void
  2165. cfi_emit_eh_header (symbolS *sym, bfd_vma addend)
  2166. {
  2167.   expressionS exp;
  2168.  
  2169.   exp.X_add_number = addend;
  2170.   exp.X_add_symbol = sym;
  2171.   emit_expr_encoded (&exp, DW_EH_PE_sdata4 | DW_EH_PE_pcrel, FALSE);
  2172. }
  2173.  
  2174. static void
  2175. output_eh_header (struct fde_entry *fde)
  2176. {
  2177.   char *p;
  2178.   bfd_vma addend;
  2179.  
  2180.   if (fde->eh_header_type == EH_COMPACT_INLINE)
  2181.     addend = 0;
  2182.   else
  2183.     addend = 1;
  2184.  
  2185.   cfi_emit_eh_header (fde->start_address, addend);
  2186.  
  2187.   if (fde->eh_header_type == EH_COMPACT_INLINE)
  2188.     {
  2189.       p = frag_more (4);
  2190.       /* Inline entries always use PR1.  */
  2191.       *(p++) = 1;
  2192.       memcpy(p, fde->eh_data, 3);
  2193.     }
  2194.   else
  2195.     {
  2196.       if (fde->eh_header_type == EH_COMPACT_LEGACY)
  2197.         addend = 1;
  2198.       else if (fde->eh_header_type == EH_COMPACT_OUTLINE
  2199.                || fde->eh_header_type == EH_COMPACT_OUTLINE_DONE)
  2200.         addend = 0;
  2201.       else
  2202.         abort ();
  2203.       cfi_emit_eh_header (fde->eh_loc, addend);
  2204.     }
  2205. }
  2206. #endif
  2207.  
  2208. void
  2209. cfi_finish (void)
  2210. {
  2211.   struct cie_entry *cie, *cie_next;
  2212.   segT cfi_seg, ccseg;
  2213.   struct fde_entry *fde;
  2214.   struct cfi_insn_data *first;
  2215.   int save_flag_traditional_format, seek_next_seg;
  2216.  
  2217.   if (all_fde_data == 0)
  2218.     return;
  2219.  
  2220.   if ((all_cfi_sections & CFI_EMIT_eh_frame) != 0
  2221.       || (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0)
  2222.     {
  2223.       /* Make sure check_eh_frame doesn't do anything with our output.  */
  2224.       save_flag_traditional_format = flag_traditional_format;
  2225.       flag_traditional_format = 1;
  2226.  
  2227.       if (!EH_FRAME_LINKONCE)
  2228.         {
  2229.           /* Open .eh_frame section.  */
  2230.           cfi_seg = get_cfi_seg (NULL, ".eh_frame",
  2231.                                  (SEC_ALLOC | SEC_LOAD | SEC_DATA
  2232.                                   | DWARF2_EH_FRAME_READ_ONLY),
  2233.                                  EH_FRAME_ALIGNMENT);
  2234. #ifdef md_fix_up_eh_frame
  2235.           md_fix_up_eh_frame (cfi_seg);
  2236. #else
  2237.           (void) cfi_seg;
  2238. #endif
  2239.         }
  2240.  
  2241.       do
  2242.         {
  2243.           ccseg = NULL;
  2244.           seek_next_seg = 0;
  2245.  
  2246.           for (cie = cie_root; cie; cie = cie_next)
  2247.             {
  2248.               cie_next = cie->next;
  2249.               free ((void *) cie);
  2250.             }
  2251.           cie_root = NULL;
  2252.  
  2253.           for (fde = all_fde_data; fde ; fde = fde->next)
  2254.             {
  2255.               if ((fde->sections & CFI_EMIT_eh_frame) == 0
  2256.                   && (fde->sections & CFI_EMIT_eh_frame_compact) == 0)
  2257.                 continue;
  2258.  
  2259. #if SUPPORT_COMPACT_EH
  2260.               /* Emit a LEGACY format header if we have processed all
  2261.                  of the .cfi directives without encountering either inline or
  2262.                  out-of-line compact unwinding opcodes.  */
  2263.               if (fde->eh_header_type == EH_COMPACT_HAS_LSDA
  2264.                   || fde->eh_header_type == EH_COMPACT_UNKNOWN)
  2265.                 fde->eh_header_type = EH_COMPACT_LEGACY;
  2266.  
  2267.               if (fde->eh_header_type != EH_COMPACT_LEGACY)
  2268.                 continue;
  2269. #endif
  2270.               if (EH_FRAME_LINKONCE)
  2271.                 {
  2272.                   if (HANDLED (fde))
  2273.                     continue;
  2274.                   if (seek_next_seg && CUR_SEG (fde) != ccseg)
  2275.                     {
  2276.                       seek_next_seg = 2;
  2277.                       continue;
  2278.                     }
  2279.                   if (!seek_next_seg)
  2280.                     {
  2281.                       ccseg = CUR_SEG (fde);
  2282.                       /* Open .eh_frame section.  */
  2283.                       cfi_seg = get_cfi_seg (ccseg, ".eh_frame",
  2284.                                              (SEC_ALLOC | SEC_LOAD | SEC_DATA
  2285.                                               | DWARF2_EH_FRAME_READ_ONLY),
  2286.                                              EH_FRAME_ALIGNMENT);
  2287. #ifdef md_fix_up_eh_frame
  2288.                       md_fix_up_eh_frame (cfi_seg);
  2289. #else
  2290.                       (void) cfi_seg;
  2291. #endif
  2292.                       seek_next_seg = 1;
  2293.                     }
  2294.                   SET_HANDLED (fde, 1);
  2295.                 }
  2296.  
  2297.               if (fde->end_address == NULL)
  2298.                 {
  2299.                   as_bad (_("open CFI at the end of file; missing .cfi_endproc directive"));
  2300.                   fde->end_address = fde->start_address;
  2301.                 }
  2302.  
  2303.               cie = select_cie_for_fde (fde, TRUE, &first, 2);
  2304.               fde->eh_loc = symbol_temp_new_now ();
  2305.               output_fde (fde, cie, TRUE, first,
  2306.                           fde->next == NULL ? EH_FRAME_ALIGNMENT : 2);
  2307.             }
  2308.         }
  2309.       while (EH_FRAME_LINKONCE && seek_next_seg == 2);
  2310.  
  2311.       if (EH_FRAME_LINKONCE)
  2312.         for (fde = all_fde_data; fde ; fde = fde->next)
  2313.           SET_HANDLED (fde, 0);
  2314.  
  2315. #if SUPPORT_COMPACT_EH
  2316.       if (compact_eh)
  2317.         {
  2318.           /* Create remaining out of line table entries.  */
  2319.           do
  2320.             {
  2321.               ccseg = NULL;
  2322.               seek_next_seg = 0;
  2323.  
  2324.               for (fde = all_fde_data; fde ; fde = fde->next)
  2325.                 {
  2326.                   if ((fde->sections & CFI_EMIT_eh_frame) == 0
  2327.                       && (fde->sections & CFI_EMIT_eh_frame_compact) == 0)
  2328.                     continue;
  2329.  
  2330.                   if (fde->eh_header_type != EH_COMPACT_OUTLINE)
  2331.                     continue;
  2332.                   if (HANDLED (fde))
  2333.                     continue;
  2334.                   if (seek_next_seg && CUR_SEG (fde) != ccseg)
  2335.                     {
  2336.                       seek_next_seg = 2;
  2337.                       continue;
  2338.                     }
  2339.                   if (!seek_next_seg)
  2340.                     {
  2341.                       ccseg = CUR_SEG (fde);
  2342.                       /* Open .gnu_extab section.  */
  2343.                       get_cfi_seg (ccseg, ".gnu_extab",
  2344.                                    (SEC_ALLOC | SEC_LOAD | SEC_DATA
  2345.                                     | DWARF2_EH_FRAME_READ_ONLY),
  2346.                                    1);
  2347.                       seek_next_seg = 1;
  2348.                     }
  2349.                   SET_HANDLED (fde, 1);
  2350.  
  2351.                   frag_align (1, 0, 0);
  2352.                   record_alignment (now_seg, 1);
  2353.                   output_compact_unwind_data (fde, 1);
  2354.                 }
  2355.             }
  2356.           while (EH_FRAME_LINKONCE && seek_next_seg == 2);
  2357.  
  2358.           for (fde = all_fde_data; fde ; fde = fde->next)
  2359.             SET_HANDLED (fde, 0);
  2360.  
  2361.           /* Create index table fragments.  */
  2362.           do
  2363.             {
  2364.               ccseg = NULL;
  2365.               seek_next_seg = 0;
  2366.  
  2367.               for (fde = all_fde_data; fde ; fde = fde->next)
  2368.                 {
  2369.                   if ((fde->sections & CFI_EMIT_eh_frame) == 0
  2370.                       && (fde->sections & CFI_EMIT_eh_frame_compact) == 0)
  2371.                     continue;
  2372.  
  2373.                   if (HANDLED (fde))
  2374.                     continue;
  2375.                   if (seek_next_seg && CUR_SEG (fde) != ccseg)
  2376.                     {
  2377.                       seek_next_seg = 2;
  2378.                       continue;
  2379.                     }
  2380.                   if (!seek_next_seg)
  2381.                     {
  2382.                       ccseg = CUR_SEG (fde);
  2383.                       /* Open .eh_frame_entry section.  */
  2384.                       cfi_seg = get_cfi_seg (ccseg, ".eh_frame_entry",
  2385.                                              (SEC_ALLOC | SEC_LOAD | SEC_DATA
  2386.                                               | DWARF2_EH_FRAME_READ_ONLY),
  2387.                                              2);
  2388.                       seek_next_seg = 1;
  2389.                     }
  2390.                   SET_HANDLED (fde, 1);
  2391.  
  2392.                   output_eh_header (fde);
  2393.                 }
  2394.             }
  2395.           while (seek_next_seg == 2);
  2396.  
  2397.           for (fde = all_fde_data; fde ; fde = fde->next)
  2398.             SET_HANDLED (fde, 0);
  2399.         }
  2400. #endif /* SUPPORT_COMPACT_EH */
  2401.  
  2402.       flag_traditional_format = save_flag_traditional_format;
  2403.     }
  2404.  
  2405.   if ((all_cfi_sections & CFI_EMIT_debug_frame) != 0)
  2406.     {
  2407.       int alignment = ffs (DWARF2_ADDR_SIZE (stdoutput)) - 1;
  2408.  
  2409.       if (!SUPPORT_FRAME_LINKONCE)
  2410.         get_cfi_seg (NULL, ".debug_frame",
  2411.                      SEC_READONLY | SEC_DEBUGGING,
  2412.                      alignment);
  2413.  
  2414.       do
  2415.         {
  2416.           ccseg = NULL;
  2417.           seek_next_seg = 0;
  2418.  
  2419.           for (cie = cie_root; cie; cie = cie_next)
  2420.             {
  2421.               cie_next = cie->next;
  2422.               free ((void *) cie);
  2423.             }
  2424.           cie_root = NULL;
  2425.  
  2426.           for (fde = all_fde_data; fde ; fde = fde->next)
  2427.             {
  2428.               if ((fde->sections & CFI_EMIT_debug_frame) == 0)
  2429.                 continue;
  2430.  
  2431.               if (SUPPORT_FRAME_LINKONCE)
  2432.                 {
  2433.                   if (HANDLED (fde))
  2434.                     continue;
  2435.                   if (seek_next_seg && CUR_SEG (fde) != ccseg)
  2436.                     {
  2437.                       seek_next_seg = 2;
  2438.                       continue;
  2439.                     }
  2440.                   if (!seek_next_seg)
  2441.                     {
  2442.                       ccseg = CUR_SEG (fde);
  2443.                       /* Open .debug_frame section.  */
  2444.                       get_cfi_seg (ccseg, ".debug_frame",
  2445.                                    SEC_READONLY | SEC_DEBUGGING,
  2446.                                    alignment);
  2447.                       seek_next_seg = 1;
  2448.                     }
  2449.                   SET_HANDLED (fde, 1);
  2450.                 }
  2451.               if (fde->end_address == NULL)
  2452.                 {
  2453.                   as_bad (_("open CFI at the end of file; missing .cfi_endproc directive"));
  2454.                   fde->end_address = fde->start_address;
  2455.                 }
  2456.  
  2457.               fde->per_encoding = DW_EH_PE_omit;
  2458.               fde->lsda_encoding = DW_EH_PE_omit;
  2459.               cfi_change_reg_numbers (fde->data, ccseg);
  2460.               cie = select_cie_for_fde (fde, FALSE, &first, alignment);
  2461.               output_fde (fde, cie, FALSE, first, alignment);
  2462.             }
  2463.         }
  2464.       while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2);
  2465.  
  2466.       if (SUPPORT_FRAME_LINKONCE)
  2467.         for (fde = all_fde_data; fde ; fde = fde->next)
  2468.           SET_HANDLED (fde, 0);
  2469.     }
  2470. }
  2471.  
  2472. #else /* TARGET_USE_CFIPOP */
  2473.  
  2474. /* Emit an intelligible error message for missing support.  */
  2475.  
  2476. static void
  2477. dot_cfi_dummy (int ignored ATTRIBUTE_UNUSED)
  2478. {
  2479.   as_bad (_("CFI is not supported for this target"));
  2480.   ignore_rest_of_line ();
  2481. }
  2482.  
  2483. const pseudo_typeS cfi_pseudo_table[] =
  2484.   {
  2485.     { "cfi_sections", dot_cfi_dummy, 0 },
  2486.     { "cfi_startproc", dot_cfi_dummy, 0 },
  2487.     { "cfi_endproc", dot_cfi_dummy, 0 },
  2488.     { "cfi_fde_data", dot_cfi_dummy, 0 },
  2489.     { "cfi_def_cfa", dot_cfi_dummy, 0 },
  2490.     { "cfi_def_cfa_register", dot_cfi_dummy, 0 },
  2491.     { "cfi_def_cfa_offset", dot_cfi_dummy, 0 },
  2492.     { "cfi_adjust_cfa_offset", dot_cfi_dummy, 0 },
  2493.     { "cfi_offset", dot_cfi_dummy, 0 },
  2494.     { "cfi_rel_offset", dot_cfi_dummy, 0 },
  2495.     { "cfi_register", dot_cfi_dummy, 0 },
  2496.     { "cfi_return_column", dot_cfi_dummy, 0 },
  2497.     { "cfi_restore", dot_cfi_dummy, 0 },
  2498.     { "cfi_undefined", dot_cfi_dummy, 0 },
  2499.     { "cfi_same_value", dot_cfi_dummy, 0 },
  2500.     { "cfi_remember_state", dot_cfi_dummy, 0 },
  2501.     { "cfi_restore_state", dot_cfi_dummy, 0 },
  2502.     { "cfi_window_save", dot_cfi_dummy, 0 },
  2503.     { "cfi_escape", dot_cfi_dummy, 0 },
  2504.     { "cfi_signal_frame", dot_cfi_dummy, 0 },
  2505.     { "cfi_personality", dot_cfi_dummy, 0 },
  2506.     { "cfi_personality_id", dot_cfi_dummy, 0 },
  2507.     { "cfi_lsda", dot_cfi_dummy, 0 },
  2508.     { "cfi_val_encoded_addr", dot_cfi_dummy, 0 },
  2509.     { "cfi_label", dot_cfi_dummy, 0 },
  2510.     { "cfi_inline_lsda", dot_cfi_dummy, 0 },
  2511.     { NULL, NULL, 0 }
  2512.   };
  2513.  
  2514. void
  2515. cfi_finish (void)
  2516. {
  2517. }
  2518. #endif /* TARGET_USE_CFIPOP */
  2519.