1 /* Copyright (C) 1997-2016 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 License as
7 published by the Free Software Foundation; either version 2.1 of the
8 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, see
17 <http://www.gnu.org/licenses/>. */
19 #include <sysdeps/generic/sysdep.h>
23 /* Syntactic details of assembler. */
25 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
27 /* Define an entry point visible from C. */
29 .globl C_SYMBOL_NAME(name); \
30 .type C_SYMBOL_NAME(name),%function; \
36 /* Define an entry point visible from C. */
37 #define ENTRY_ALIGN(name, align) \
38 .globl C_SYMBOL_NAME(name); \
39 .type C_SYMBOL_NAME(name),%function; \
45 /* Define an entry point visible from C with a specified alignment and
46 pre-padding with NOPs. This can be used to ensure that a critical
47 loop within a function is cache line aligned. Note this version
48 does not adjust the padding if CALL_MCOUNT is defined. */
50 #define ENTRY_ALIGN_AND_PAD(name, align, padding) \
51 .globl C_SYMBOL_NAME(name); \
52 .type C_SYMBOL_NAME(name),%function; \
64 ASM_SIZE_DIRECTIVE(name)
66 /* If compiled for profiling, call `mcount' at the start of each function. */
68 # define CALL_MCOUNT \
69 str x30, [sp, #-80]!; \
70 cfi_adjust_cfa_offset (80); \
71 cfi_rel_offset (x30, 0); \
72 stp x0, x1, [sp, #16]; \
73 cfi_rel_offset (x0, 16); \
74 cfi_rel_offset (x1, 24); \
75 stp x2, x3, [sp, #32]; \
76 cfi_rel_offset (x2, 32); \
77 cfi_rel_offset (x3, 40); \
78 stp x4, x5, [sp, #48]; \
79 cfi_rel_offset (x4, 48); \
80 cfi_rel_offset (x5, 56); \
81 stp x6, x7, [sp, #64]; \
82 cfi_rel_offset (x6, 64); \
83 cfi_rel_offset (x7, 72); \
86 ldp x0, x1, [sp, #16]; \
89 ldp x2, x3, [sp, #32]; \
92 ldp x4, x5, [sp, #48]; \
95 ldp x6, x7, [sp, #64]; \
99 cfi_adjust_cfa_offset (-80); \
102 # define CALL_MCOUNT /* Do nothing. */
105 /* Local label name for asm code. */
107 # define L(name) .L##name
110 /* Load or store to/from a pc-relative EXPR into/from R, using T. */
111 #define LDST_PCREL(OP, R, T, EXPR) \
113 OP R, [T, #:lo12:EXPR];\
115 /* Load or store to/from a got-relative EXPR into/from R, using T. */
116 #define LDST_GLOBAL(OP, R, T, EXPR) \
118 ldr T, [T, #:got_lo12:EXPR];\
121 /* Since C identifiers are not normally prefixed with an underscore
122 on this system, the asm identifier `syscall_error' intrudes on the
123 C name space. Make sure we use an innocuous name. */
124 #define syscall_error __syscall_error
125 #define mcount _mcount
127 #endif /* __ASSEMBLER__ */