float128: Add strtof128, wcstof128, and related functions.
[glibc.git] / sysdeps / sparc / sysdep.h
blob245e5cc57f4991a9ba2e6d33c1f590c53e4f35f0
1 /* Copyright (C) 2011-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #define _SYSDEPS_SYSDEP_H 1
19 #include <bits/hwcap.h>
21 #ifdef __ASSEMBLER__
23 #define SPARC_PIC_THUNK(reg) \
24 .ifndef __sparc_get_pc_thunk.reg; \
25 .section .text.__sparc_get_pc_thunk.reg,"axG",@progbits,__sparc_get_pc_thunk.reg,comdat; \
26 .align 32; \
27 .weak __sparc_get_pc_thunk.reg; \
28 .hidden __sparc_get_pc_thunk.reg; \
29 .type __sparc_get_pc_thunk.reg, #function; \
30 __sparc_get_pc_thunk.reg: \
31 jmp %o7 + 8; \
32 add %o7, %reg, %##reg; \
33 .previous; \
34 .endif;
36 /* The "-4" and "+4" offsets against _GLOBAL_OFFSET_TABLE_ are
37 critical since they represent the offset from the thunk call to the
38 instruction containing the _GLOBAL_OFFSET_TABLE_ reference.
39 Therefore these instructions cannot be moved around without
40 appropriate adjustments to those offsets.
42 Furthermore, these expressions are special in another regard. When
43 the assembler sees a reference to _GLOBAL_OFFSET_TABLE_ inside of
44 a %hi() or %lo(), it emits a PC-relative relocation. This causes
45 R_SPARC_HI22 to turn into R_SPARC_PC22, and R_SPARC_LO10 to turn into
46 R_SPARC_PC10, respectively.
48 Even when v9 we use a call sequence instead of using "rd %pc" because
49 RDPC is extremely expensive and incurs a full pipeline flush. */
51 #define SPARC_PIC_THUNK_CALL(reg) \
52 sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %##reg; \
53 call __sparc_get_pc_thunk.reg; \
54 or %##reg, %lo(_GLOBAL_OFFSET_TABLE_+4), %##reg;
56 #define SETUP_PIC_REG(reg) \
57 SPARC_PIC_THUNK(reg) \
58 SPARC_PIC_THUNK_CALL(reg)
60 #define SETUP_PIC_REG_LEAF(reg, tmp) \
61 SPARC_PIC_THUNK(reg) \
62 mov %o7, %##tmp; \
63 SPARC_PIC_THUNK_CALL(reg); \
64 mov %##tmp, %o7;
66 #undef ENTRY
67 #define ENTRY(name) \
68 .align 4; \
69 .global C_SYMBOL_NAME(name); \
70 .type name, @function; \
71 C_LABEL(name) \
72 cfi_startproc;
74 #undef END
75 #define END(name) \
76 cfi_endproc; \
77 .size name, . - name
79 #undef LOC
80 #define LOC(name) .L##name
82 #endif /* __ASSEMBLER__ */