Home | History | Annotate | Download | only in gas
      1 /* dw2gencfi.h - Support for generating Dwarf2 CFI information.
      2    Copyright (C) 2003-2014 Free Software Foundation, Inc.
      3    Contributed by Michal Ludvig <mludvig (at) 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 #ifndef DW2GENCFI_H
     23 #define DW2GENCFI_H
     24 
     25 #include "dwarf2.h"
     26 
     27 struct symbol;
     28 
     29 extern const pseudo_typeS cfi_pseudo_table[];
     30 
     31 /* cfi_finish() is called at the end of file. It will complain if
     32    the last CFI wasn't properly closed by .cfi_endproc.  */
     33 extern void cfi_finish (void);
     34 
     35 /* Entry points for backends to add unwind information.  */
     36 extern void cfi_new_fde (struct symbol *);
     37 extern void cfi_end_fde (struct symbol *);
     38 extern void cfi_set_return_column (unsigned);
     39 extern void cfi_add_advance_loc (struct symbol *);
     40 
     41 extern void cfi_add_CFA_offset (unsigned, offsetT);
     42 extern void cfi_add_CFA_def_cfa (unsigned, offsetT);
     43 extern void cfi_add_CFA_register (unsigned, unsigned);
     44 extern void cfi_add_CFA_def_cfa_register (unsigned);
     45 extern void cfi_add_CFA_def_cfa_offset (offsetT);
     46 extern void cfi_add_CFA_restore (unsigned);
     47 extern void cfi_add_CFA_undefined (unsigned);
     48 extern void cfi_add_CFA_same_value (unsigned);
     49 extern void cfi_add_CFA_remember_state (void);
     50 extern void cfi_add_CFA_restore_state (void);
     51 
     52 /* Structures for md_cfi_end.  */
     53 
     54 #if defined (TE_PE) || defined (TE_PEP)
     55 #define SUPPORT_FRAME_LINKONCE 1
     56 #else
     57 #define SUPPORT_FRAME_LINKONCE 0
     58 #endif
     59 
     60 struct cfi_insn_data
     61 {
     62   struct cfi_insn_data *next;
     63 #if SUPPORT_FRAME_LINKONCE
     64   segT cur_seg;
     65 #endif
     66   int insn;
     67   union
     68   {
     69     struct
     70     {
     71       unsigned reg;
     72       offsetT offset;
     73     } ri;
     74 
     75     struct
     76     {
     77       unsigned reg1;
     78       unsigned reg2;
     79     } rr;
     80 
     81     unsigned r;
     82     offsetT i;
     83 
     84     struct
     85     {
     86       symbolS *lab1;
     87       symbolS *lab2;
     88     } ll;
     89 
     90     struct cfi_escape_data *esc;
     91 
     92     struct
     93     {
     94       unsigned reg, encoding;
     95       expressionS exp;
     96     } ea;
     97   } u;
     98 };
     99 
    100 struct fde_entry
    101 {
    102   struct fde_entry *next;
    103 #if SUPPORT_FRAME_LINKONCE
    104   segT cur_seg;
    105 #endif
    106   symbolS *start_address;
    107   symbolS *end_address;
    108   struct cfi_insn_data *data;
    109   struct cfi_insn_data **last;
    110   unsigned char per_encoding;
    111   unsigned char lsda_encoding;
    112   expressionS personality;
    113   expressionS lsda;
    114   unsigned int return_column;
    115   unsigned int signal_frame;
    116 #if SUPPORT_FRAME_LINKONCE
    117   int handled;
    118 #endif
    119 };
    120 
    121 /* The list of all FDEs that have been collected.  */
    122 extern struct fde_entry *all_fde_data;
    123 
    124 /* Fake CFI type; outside the byte range of any real CFI insn.  */
    125 #define CFI_adjust_cfa_offset	0x100
    126 #define CFI_return_column	0x101
    127 #define CFI_rel_offset		0x102
    128 #define CFI_escape		0x103
    129 #define CFI_signal_frame	0x104
    130 #define CFI_val_encoded_addr	0x105
    131 
    132 #endif /* DW2GENCFI_H */
    133