1 /* PowerPC asm definitions for GNU C.
3 Copyright (C) 2002-2013 Free Software Foundation, Inc.
5 This file is part of GCC.
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
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
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.
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/>. */
26 /* Under winnt, 1) gas supports the following as names and 2) in particular
27 defining "toc" breaks the FUNC_START macro as ".toc" becomes ".2" */
242 * Macros to glue together two tokens.
246 #define XGLUE(a,b) a##b
248 #define XGLUE(a,b) a/**/b
251 #define GLUE(a,b) XGLUE(a,b)
254 * Macros to begin and end a function written in assembler. If -mcall-aixdesc
255 * or -mcall-nt, create a function descriptor with the given name, and create
256 * the real function with one or two leading periods respectively.
259 #if defined(__powerpc64__) && _CALL_ELF == 2
261 /* Defining "toc" above breaks @toc in assembler code. */
264 #define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name)
265 #define JUMP_TARGET(name) FUNC_NAME(name)
266 #define FUNC_START(name) \
267 .type FUNC_NAME(name),@function; \
268 .globl FUNC_NAME(name); \
270 0: addis 2,12,(.TOC.-0b)@ha; \
271 addi 2,2,(.TOC.-0b)@l; \
272 .localentry FUNC_NAME(name),.-FUNC_NAME(name)
274 #define HIDDEN_FUNC(name) \
276 .hidden FUNC_NAME(name);
278 #define FUNC_END(name) \
279 .size FUNC_NAME(name),.-FUNC_NAME(name)
281 #elif defined (__powerpc64__)
283 #define FUNC_NAME(name) GLUE(.,name)
284 #define JUMP_TARGET(name) FUNC_NAME(name)
285 #define FUNC_START(name) \
286 .section ".opd","aw"; \
288 .quad GLUE(.,name); \
289 .quad .TOC.@tocbase; \
292 .type GLUE(.,name),@function; \
294 .globl GLUE(.,name); \
297 #define HIDDEN_FUNC(name) \
300 .hidden GLUE(.,name);
302 #define FUNC_END(name) \
304 .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name)
306 #elif defined(_CALL_AIXDESC)
309 #define DESC_SECTION ".got2"
311 #define DESC_SECTION ".got1"
314 #define FUNC_NAME(name) GLUE(.,name)
315 #define JUMP_TARGET(name) FUNC_NAME(name)
316 #define FUNC_START(name) \
317 .section DESC_SECTION,"aw"; \
319 .long GLUE(.,name); \
320 .long _GLOBAL_OFFSET_TABLE_; \
323 .type GLUE(.,name),@function; \
325 .globl GLUE(.,name); \
328 #define HIDDEN_FUNC(name) \
331 .hidden GLUE(.,name);
333 #define FUNC_END(name) \
335 .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name)
339 #define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name)
340 #if defined __PIC__ || defined __pic__
341 #define JUMP_TARGET(name) FUNC_NAME(name@plt)
343 #define JUMP_TARGET(name) FUNC_NAME(name)
345 #define FUNC_START(name) \
346 .type FUNC_NAME(name),@function; \
347 .globl FUNC_NAME(name); \
350 #define HIDDEN_FUNC(name) \
352 .hidden FUNC_NAME(name);
354 #define FUNC_END(name) \
356 .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name)
360 /* For HAVE_GAS_CFI_DIRECTIVE. */
361 #include "auto-host.h"
363 #ifdef HAVE_GAS_CFI_DIRECTIVE
364 # define CFI_STARTPROC .cfi_startproc
365 # define CFI_ENDPROC .cfi_endproc
366 # define CFI_OFFSET(reg, off) .cfi_offset reg, off
367 # define CFI_DEF_CFA_REGISTER(reg) .cfi_def_cfa_register reg
368 # define CFI_RESTORE(reg) .cfi_restore reg
370 # define CFI_STARTPROC
372 # define CFI_OFFSET(reg, off)
373 # define CFI_DEF_CFA_REGISTER(reg)
374 # define CFI_RESTORE(reg)
378 #if defined __linux__ && !defined __powerpc64__
379 .section
.note
.GNU
-stack