Commit | Line | Data |
---|---|---|
54cfded0 AM |
1 | /* dw2gencfi.h - Support for generating Dwarf2 CFI information. |
2 | Copyright 2003 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 2, 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, 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
21 | ||
22 | #ifndef DW2GENCFI_H | |
23 | #define DW2GENCFI_H | |
24 | ||
25 | #include "elf/dwarf2.h" | |
26 | ||
27 | struct cfi_config { | |
28 | /* Target address length in bytes. (usually 4 or 8). | |
29 | Round it up for archs like S/390 with 31b addresses. */ | |
30 | unsigned int addr_length; | |
31 | ||
32 | /* Alignment of .eh_frame blocks in bytes (usually 1, 4 or 8). */ | |
33 | unsigned int eh_align; | |
34 | ||
35 | /* Code alignment (1 for x86/amd64 machines, 4 or 8 for | |
36 | RISC machines). Consult Dwarf2 standard for details. */ | |
37 | int code_align; | |
38 | ||
39 | /* Data (stack) alignment (-4 on x86, -8 on amd64, something | |
40 | positive on archs where stack grows up). Consult Dwarf2 | |
41 | standard for details. */ | |
42 | int data_align; | |
43 | ||
44 | /* Return address column (0x8 on x86, 0x10 on amd64). Consult | |
45 | Dwarf2 standard for details. */ | |
46 | int ra_column; | |
47 | ||
48 | /* Relocation type for init_addr FDE record. (BFD_RELOC_64 | |
49 | on amd64). */ | |
50 | int reloc_type; | |
51 | }; | |
52 | ||
53 | /* Codes of CFI instructions taken from Dwarf2 standard. */ | |
54 | enum cfi_insn { | |
55 | CFA_nop = DW_CFA_nop, | |
56 | CFA_set_loc = DW_CFA_set_loc, | |
57 | CFA_advance_loc1 = DW_CFA_advance_loc1, | |
58 | CFA_advance_loc2 = DW_CFA_advance_loc2, | |
59 | CFA_advance_loc4 = DW_CFA_advance_loc4, | |
60 | CFA_offset_extended = DW_CFA_offset_extended, | |
61 | CFA_resotre_extended = DW_CFA_restore_extended, | |
62 | CFA_undefined = DW_CFA_undefined, | |
63 | CFA_same_value = DW_CFA_same_value, | |
64 | CFA_register = DW_CFA_register, | |
65 | CFA_remember_state = DW_CFA_remember_state, | |
66 | CFA_restore_state = DW_CFA_restore_state, | |
67 | CFA_def_cfa = DW_CFA_def_cfa, | |
68 | CFA_def_cfa_register = DW_CFA_def_cfa_register, | |
69 | CFA_def_cfa_offset = DW_CFA_def_cfa_offset, | |
70 | CFA_advance_loc = DW_CFA_advance_loc, | |
71 | CFA_offset = DW_CFA_offset, | |
72 | CFA_restore = DW_CFA_restore, | |
73 | ||
74 | /* These don't belong to the standard. */ | |
75 | CFI_startproc = 0xff00, | |
76 | CFI_endproc = 0xff01, | |
77 | CFI_adjust_cfa_offset = 0xff10, | |
78 | CFI_verbose = 0xffff | |
79 | }; | |
80 | ||
81 | extern const pseudo_typeS cfi_pseudo_table[]; | |
82 | ||
83 | /* Insert .cfi_* directives to the list of pseudo-ops. */ | |
84 | void cfi_pop_insert PARAMS ((void)); | |
85 | ||
86 | /* Set/change setup of the CFI machinery. This change won't | |
87 | affect already generated CIEs/FDEs. */ | |
88 | void cfi_set_config PARAMS ((struct cfi_config *cfg)); | |
89 | ||
90 | /* cfi_finish() is called at the end of file. It will complain if | |
91 | the last CFI wasn't properly closed by .cfi_endproc. */ | |
92 | void cfi_finish PARAMS ((void)); | |
93 | ||
94 | /* Add CFI instruction to the list of instructions | |
95 | of the current frame. cfi_add_insn() could be used | |
96 | in tc_cfi_frame_initial_instructions() to add instructions | |
97 | needed for every frame (ie. those that usually go to CIE). */ | |
98 | void cfi_add_insn (enum cfi_insn insn, long param0, long param1); | |
99 | ||
100 | #endif /* DW2GENCFI_H */ |