fix TLS memory leak with dlopen
[uclibc-ng.git] / libc / sysdeps / linux / or1k / sysdep.h
blob782981c553c14485f002f1acc8a8356b0a3781bb
1 /* Copyright (C) 2011-2014 Free Software Foundation, Inc.
3 The GNU C Library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Lesser General Public License as
5 published by the Free Software Foundation; either version 2.1 of the
6 License, or (at your option) any later version.
8 The GNU C Library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Lesser General Public License for more details.
13 You should have received a copy of the GNU Lesser General Public
14 License along with the GNU C Library; if not, see
15 <http://www.gnu.org/licenses/>. */
17 #ifndef _LINUX_OR1K_SYSDEP_H
18 #define _LINUX_OR1K_SYSDEP_H 1
20 #include <common/sysdep.h>
21 #include <sys/syscall.h>
23 /* In order to get __set_errno() definition in INLINE_SYSCALL. */
24 #ifndef __ASSEMBLER__
25 #include <errno.h>
26 #endif
28 #undef SYS_ify
29 #define SYS_ify(syscall_name) (__NR_##syscall_name)
31 #ifdef __ASSEMBLER__
33 /* Local label name for asm code. */
34 #define L(name) .L##name
36 #undef ret_ERRVAL
37 #define ret_ERRVAL l.jr r9; l.nop
38 #define ret_NOERRNO l.jr r9; l.nop
40 #undef DO_CALL
41 #define DO_CALL(syscall_name) \
42 l.addi r11, r0, SYS_ify (syscall_name); \
43 l.sys 1; \
44 l.nop
46 /* Make use of .size directive. */
47 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
49 /* Define an entry point visible from C. */
50 #define ENTRY(name) \
51 .globl C_SYMBOL_NAME(name); \
52 .type C_SYMBOL_NAME(name),@function; \
53 .align 4; \
54 C_LABEL(name) \
55 cfi_startproc; \
57 #undef END
58 #define END(name) \
59 cfi_endproc; \
60 ASM_SIZE_DIRECTIVE(name)
62 /* Since C identifiers are not normally prefixed with an underscore
63 on this system, the asm identifier `syscall_error' intrudes on the
64 C name space. Make sure we use an innocuous name. */
65 #define syscall_error __syscall_error
67 /* Specify the size in bytes of a machine register. */
68 #define REGSIZE 4
70 #endif /* __ASSEMBLER__ */
72 #endif /* linux/or1k/sysdep.h */