Use --disable-default-pie for sparc in build-many-glibcs.py
[glibc.git] / sysdeps / or1k / sysdep.h
blob5015d36706a6b143e04488684fddb33d5457e879
1 /* Assembler macro definitions. OpenRISC version.
2 Copyright (C) 2022-2024 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, see
17 <https://www.gnu.org/licenses/>. */
19 #include <sysdeps/generic/sysdep.h>
20 #include <features.h>
22 #if defined __ASSEMBLER__ || defined REQUEST_ASSEMBLER_MACROS
24 /* Make use of .size directive. */
25 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
27 /* Define an entry point visible from C. */
28 #define ENTRY(name) \
29 .globl C_SYMBOL_NAME(name); \
30 .type C_SYMBOL_NAME(name),@function; \
31 .align 4; \
32 C_LABEL(name) \
33 cfi_startproc; \
34 CALL_MCOUNT
36 #undef END
37 #define END(name) \
38 cfi_endproc; \
39 ASM_SIZE_DIRECTIVE(name)
41 /* Since C identifiers are not normally prefixed with an underscore
42 on this system, the asm identifier `syscall_error' intrudes on the
43 C name space. Make sure we use an innocuous name. */
44 #define syscall_error __syscall_error
46 /* If compiled for profiling, call `mcount' at the start of each function. */
47 #ifdef PROF
48 # ifdef __PIC__
49 # define CALL_MCOUNT \
50 l.addi r1, r1, -8; \
51 l.sw 0(r1), r9; \
52 l.sw 4(r1), r3; \
53 l.ori r3, r9, 0; \
54 l.j plt(_mcount); \
55 l.nop; \
56 l.lwz r9, 0(r1); \
57 l.lwz r3, 4(r1); \
58 l.addi r1, r1, 8;
59 # else
60 # define CALL_MCOUNT \
61 l.addi r1, r1, -8; \
62 l.sw 0(r1), r9; \
63 l.sw 4(r1), r3; \
64 l.ori r3, r9, 0; \
65 l.movhi r15, hi(_mcount); \
66 l.ori r15, r15, lo(_mcount); \
67 l.jr r15; \
68 l.nop; \
69 l.lwz r9, 0(r1); \
70 l.lwz r3, 4(r1); \
71 l.addi r1, r1, 8;
72 # endif
73 #else
74 # define CALL_MCOUNT /* Do nothing. */
75 #endif
77 /* Local label name for asm code. */
78 #define L(name) .L##name
80 #endif /* __ASSEMBLER__ */