Merge remote branch 'origin/release/2.11/master' into fedora/2.11/master
[glibc.git] / sysdeps / generic / sysdep.h
blob54884d9afeb09cdd43720277ed3d0bae6182c41e
1 /* Generic asm macros used on many machines.
2 Copyright (C) 1991,92,93,96,98,2002,2003,2009 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef C_LABEL
22 /* Define a macro we can use to construct the asm name for a C symbol. */
23 #ifdef NO_UNDERSCORES
24 #ifdef __STDC__
25 #define C_LABEL(name) name##:
26 #else
27 #define C_LABEL(name) name/**/:
28 #endif
29 #else
30 #ifdef __STDC__
31 #define C_LABEL(name) _##name##:
32 #else
33 #define C_LABEL(name) _/**/name/**/:
34 #endif
35 #endif
37 #endif
39 #ifdef __ASSEMBLER__
40 /* Mark the end of function named SYM. This is used on some platforms
41 to generate correct debugging information. */
42 # ifndef END
43 # define END(sym)
44 # endif
46 # ifndef JUMPTARGET
47 # define JUMPTARGET(sym) sym
48 # endif
50 /* Makros to generate eh_frame unwind information. */
51 # ifdef HAVE_ASM_CFI_DIRECTIVES
52 # define cfi_startproc .cfi_startproc
53 # define cfi_endproc .cfi_endproc
54 # define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off
55 # define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg
56 # define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off
57 # define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
58 # define cfi_offset(reg, off) .cfi_offset reg, off
59 # define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
60 # define cfi_register(r1, r2) .cfi_register r1, r2
61 # define cfi_return_column(reg) .cfi_return_column reg
62 # define cfi_restore(reg) .cfi_restore reg
63 # define cfi_same_value(reg) .cfi_same_value reg
64 # define cfi_undefined(reg) .cfi_undefined reg
65 # define cfi_remember_state .cfi_remember_state
66 # define cfi_restore_state .cfi_restore_state
67 # define cfi_window_save .cfi_window_save
68 # define cfi_personality(enc, exp) .cfi_personality enc, exp
69 # define cfi_lsda(enc, exp) .cfi_lsda enc, exp
70 # else
71 # define cfi_startproc
72 # define cfi_endproc
73 # define cfi_def_cfa(reg, off)
74 # define cfi_def_cfa_register(reg)
75 # define cfi_def_cfa_offset(off)
76 # define cfi_adjust_cfa_offset(off)
77 # define cfi_offset(reg, off)
78 # define cfi_rel_offset(reg, off)
79 # define cfi_register(r1, r2)
80 # define cfi_return_column(reg)
81 # define cfi_restore(reg)
82 # define cfi_same_value(reg)
83 # define cfi_undefined(reg)
84 # define cfi_remember_state
85 # define cfi_restore_state
86 # define cfi_window_save
87 # define cfi_personality(enc, exp)
88 # define cfi_lsda(enc, exp)
89 # endif
91 #else /* ! ASSEMBLER */
92 # ifdef HAVE_ASM_CFI_DIRECTIVES
93 # define CFI_STRINGIFY(Name) CFI_STRINGIFY2 (Name)
94 # define CFI_STRINGIFY2(Name) #Name
95 # define CFI_STARTPROC ".cfi_startproc"
96 # define CFI_ENDPROC ".cfi_endproc"
97 # define CFI_DEF_CFA(reg, off) \
98 ".cfi_def_cfa " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
99 # define CFI_DEF_CFA_REGISTER(reg) \
100 ".cfi_def_cfa_register " CFI_STRINGIFY(reg)
101 # define CFI_DEF_CFA_OFFSET(off) \
102 ".cfi_def_cfa_offset " CFI_STRINGIFY(off)
103 # define CFI_ADJUST_CFA_OFFSET(off) \
104 ".cfi_adjust_cfa_offset " CFI_STRINGIFY(off)
105 # define CFI_OFFSET(reg, off) \
106 ".cfi_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
107 # define CFI_REL_OFFSET(reg, off) \
108 ".cfi_rel_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
109 # define CFI_REGISTER(r1, r2) \
110 ".cfi_register " CFI_STRINGIFY(r1) "," CFI_STRINGIFY(r2)
111 # define CFI_RETURN_COLUMN(reg) \
112 ".cfi_return_column " CFI_STRINGIFY(reg)
113 # define CFI_RESTORE(reg) \
114 ".cfi_restore " CFI_STRINGIFY(reg)
115 # define CFI_UNDEFINED(reg) \
116 ".cfi_undefined " CFI_STRINGIFY(reg)
117 # define CFI_REMEMBER_STATE \
118 ".cfi_remember_state"
119 # define CFI_RESTORE_STATE \
120 ".cfi_restore_state"
121 # define CFI_WINDOW_SAVE \
122 ".cfi_window_save"
123 # define CFI_PERSONALITY(enc, exp) \
124 ".cfi_personality " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp)
125 # define CFI_LSDA(enc, exp) \
126 ".cfi_lsda " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp)
127 # else
128 # define CFI_STARTPROC
129 # define CFI_ENDPROC
130 # define CFI_DEF_CFA(reg, off)
131 # define CFI_DEF_CFA_REGISTER(reg)
132 # define CFI_DEF_CFA_OFFSET(off)
133 # define CFI_ADJUST_CFA_OFFSET(off)
134 # define CFI_OFFSET(reg, off)
135 # define CFI_REL_OFFSET(reg, off)
136 # define CFI_REGISTER(r1, r2)
137 # define CFI_RETURN_COLUMN(reg)
138 # define CFI_RESTORE(reg)
139 # define CFI_UNDEFINED(reg)
140 # define CFI_REMEMBER_STATE
141 # define CFI_RESTORE_STATE
142 # define CFI_WINDOW_SAVE
143 # define CFI_PERSONALITY(enc, exp)
144 # define CFI_LSDA(enc, exp)
145 # endif
147 #endif /* __ASSEMBLER__ */
149 /* Values used for encoding parameter of cfi_personality and cfi_lsda. */
150 #define DW_EH_PE_absptr 0x00
151 #define DW_EH_PE_omit 0xff
152 #define DW_EH_PE_uleb128 0x01
153 #define DW_EH_PE_udata2 0x02
154 #define DW_EH_PE_udata4 0x03
155 #define DW_EH_PE_udata8 0x04
156 #define DW_EH_PE_sleb128 0x09
157 #define DW_EH_PE_sdata2 0x0a
158 #define DW_EH_PE_sdata4 0x0b
159 #define DW_EH_PE_sdata8 0x0c
160 #define DW_EH_PE_signed 0x08
161 #define DW_EH_PE_pcrel 0x10
162 #define DW_EH_PE_textrel 0x20
163 #define DW_EH_PE_datarel 0x30
164 #define DW_EH_PE_funcrel 0x40
165 #define DW_EH_PE_aligned 0x50
166 #define DW_EH_PE_indirect 0x80