glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h

360 lines
11 KiB
C
Raw Normal View History

/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
The GNU C Library is free software; you can redistribute it and/or
2001-07-06 04:56:23 +00:00
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2001-07-06 04:56:23 +00:00
Lesser General Public License for more details.
2001-07-06 04:56:23 +00:00
You should have received a copy of the GNU Lesser General Public
2012-03-09 23:56:38 +00:00
License along with the GNU C Library. If not, see
Prefer https to http for gnu.org and fsf.org URLs Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
<https://www.gnu.org/licenses/>. */
#ifndef _LINUX_ALPHA_SYSDEP_H
#define _LINUX_ALPHA_SYSDEP_H 1
/* There is some commonality. */
Add INLINE_SYSCALL_ERROR_RETURN_VALUE For ia32 PIC, the first thing of many syscalls does is to call __x86.get_pc_thunk.reg to load PC into reg in case there is an error, which is required for setting errno. In most cases, there are no errors. But we still call __x86.get_pc_thunk.reg. This patch adds INLINE_SYSCALL_ERROR_RETURN_VALUE so that i386 can optimize setting errno by branching to the internal __syscall_error without PLT. With i386 INLINE_SYSCALL_ERROR_RETURN_VALUE and i386 syscall inlining optimization for GCC 5, for sysdeps/unix/sysv/linux/fchmodat.c with -O2 -march=i686 -mtune=generic, GCC 5.2 now generates: <fchmodat>: 0: push %ebx 1: mov 0x14(%esp),%eax 5: mov 0x8(%esp),%ebx 9: mov 0xc(%esp),%ecx d: mov 0x10(%esp),%edx 11: test $0xfffffeff,%eax 16: jne 38 <fchmodat+0x38> 18: test $0x1,%ah 1b: jne 48 <fchmodat+0x48> 1d: mov $0x132,%eax 22: call *%gs:0x10 29: cmp $0xfffff000,%eax 2e: ja 58 <fchmodat+0x58> 30: pop %ebx 31: ret 32: lea 0x0(%esi),%esi 38: pop %ebx 39: mov $0xffffffea,%eax 3e: jmp 3f <fchmodat+0x3f> 3f: R_386_PC32 __syscall_error 43: nop 44: lea 0x0(%esi,%eiz,1),%esi 48: pop %ebx 49: mov $0xffffffa1,%eax 4e: jmp 4f <fchmodat+0x4f> 4f: R_386_PC32 __syscall_error 53: nop 54: lea 0x0(%esi,%eiz,1),%esi 58: pop %ebx 59: jmp 5a <fchmodat+0x5a> 5a: R_386_PC32 __syscall_error instead of <fchmodat>: 0: sub $0x8,%esp 3: mov 0x18(%esp),%eax 7: mov %ebx,(%esp) a: call b <fchmodat+0xb> b: R_386_PC32 __x86.get_pc_thunk.bx f: add $0x2,%ebx 11: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 15: mov %edi,0x4(%esp) 19: test $0xfffffeff,%eax 1e: jne 70 <fchmodat+0x70> 20: test $0x1,%ah 23: jne 88 <fchmodat+0x88> 25: mov 0x14(%esp),%edx 29: mov 0x10(%esp),%ecx 2d: mov 0xc(%esp),%edi 31: xchg %ebx,%edi 33: mov $0x132,%eax 38: call *%gs:0x10 3f: xchg %edi,%ebx 41: cmp $0xfffff000,%eax 46: ja 58 <fchmodat+0x58> 48: mov (%esp),%ebx 4b: mov 0x4(%esp),%edi 4f: add $0x8,%esp 52: ret 53: nop 54: lea 0x0(%esi,%eiz,1),%esi 58: mov 0x0(%ebx),%edx 5a: R_386_TLS_GOTIE __libc_errno 5e: neg %eax 60: mov %eax,%gs:(%edx) 63: mov $0xffffffff,%eax 68: jmp 48 <fchmodat+0x48> 6a: lea 0x0(%esi),%esi 70: mov 0x0(%ebx),%eax 72: R_386_TLS_GOTIE __libc_errno 76: movl $0x16,%gs:(%eax) 7d: mov $0xffffffff,%eax 82: jmp 48 <fchmodat+0x48> 84: lea 0x0(%esi,%eiz,1),%esi 88: mov 0x0(%ebx),%eax 8a: R_386_TLS_GOTIE __libc_errno 8e: movl $0x5f,%gs:(%eax) 95: mov $0xffffffff,%eax 9a: jmp 48 <fchmodat+0x48> * sysdeps/unix/sysv/linux/sysdep.h: New file. * sysdeps/unix/sysv/linux/i386/sysdep.c: Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep.h: Include <sysdeps/unix/sysv/linux/sysdep.h>. * sysdeps/unix/sysv/linux/arm/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/generic/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) == csu] (sysdep-dl-routines): Add sysdep. [$(subdir) == nptl] (libpthread-routines): Likewise. [$(subdir) == rt] (librt-routines): Likewise. * sysdeps/unix/sysv/linux/i386/clone.S (__clone): Don't check PIC when branching to SYSCALL_ERROR_LABEL. * sysdeps/unix/sysv/linux/i386/sysdep.S: Removed. * sysdeps/unix/sysv/linux/i386/sysdep.h: Include <sysdeps/unix/sysv/linux/sysdep.h>. (SYSCALL_ERROR_LABEL): Changed to __syscall_error. (SYSCALL_ERROR_ERRNO): Removed. (SYSCALL_ERROR_HANDLER): Changed to empty. (SYSCALL_ERROR_HANDLER_TLS_STORE): Likewise. (__syscall_error): New prototype. [IS_IN (libc)] (INLINE_SYSCALL): New macro. (INLINE_SYSCALL_ERROR_RETURN_VALUE): Likewise.
2015-10-13 18:58:53 +00:00
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/sysdep.h>
#include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
#include <tls.h>
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
2012-04-27 02:07:53 +00:00
#define SYS_ify(syscall_name) __NR_##syscall_name
Linux: Consolidate {RTLD_}SINGLE_THREAD_P definition Current GLIBC has two ways to implement the single thread optimization on syscalls to avoid calling the cancellation path: either by using global variables (__{libc,pthread}_multiple_thread) or by accessing the TCB field (defined by TLS_MULTIPLE_THREADS_IN_TCB). Both the variables and the macros to acces its value are defined in the architecture sysdep-cancel.h header. This patch consolidates its definition on only one header, sysdeps/unix/sysv/linux/sysdep-cancel.h, and adds a new define (SINGLE_THREAD_BY_GLOBAL) which the architecture defines if it prefer to use the global variables instead of the TCB field. This is an optimization, so if the architecture does not define it, the TCB method will be used as default. Checked on x86_64-linux-gnu and on a build with major touched ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf, hppa-linux-gnu, i686-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips-linux-gnu, mips64-linux-gnu, powerpc-linux-gnu, powerpc64le-linux-gnu, s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparcv9-linux-gnu, sparc64-linux-gnu, tilegx-linux-gnu). * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h: Remove file. * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/mips/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/tile/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Define. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise.
2017-08-03 22:27:27 +00:00
#define SINGLE_THREAD_BY_GLOBAL 1
#ifdef __ASSEMBLER__
#include <asm/pal.h>
#include <alpha/regdef.h>
#define __LABEL(x) x##:
#define LEAF(name, framesize) \
.globl name; \
.align 4; \
.ent name, 0; \
__LABEL(name) \
.frame sp, framesize, ra
#define ENTRY(name) \
.globl name; \
.align 4; \
.ent name, 0; \
__LABEL(name) \
.frame sp, 0, ra
/* Mark the end of function SYM. */
#undef END
#define END(sym) .end sym
#ifdef PROF
# define PSEUDO_PROF \
.set noat; \
lda AT, _mcount; \
jsr AT, (AT), _mcount; \
.set at
#else
# define PSEUDO_PROF
#endif
#ifdef PROF
# define PSEUDO_PROLOGUE \
.frame sp, 0, ra; \
ldgp gp,0(pv); \
PSEUDO_PROF; \
.prologue 1
#elif defined PIC
# define PSEUDO_PROLOGUE \
.frame sp, 0, ra; \
.prologue 0
#else
# define PSEUDO_PROLOGUE \
.frame sp, 0, ra; \
ldgp gp,0(pv); \
.prologue 1
#endif /* PROF */
#ifdef PROF
# define USEPV_PROF std
#else
# define USEPV_PROF no
#endif
#undef SYSCALL_ERROR_LABEL
#if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_LABEL $syscall_error
# define SYSCALL_ERROR_HANDLER \
$syscall_error: \
stl v0, rtld_errno(gp) !gprel; \
lda v0, -1; \
ret
# define SYSCALL_ERROR_FALLTHRU
#elif defined(PIC)
# define SYSCALL_ERROR_LABEL __syscall_error !samegp
# define SYSCALL_ERROR_HANDLER
# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL
#else
# define SYSCALL_ERROR_LABEL $syscall_error
# define SYSCALL_ERROR_HANDLER \
$syscall_error: \
jmp $31, __syscall_error
# define SYSCALL_ERROR_FALLTHRU
#endif /* RTLD_PRIVATE_ERRNO */
/* Overridden by specific syscalls. */
#undef PSEUDO_PREPARE_ARGS
#define PSEUDO_PREPARE_ARGS /* Nothing. */
#define PSEUDO(name, syscall_name, args) \
.globl name; \
.align 4; \
.ent name,0; \
__LABEL(name) \
PSEUDO_PROLOGUE; \
PSEUDO_PREPARE_ARGS \
lda v0, SYS_ify(syscall_name); \
call_pal PAL_callsys; \
bne a3, SYSCALL_ERROR_LABEL
#undef PSEUDO_END
#define PSEUDO_END(sym) \
SYSCALL_ERROR_HANDLER; \
END(sym)
#define PSEUDO_NOERRNO(name, syscall_name, args) \
.globl name; \
.align 4; \
.ent name,0; \
__LABEL(name) \
PSEUDO_PROLOGUE; \
PSEUDO_PREPARE_ARGS \
lda v0, SYS_ify(syscall_name); \
call_pal PAL_callsys;
#undef PSEUDO_END_NOERRNO
#define PSEUDO_END_NOERRNO(sym) END(sym)
#define ret_NOERRNO ret
#define PSEUDO_ERRVAL(name, syscall_name, args) \
.globl name; \
.align 4; \
.ent name,0; \
__LABEL(name) \
PSEUDO_PROLOGUE; \
PSEUDO_PREPARE_ARGS \
lda v0, SYS_ify(syscall_name); \
call_pal PAL_callsys;
#undef PSEUDO_END_ERRVAL
#define PSEUDO_END_ERRVAL(sym) END(sym)
#define ret_ERRVAL ret
#define r0 v0
#define r1 a4
#define MOVE(x,y) mov x,y
#else /* !ASSEMBLER */
#define INTERNAL_SYSCALL(name, nr, args...) \
internal_syscall##nr(__NR_##name, args)
#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
internal_syscall##nr(name, args)
/* The normal Alpha calling convention sign-extends 32-bit quantties
no matter what the "real" sign of the 32-bit type. We want to
preserve that when filling in values for the kernel. */
#define syscall_promote(arg) \
(sizeof (arg) == 4 ? (long int)(int)(long int)(arg) : (long int)(arg))
#define internal_syscall_clobbers \
"$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
"$22", "$23", "$24", "$25", "$27", "$28", "memory"
/* It is moderately important optimization-wise to limit the lifetime
of the hard-register variables as much as possible. Thus we copy
in/out as close to the asm as possible. */
#define internal_syscall0(name, args...) \
({ \
register long int _sc_19 __asm__("$19"); \
register long int _sc_0 = name; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2" \
: "+v"(_sc_0), "=r"(_sc_19) \
: : internal_syscall_clobbers, \
"$16", "$17", "$18", "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall1(name,arg1) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_19 __asm__("$19"); \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3" \
: "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \
: : internal_syscall_clobbers, \
"$17", "$18", "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall2(name,arg1,arg2) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_19 __asm__("$19"); \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4" \
: "+v"(_sc_0), "=r"(_sc_19), \
"+r"(_sc_16), "+r"(_sc_17) \
: : internal_syscall_clobbers, \
"$18", "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall3(name,arg1,arg2,arg3) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _tmp_18 = syscall_promote (arg3); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_18 __asm__("$18") = _tmp_18; \
register long int _sc_19 __asm__("$19"); \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5" \
: "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \
"+r"(_sc_17), "+r"(_sc_18) \
: : internal_syscall_clobbers, "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall4(name,arg1,arg2,arg3,arg4) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _tmp_18 = syscall_promote (arg3); \
register long int _tmp_19 = syscall_promote (arg4); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_18 __asm__("$18") = _tmp_18; \
register long int _sc_19 __asm__("$19") = _tmp_19; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6" \
: "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
"+r"(_sc_17), "+r"(_sc_18) \
: : internal_syscall_clobbers, "$20", "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _tmp_18 = syscall_promote (arg3); \
register long int _tmp_19 = syscall_promote (arg4); \
register long int _tmp_20 = syscall_promote (arg5); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_18 __asm__("$18") = _tmp_18; \
register long int _sc_19 __asm__("$19") = _tmp_19; \
register long int _sc_20 __asm__("$20") = _tmp_20; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \
: "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
"+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \
: : internal_syscall_clobbers, "$21"); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#define internal_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
({ \
register long int _tmp_16 = syscall_promote (arg1); \
register long int _tmp_17 = syscall_promote (arg2); \
register long int _tmp_18 = syscall_promote (arg3); \
register long int _tmp_19 = syscall_promote (arg4); \
register long int _tmp_20 = syscall_promote (arg5); \
register long int _tmp_21 = syscall_promote (arg6); \
register long int _sc_0 = name; \
register long int _sc_16 __asm__("$16") = _tmp_16; \
register long int _sc_17 __asm__("$17") = _tmp_17; \
register long int _sc_18 __asm__("$18") = _tmp_18; \
register long int _sc_19 __asm__("$19") = _tmp_19; \
register long int _sc_20 __asm__("$20") = _tmp_20; \
register long int _sc_21 __asm__("$21") = _tmp_21; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \
: "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
"+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \
"+r"(_sc_21) \
: : internal_syscall_clobbers); \
_sc_19 != 0 ? -_sc_0 : _sc_0; \
})
#endif /* ASSEMBLER */
/* Pointer mangling support. Note that tls access is slow enough that
we don't deoptimize things by placing the pointer check value there. */
#ifdef __ASSEMBLER__
# if IS_IN (rtld)
# define PTR_MANGLE(dst, src, tmp) \
ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
xor src, tmp, dst
# define PTR_MANGLE2(dst, src, tmp) \
xor src, tmp, dst
# elif defined SHARED
# define PTR_MANGLE(dst, src, tmp) \
ldq tmp, __pointer_chk_guard; \
xor src, tmp, dst
# else
# define PTR_MANGLE(dst, src, tmp) \
ldq tmp, __pointer_chk_guard_local; \
xor src, tmp, dst
# endif
# define PTR_MANGLE2(dst, src, tmp) \
xor src, tmp, dst
# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
#else
# include <stdint.h>
# if (IS_IN (rtld) \
|| (!defined SHARED && (IS_IN (libc) \
|| IS_IN (libpthread))))
extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
# define PTR_MANGLE(var) \
(var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
# else
extern uintptr_t __pointer_chk_guard attribute_relro;
# define PTR_MANGLE(var) \
(var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard)
# endif
# define PTR_DEMANGLE(var) PTR_MANGLE(var)
#endif /* ASSEMBLER */
#endif /* _LINUX_ALPHA_SYSDEP_H */