]>
Commit | Line | Data |
---|---|---|
7dfbd804 | 1 | /* PowerPC asm definitions for GNU C. |
2 | ||
3 | Copyright (C) 2002, 2003, 2008 Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of GCC. | |
6 | ||
7 | GCC is free software; you can redistribute it and/or modify it under | |
8 | the terms of the GNU General Public License as published by the Free | |
9 | Software Foundation; either version 3, or (at your option) any later | |
10 | version. | |
11 | ||
12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
16 | ||
17 | Under Section 7 of GPL version 3, you are granted additional | |
18 | permissions described in the GCC Runtime Library Exception, version | |
19 | 3.1, as published by the Free Software Foundation. | |
20 | ||
21 | You should have received a copy of the GNU General Public License and | |
22 | a copy of the GCC Runtime Library Exception along with this program; | |
23 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
24 | <http://www.gnu.org/licenses/>. */ | |
25 | ||
ed52ae90 | 26 | /* Under winnt, 1) gas supports the following as names and 2) in particular |
abe3ba01 | 27 | defining "toc" breaks the FUNC_START macro as ".toc" becomes ".2" */ |
28 | ||
7fd71d76 | 29 | #define r0 0 |
30 | #define sp 1 | |
31 | #define toc 2 | |
32 | #define r3 3 | |
33 | #define r4 4 | |
34 | #define r5 5 | |
35 | #define r6 6 | |
36 | #define r7 7 | |
37 | #define r8 8 | |
38 | #define r9 9 | |
39 | #define r10 10 | |
40 | #define r11 11 | |
41 | #define r12 12 | |
42 | #define r13 13 | |
43 | #define r14 14 | |
44 | #define r15 15 | |
45 | #define r16 16 | |
46 | #define r17 17 | |
47 | #define r18 18 | |
48 | #define r19 19 | |
49 | #define r20 20 | |
50 | #define r21 21 | |
51 | #define r22 22 | |
52 | #define r23 23 | |
53 | #define r24 24 | |
54 | #define r25 25 | |
55 | #define r26 26 | |
56 | #define r27 27 | |
57 | #define r28 28 | |
58 | #define r29 29 | |
59 | #define r30 30 | |
60 | #define r31 31 | |
f9fff8e4 | 61 | |
62 | #define cr0 0 | |
63 | #define cr1 1 | |
64 | #define cr2 2 | |
65 | #define cr3 3 | |
66 | #define cr4 4 | |
67 | #define cr5 5 | |
68 | #define cr6 6 | |
69 | #define cr7 7 | |
70 | ||
71 | #define f0 0 | |
72 | #define f1 1 | |
73 | #define f2 2 | |
74 | #define f3 3 | |
75 | #define f4 4 | |
76 | #define f5 5 | |
77 | #define f6 6 | |
78 | #define f7 7 | |
79 | #define f8 8 | |
80 | #define f9 9 | |
81 | #define f10 10 | |
82 | #define f11 11 | |
83 | #define f12 12 | |
84 | #define f13 13 | |
85 | #define f14 14 | |
86 | #define f15 15 | |
87 | #define f16 16 | |
88 | #define f17 17 | |
89 | #define f18 18 | |
90 | #define f19 19 | |
91 | #define f20 20 | |
92 | #define f21 21 | |
93 | #define f22 22 | |
94 | #define f23 23 | |
95 | #define f24 24 | |
96 | #define f25 25 | |
97 | #define f26 26 | |
98 | #define f27 27 | |
99 | #define f28 28 | |
100 | #define f29 29 | |
101 | #define f30 30 | |
102 | #define f31 31 | |
7fd71d76 | 103 | |
104 | /* | |
105 | * Macros to glue together two tokens. | |
106 | */ | |
107 | ||
108 | #ifdef __STDC__ | |
109 | #define XGLUE(a,b) a##b | |
110 | #else | |
111 | #define XGLUE(a,b) a/**/b | |
112 | #endif | |
113 | ||
114 | #define GLUE(a,b) XGLUE(a,b) | |
115 | ||
116 | /* | |
117 | * Macros to begin and end a function written in assembler. If -mcall-aixdesc | |
118 | * or -mcall-nt, create a function descriptor with the given name, and create | |
119 | * the real function with one or two leading periods respectively. | |
120 | */ | |
121 | ||
527d5be8 | 122 | #if defined (__powerpc64__) |
7fd71d76 | 123 | #define FUNC_NAME(name) GLUE(.,name) |
74b8f08f | 124 | #define JUMP_TARGET(name) FUNC_NAME(name) |
7fd71d76 | 125 | #define FUNC_START(name) \ |
527d5be8 | 126 | .section ".opd","aw"; \ |
7fd71d76 | 127 | name: \ |
527d5be8 | 128 | .quad GLUE(.,name); \ |
129 | .quad .TOC.@tocbase; \ | |
130 | .quad 0; \ | |
7fd71d76 | 131 | .previous; \ |
132 | .type GLUE(.,name),@function; \ | |
133 | .globl name; \ | |
134 | .globl GLUE(.,name); \ | |
135 | GLUE(.,name): | |
136 | ||
8cce56f2 | 137 | #define HIDDEN_FUNC(name) \ |
138 | FUNC_START(name) \ | |
139 | .hidden name; \ | |
140 | .hidden GLUE(.,name); | |
141 | ||
7fd71d76 | 142 | #define FUNC_END(name) \ |
143 | GLUE(.L,name): \ | |
144 | .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name) | |
145 | ||
527d5be8 | 146 | #elif defined(_CALL_AIXDESC) |
147 | ||
148 | #ifdef _RELOCATABLE | |
149 | #define DESC_SECTION ".got2" | |
150 | #else | |
151 | #define DESC_SECTION ".got1" | |
152 | #endif | |
153 | ||
2fc26104 | 154 | #define FUNC_NAME(name) GLUE(.,name) |
19d4f8a9 | 155 | #define JUMP_TARGET(name) FUNC_NAME(name) |
2fc26104 | 156 | #define FUNC_START(name) \ |
527d5be8 | 157 | .section DESC_SECTION,"aw"; \ |
2fc26104 | 158 | name: \ |
527d5be8 | 159 | .long GLUE(.,name); \ |
160 | .long _GLOBAL_OFFSET_TABLE_; \ | |
161 | .long 0; \ | |
2fc26104 | 162 | .previous; \ |
163 | .type GLUE(.,name),@function; \ | |
164 | .globl name; \ | |
165 | .globl GLUE(.,name); \ | |
166 | GLUE(.,name): | |
167 | ||
8cce56f2 | 168 | #define HIDDEN_FUNC(name) \ |
169 | FUNC_START(name) \ | |
170 | .hidden name; \ | |
171 | .hidden GLUE(.,name); | |
172 | ||
2fc26104 | 173 | #define FUNC_END(name) \ |
174 | GLUE(.L,name): \ | |
175 | .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name) | |
176 | ||
7fd71d76 | 177 | #else |
527d5be8 | 178 | |
a2de0599 | 179 | #define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name) |
74b8f08f | 180 | #if defined __PIC__ || defined __pic__ |
181 | #define JUMP_TARGET(name) FUNC_NAME(name@plt) | |
182 | #else | |
183 | #define JUMP_TARGET(name) FUNC_NAME(name) | |
184 | #endif | |
7fd71d76 | 185 | #define FUNC_START(name) \ |
a2de0599 | 186 | .type FUNC_NAME(name),@function; \ |
187 | .globl FUNC_NAME(name); \ | |
188 | FUNC_NAME(name): | |
7fd71d76 | 189 | |
8cce56f2 | 190 | #define HIDDEN_FUNC(name) \ |
191 | FUNC_START(name) \ | |
192 | .hidden FUNC_NAME(name); | |
193 | ||
7fd71d76 | 194 | #define FUNC_END(name) \ |
195 | GLUE(.L,name): \ | |
a2de0599 | 196 | .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name) |
7fd71d76 | 197 | #endif |
3fd62642 | 198 | |
199 | #if defined __linux__ && !defined __powerpc64__ | |
200 | .section .note.GNU-stack | |
201 | .previous | |
202 | #endif |