1 /* syscall error handlers
2 Copyright (C) 2011-2023 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/>. */
22 # define errno __libc_errno
25 ENTRY (__syscall_error)
27 /* Fall through to __syscall_set_errno. */
30 /* Non-standard calling convention: argument in a0, return address in t0,
31 and clobber only t1. */
32 ENTRY (__syscall_set_errno)
33 /* We got here because a0 < 0, but only codes in the range [-4095, -1]
34 represent errors. Otherwise, just return the result normally. */
38 #if RTLD_PRIVATE_ERRNO
40 #elif defined(__PIC__)
45 lui t1, %tprel_hi(errno)
46 add t1, t1, tp, %tprel_add(errno)
47 sw a0, %tprel_lo(errno)(t1)
51 END (__syscall_set_errno)