summaryrefslogtreecommitdiff
path: root/libpthread
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2017-07-20 20:30:28 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2017-07-28 18:56:40 +0200
commitc876d8a2cd0e7e1ac585abfbe0067a26cd7ea932 (patch)
treeadc420c827ef33b0e88fa6c5666c3cd639d0e0e8 /libpthread
parentdcbff4072b6b3e79d768e50c2d58ccc8e307b1bd (diff)
nptl: remove asm from sysdep-cancel.h
Similar to a changeset planned in GNU C library remove any assembly code from sysdep-cancel.h. This allows to port to new architectures in a simpler way.
Diffstat (limited to 'libpthread')
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h87
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h131
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h96
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h212
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h121
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h111
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h120
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h156
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nds32/sysdep-cancel.h235
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h106
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/or1k/sysdep-cancel.h84
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h84
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h134
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h78
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h63
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/sysdep-cancel.h125
16 files changed, 52 insertions, 1891 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h
index 0942e819e..a6c98b6f8 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h
@@ -22,102 +22,23 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .section ".text"; \
-ENTRY (__##syscall_name##_nocancel); \
-.Lpseudo_nocancel: \
- DO_CALL (syscall_name, args); \
-.Lpseudo_finish: \
- cmn x0, 4095; \
- b.cs .Lsyscall_error; \
- .subsection 2; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
-ENTRY (name); \
- SINGLE_THREAD_P(16); \
- cbz w16, .Lpseudo_nocancel; \
- /* Setup common stack frame no matter the number of args. \
- Also save the first arg, since it's basically free. */ \
- stp x30, x0, [sp, -64]!; \
- cfi_adjust_cfa_offset (64); \
- cfi_rel_offset (x30, 0); \
- DOCARGS_##args; /* save syscall args around CENABLE. */ \
- CENABLE; \
- mov x16, x0; /* save mask around syscall. */ \
- UNDOCARGS_##args; /* restore syscall args. */ \
- DO_CALL (syscall_name, args); \
- str x0, [sp, 8]; /* save result around CDISABLE. */ \
- mov x0, x16; /* restore mask for CDISABLE. */ \
- CDISABLE; \
- /* Break down the stack frame, restoring result at once. */ \
- ldp x30, x0, [sp], 64; \
- cfi_adjust_cfa_offset (-64); \
- cfi_restore (x30); \
- b .Lpseudo_finish; \
- cfi_endproc; \
- .size name, .-name; \
- .previous
-
-# undef PSEUDO_END
-# define PSEUDO_END(name) \
- SYSCALL_ERROR_HANDLER; \
- cfi_endproc
-
-# define DOCARGS_0
-# define DOCARGS_1
-# define DOCARGS_2 str x1, [sp, 16]
-# define DOCARGS_3 stp x1, x2, [sp, 16]
-# define DOCARGS_4 DOCARGS_3; str x3, [sp, 32]
-# define DOCARGS_5 DOCARGS_3; stp x3, x4, [sp, 32]
-# define DOCARGS_6 DOCARGS_5; str x5, [sp, 48]
-
-# define UNDOCARGS_0
-# define UNDOCARGS_1 ldr x0, [sp, 8]
-# define UNDOCARGS_2 ldp x0, x1, [sp, 8]
-# define UNDOCARGS_3 UNDOCARGS_1; ldp x1, x2, [sp, 16]
-# define UNDOCARGS_4 UNDOCARGS_2; ldp x2, x3, [sp, 24]
-# define UNDOCARGS_5 UNDOCARGS_3; ldp x3, x4, [sp, 32]
-# define UNDOCARGS_6 UNDOCARGS_4; ldp x4, x5, [sp, 40]
-
# if defined IS_IN_libpthread
-# define CENABLE bl __pthread_enable_asynccancel
-# define CDISABLE bl __pthread_disable_asynccancel
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE bl __libc_enable_asynccancel
-# define CDISABLE bl __libc_disable_asynccancel
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE bl __librt_enable_asynccancel
-# define CDISABLE bl __librt_disable_asynccancel
-# else
-# error Unsupported library
# endif
# if defined IS_IN_libpthread || !defined NOT_IN_libc
-# ifndef __ASSEMBLER__
extern int __local_multiple_threads attribute_hidden;
-# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
-# else
-# define SINGLE_THREAD_P(R) \
- adrp x##R, __local_multiple_threads; \
- ldr w##R, [x##R, :lo12:__local_multiple_threads]
-# endif
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
# else
/* There is no __local_multiple_threads for librt, so use the TCB. */
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P(R) \
- mrs x##R, tpidr_el0; \
- sub x##R, x##R, PTHREAD_SIZEOF; \
- ldr w##R, [x##R, PTHREAD_MULTIPLE_THREADS_OFFSET]
-# endif
# endif
-#elif !defined __ASSEMBLER__
+#else
/* For rtld, et cetera. */
# define SINGLE_THREAD_P 1
@@ -125,8 +46,6 @@ extern int __local_multiple_threads attribute_hidden;
#endif
-#ifndef __ASSEMBLER__
# define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
index 51f1bd42a..4f60558bf 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
@@ -23,143 +23,20 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# ifdef PROF
-# define PSEUDO_PROF \
- .set noat; \
- lda AT, _mcount; \
- jsr AT, (AT), _mcount; \
- .set at
-# else
-# define PSEUDO_PROF
-# endif
-
-/* ??? Assumes that nothing comes between PSEUDO and PSEUDO_END
- besides "ret". */
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .globl name; \
- .align 4; \
- .type name, @function; \
- .usepv name, std; \
- cfi_startproc; \
-__LABEL(name) \
- ldgp gp, 0(pv); \
- PSEUDO_PROF; \
- PSEUDO_PREPARE_ARGS \
- SINGLE_THREAD_P(t0); \
- bne t0, $pseudo_cancel; \
- lda v0, SYS_ify(syscall_name); \
- call_pal PAL_callsys; \
- bne a3, SYSCALL_ERROR_LABEL; \
-__LABEL($pseudo_ret) \
- .subsection 2; \
- cfi_startproc; \
-__LABEL($pseudo_cancel) \
- subq sp, 64, sp; \
- cfi_def_cfa_offset(64); \
- stq ra, 0(sp); \
- cfi_offset(ra, -64); \
- SAVE_ARGS_##args; \
- CENABLE; \
- LOAD_ARGS_##args; \
- /* Save the CENABLE return value in RA. That register \
- is preserved across syscall and the real return \
- address is saved on the stack. */ \
- mov v0, ra; \
- lda v0, SYS_ify(syscall_name); \
- call_pal PAL_callsys; \
- stq v0, 8(sp); \
- mov ra, a0; \
- bne a3, $multi_error; \
- CDISABLE; \
- ldq ra, 0(sp); \
- ldq v0, 8(sp); \
- addq sp, 64, sp; \
- cfi_remember_state; \
- cfi_restore(ra); \
- cfi_def_cfa_offset(0); \
- ret; \
- cfi_restore_state; \
-__LABEL($multi_error) \
- CDISABLE; \
- ldq ra, 0(sp); \
- ldq v0, 8(sp); \
- addq sp, 64, sp; \
- cfi_restore(ra); \
- cfi_def_cfa_offset(0); \
-__LABEL($syscall_error) \
- SYSCALL_ERROR_HANDLER; \
- cfi_endproc; \
- .previous
-
-# undef PSEUDO_END
-# define PSEUDO_END(sym) \
- cfi_endproc; \
- .subsection 2; \
- .size sym, .-sym
-
-# define SAVE_ARGS_0 /* Nothing. */
-# define SAVE_ARGS_1 SAVE_ARGS_0; stq a0, 8(sp)
-# define SAVE_ARGS_2 SAVE_ARGS_1; stq a1, 16(sp)
-# define SAVE_ARGS_3 SAVE_ARGS_2; stq a2, 24(sp)
-# define SAVE_ARGS_4 SAVE_ARGS_3; stq a3, 32(sp)
-# define SAVE_ARGS_5 SAVE_ARGS_4; stq a4, 40(sp)
-# define SAVE_ARGS_6 SAVE_ARGS_5; stq a5, 48(sp)
-
-# define LOAD_ARGS_0 /* Nothing. */
-# define LOAD_ARGS_1 LOAD_ARGS_0; ldq a0, 8(sp)
-# define LOAD_ARGS_2 LOAD_ARGS_1; ldq a1, 16(sp)
-# define LOAD_ARGS_3 LOAD_ARGS_2; ldq a2, 24(sp)
-# define LOAD_ARGS_4 LOAD_ARGS_3; ldq a3, 32(sp)
-# define LOAD_ARGS_5 LOAD_ARGS_4; ldq a4, 40(sp)
-# define LOAD_ARGS_6 LOAD_ARGS_5; ldq a5, 48(sp)
-
# ifdef IS_IN_libpthread
-# define __local_enable_asynccancel __pthread_enable_asynccancel
-# define __local_disable_asynccancel __pthread_disable_asynccancel
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define __local_enable_asynccancel __libc_enable_asynccancel
-# define __local_disable_asynccancel __libc_disable_asynccancel
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define __local_enable_asynccancel __librt_enable_asynccancel
-# define __local_disable_asynccancel __librt_disable_asynccancel
-# else
-# error Unsupported library
-# endif
-
-# ifdef __PIC__
-# define CENABLE bsr ra, __local_enable_asynccancel !samegp
-# define CDISABLE bsr ra, __local_disable_asynccancel !samegp
-# else
-# define CENABLE jsr ra, __local_enable_asynccancel; ldgp ra, 0(gp)
-# define CDISABLE jsr ra, __local_disable_asynccancel; ldgp ra, 0(gp)
# endif
# if defined IS_IN_libpthread || !defined NOT_IN_libc
-# ifndef __ASSEMBLER__
extern int __local_multiple_threads attribute_hidden;
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (__local_multiple_threads == 0, 1)
-# elif defined(__PIC__)
-# define SINGLE_THREAD_P(reg) ldl reg, __local_multiple_threads(gp) !gprel
-# else
-# define SINGLE_THREAD_P(reg) \
- ldah reg, __local_multiple_threads(gp) !gprelhigh; \
- ldl reg, __local_multiple_threads(reg) !gprellow
-# endif
# else
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P(reg) \
- call_pal PAL_rduniq; \
- ldl reg, MULTIPLE_THREADS_OFFSET($0)
-# endif
# endif
#else
@@ -169,8 +46,6 @@ extern int __local_multiple_threads attribute_hidden;
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h
index 01fd844d1..cfe55751f 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h
@@ -12,107 +12,13 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-#ifdef __ASSEMBLER__
-
-#undef ret
-#define ret
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, nargs) \
- /* vanilla version */ ` \
- ENTRY(name##_nocancel) ` \
- DO_CALL (__NR_##syscall_name) ` \
- jls [blink] ` \
- b __syscall_error@plt ` \
- END(name##_nocancel) ` \
- /* thread cancellation variant */ ` \
- ENTRY(name) ` \
- SINGLE_THREAD_P ` \
- bz name##_nocancel ` \
- DOCARGS_##nargs /* stash syscall args */ ` \
- CENABLE /* call enable_asynccancel */ ` \
- mov r9, r0 /* Safe-keep mask */ ` \
- UNDOCARGS_##nargs /* restore syscall args */ ` \
- DO_CALL (__NR_##syscall_name) ` \
- push r0 /* save syscall return value */ ` \
- mov r0, r9 /* prep mask for disable_asynccancel */ ` \
- CDISABLE ` \
- pop r0 /* get syscall ret value back */ ` \
- pop blink /* UNDOCARGS above left blink on stack */ ` \
- cmp r0, -1024 ` \
- jls [blink] ` \
- b __syscall_error@plt ` \
- END(name)
-
-#undef PSEUDO_END
-#define PSEUDO_END(name) \
-
# ifdef IS_IN_libpthread
-# define CENABLE bl __pthread_enable_asynccancel
-# define CDISABLE bl __pthread_disable_asynccancel
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE bl __libc_enable_asynccancel
-# define CDISABLE bl __libc_disable_asynccancel
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE bl __librt_enable_asynccancel
-# define CDISABLE bl __librt_disable_asynccancel
-# else
-# error Unsupported library
# endif
-#define DO_CALL(num) \
- mov r8, num ` \
- ARC_TRAP_INSN ` \
- cmp r0, -1024
-
-.macro push reg
- st.a \reg, [sp, -4]
-.endm
-
-.macro pop reg
- ld.ab \reg, [sp, 4]
-.endm
-
-#define DOCARGS_0 push blink
-
-/* don't pop blink at this point */
-#define UNDOCARGS_0 ld blink, [sp]
-
-#define DOCARGS_1 DOCARGS_0` push r0
-#define UNDOCARGS_1 pop r0` UNDOCARGS_0
-
-#define DOCARGS_2 DOCARGS_1` push r1
-#define UNDOCARGS_2 pop r1` UNDOCARGS_1
-
-#define DOCARGS_3 DOCARGS_2` push r2
-#define UNDOCARGS_3 pop r2` UNDOCARGS_2
-
-#define DOCARGS_4 DOCARGS_3` push r3
-#define UNDOCARGS_4 pop r3` UNDOCARGS_3
-
-#define DOCARGS_5 DOCARGS_4` push r4
-#define UNDOCARGS_5 pop r4` UNDOCARGS_4
-
-#define DOCARGS_6 DOCARGS_5` push r5
-#define UNDOCARGS_6 pop r5` UNDOCARGS_5
-
-#define DOCARGS_7 DOCARGS_6` push r6
-#define UNDOCARGS_7 pop r6` UNDOCARGS_6
-
-# define SINGLE_THREAD_P \
- THREAD_SELF r9 ` \
- ld r10, [r9, MULTIPLE_THREADS_OFFSET]` \
- cmp r10, 0
-
-/* ld r2, [r1, -TLS_PRE_TCB_SIZE + MULTIPLE_THREADS_OFFSET] */
-#else /* !__ASSEMBLER__ */
-
-/* TBD: Can use @__local_multiple_threads for libc/libpthread like ARM */
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
likely(THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0)
-#endif /* __ASSEMBLER__ */
-
#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
index 6f683ab72..ab2a2de52 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,222 +22,23 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-/* NOTE: We do mark syscalls with unwind annotations, for the benefit of
- cancellation; but they're really only accurate at the point of the
- syscall. The ARM unwind directives are not rich enough without adding
- a custom personality function. */
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .section ".text"; \
- PSEUDO_PROLOGUE; \
- .type __##syscall_name##_nocancel,%function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- cfi_sections(.debug_frame); \
- cfi_startproc; \
- DO_CALL (syscall_name, args); \
- PSEUDO_RET; \
- cfi_endproc; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
- ENTRY (name); \
- SINGLE_THREAD_P; \
- DOARGS_##args; \
- bne .Lpseudo_cancel; \
- cfi_remember_state; \
- DO_CALL (syscall_name, 0); \
- UNDOARGS_##args; \
- cmn r0, $4096; \
- PSEUDO_RET; \
- cfi_restore_state; \
- .Lpseudo_cancel: \
- .fnstart; \
- DOCARGS_##args; /* save syscall args etc. around CENABLE. */ \
- CENABLE; \
- mov ip, r0; /* put mask in safe place. */ \
- UNDOCARGS_##args; /* restore syscall args. */ \
- ldr r7, =SYS_ify (syscall_name); \
- swi 0x0; /* do the call. */ \
- .fnend; /* Past here we can't easily unwind. */ \
- mov r7, r0; /* save syscall return value. */ \
- mov r0, ip; /* get mask back. */ \
- CDISABLE; \
- mov r0, r7; /* retrieve return value. */ \
- RESTORE_LR_##args; \
- UNDOARGS_##args; \
- cmn r0, $4096
-
-/* DOARGS pushes four bytes on the stack for five arguments, eight bytes for
- six arguments, and nothing for fewer. In order to preserve doubleword
- alignment, sometimes we must save an extra register. */
-
-# define RESTART_UNWIND \
- .fnend; \
- .fnstart; \
- .save {r7, lr}
-
-# define DOCARGS_0 \
- stmfd sp!, {r7, lr}; \
- cfi_adjust_cfa_offset (8); \
- cfi_rel_offset (r7, 0); \
- cfi_rel_offset (lr, 4); \
- .save {r7, lr}
-# define UNDOCARGS_0
-# define RESTORE_LR_0 \
- ldmfd sp!, {r7, lr}; \
- cfi_adjust_cfa_offset (-8); \
- cfi_restore (r7); \
- cfi_restore (lr)
-
-# define DOCARGS_1 \
- stmfd sp!, {r0, r1, r7, lr}; \
- cfi_adjust_cfa_offset (16); \
- cfi_rel_offset (r7, 8); \
- cfi_rel_offset (lr, 12); \
- .save {r7, lr}; \
- .pad #8
-# define UNDOCARGS_1 \
- ldr r0, [sp], #8; \
- cfi_adjust_cfa_offset (-8); \
- RESTART_UNWIND
-# define RESTORE_LR_1 \
- RESTORE_LR_0
-
-# define DOCARGS_2 \
- stmfd sp!, {r0, r1, r7, lr}; \
- cfi_adjust_cfa_offset (16); \
- cfi_rel_offset (r7, 8); \
- cfi_rel_offset (lr, 12); \
- .save {r7, lr}; \
- .pad #8
-# define UNDOCARGS_2 \
- ldmfd sp!, {r0, r1}; \
- cfi_adjust_cfa_offset (-8); \
- RESTART_UNWIND
-# define RESTORE_LR_2 \
- RESTORE_LR_0
-
-# define DOCARGS_3 \
- stmfd sp!, {r0, r1, r2, r3, r7, lr}; \
- cfi_adjust_cfa_offset (24); \
- cfi_rel_offset (r7, 16); \
- cfi_rel_offset (lr, 20); \
- .save {r7, lr}; \
- .pad #16
-# define UNDOCARGS_3 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- RESTART_UNWIND
-# define RESTORE_LR_3 \
- RESTORE_LR_0
-
-# define DOCARGS_4 \
- stmfd sp!, {r0, r1, r2, r3, r7, lr}; \
- cfi_adjust_cfa_offset (24); \
- cfi_rel_offset (r7, 16); \
- cfi_rel_offset (lr, 20); \
- .save {r7, lr}; \
- .pad #16
-# define UNDOCARGS_4 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- RESTART_UNWIND
-# define RESTORE_LR_4 \
- RESTORE_LR_0
-
-/* r4 is only stmfd'ed for correct stack alignment. */
-# define DOCARGS_5 \
- .save {r4}; \
- stmfd sp!, {r0, r1, r2, r3, r4, r7, lr}; \
- cfi_adjust_cfa_offset (28); \
- cfi_rel_offset (r7, 20); \
- cfi_rel_offset (lr, 24); \
- .save {r7, lr}; \
- .pad #20
-# define UNDOCARGS_5 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- .fnend; \
- .fnstart; \
- .save {r4}; \
- .save {r7, lr}; \
- .pad #4
-# define RESTORE_LR_5 \
- ldmfd sp!, {r4, r7, lr}; \
- cfi_adjust_cfa_offset (-12); \
- /* r4 will be marked as restored later. */ \
- cfi_restore (r7); \
- cfi_restore (lr)
-
-# define DOCARGS_6 \
- .save {r4, r5}; \
- stmfd sp!, {r0, r1, r2, r3, r7, lr}; \
- cfi_adjust_cfa_offset (24); \
- cfi_rel_offset (r7, 16); \
- cfi_rel_offset (lr, 20); \
- .save {r7, lr}; \
- .pad #16
-# define UNDOCARGS_6 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- .fnend; \
- .fnstart; \
- .save {r4, r5}; \
- .save {r7, lr}
-# define RESTORE_LR_6 \
- RESTORE_LR_0
-
# ifdef IS_IN_libpthread
-# define CENABLE bl PLTJMP(__pthread_enable_asynccancel)
-# define CDISABLE bl PLTJMP(__pthread_disable_asynccancel)
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE bl PLTJMP(__libc_enable_asynccancel)
-# define CDISABLE bl PLTJMP(__libc_disable_asynccancel)
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE bl PLTJMP(__librt_enable_asynccancel)
-# define CDISABLE bl PLTJMP(__librt_disable_asynccancel)
-# else
-# error Unsupported library
# endif
# if defined IS_IN_libpthread || !defined NOT_IN_libc
-# ifndef __ASSEMBLER__
extern int __local_multiple_threads attribute_hidden;
-# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
-# else
-# define SINGLE_THREAD_P \
- ldr ip, 1b; \
-2: \
- ldr ip, [pc, ip]; \
- teq ip, #0;
-# define PSEUDO_PROLOGUE \
- 1: .word __local_multiple_threads - 2f - 8;
-# endif
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
# else
/* There is no __local_multiple_threads for librt, so use the TCB. */
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define PSEUDO_PROLOGUE
-# define SINGLE_THREAD_P \
- stmfd sp!, {r0, lr}; \
- cfi_adjust_cfa_offset (8); \
- cfi_rel_offset (lr, 4); \
- bl __aeabi_read_tp; \
- ldr ip, [r0, #MULTIPLE_THREADS_OFFSET]; \
- ldmfd sp!, {r0, lr}; \
- cfi_adjust_cfa_offset (-8); \
- cfi_restore (lr); \
- teq ip, #0
-# define SINGLE_THREAD_P_PIC(x) SINGLE_THREAD_P
-# endif
# endif
-#elif !defined __ASSEMBLER__
+#else
/* For rtld, et cetera. */
# define SINGLE_THREAD_P 1
@@ -246,8 +46,6 @@ extern int __local_multiple_threads attribute_hidden;
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
index b0eb02600..ba88c55e2 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
@@ -1,5 +1,4 @@
/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,131 +23,17 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- cmpl $0, %gs:MULTIPLE_THREADS_OFFSET; \
- jne L(pseudo_cancel); \
- .type __##syscall_name##_nocancel,@function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- DO_CALL (syscall_name, args); \
- cmpl $-4095, %eax; \
- jae SYSCALL_ERROR_LABEL; \
- ret; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
- L(pseudo_cancel): \
- CENABLE \
- SAVE_OLDTYPE_##args \
- PUSHCARGS_##args \
- DOCARGS_##args \
- movl $SYS_ify (syscall_name), %eax; \
- ENTER_KERNEL; \
- POPCARGS_##args; \
- POPSTATE_##args \
- cmpl $-4095, %eax; \
- jae SYSCALL_ERROR_LABEL; \
- L(pseudo_end):
-
-# define SAVE_OLDTYPE_0 movl %eax, %ecx;
-# define SAVE_OLDTYPE_1 SAVE_OLDTYPE_0
-# define SAVE_OLDTYPE_2 pushl %eax; cfi_adjust_cfa_offset (4);
-# define SAVE_OLDTYPE_3 SAVE_OLDTYPE_2
-# define SAVE_OLDTYPE_4 SAVE_OLDTYPE_2
-# define SAVE_OLDTYPE_5 SAVE_OLDTYPE_2
-# define SAVE_OLDTYPE_6 SAVE_OLDTYPE_2
-
-# define PUSHCARGS_0 /* No arguments to push. */
-# define DOCARGS_0 /* No arguments to frob. */
-# define POPCARGS_0 /* No arguments to pop. */
-# define _PUSHCARGS_0 /* No arguments to push. */
-# define _POPCARGS_0 /* No arguments to pop. */
-
-# define PUSHCARGS_1 movl %ebx, %edx; cfi_register (ebx, edx); PUSHCARGS_0
-# define DOCARGS_1 _DOARGS_1 (4)
-# define POPCARGS_1 POPCARGS_0; movl %edx, %ebx; cfi_restore (ebx);
-# define _PUSHCARGS_1 pushl %ebx; cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (ebx, 0); _PUSHCARGS_0
-# define _POPCARGS_1 _POPCARGS_0; popl %ebx; \
- cfi_adjust_cfa_offset (-4); cfi_restore (ebx);
-
-# define PUSHCARGS_2 PUSHCARGS_1
-# define DOCARGS_2 _DOARGS_2 (12)
-# define POPCARGS_2 POPCARGS_1
-# define _PUSHCARGS_2 _PUSHCARGS_1
-# define _POPCARGS_2 _POPCARGS_1
-
-# define PUSHCARGS_3 _PUSHCARGS_2
-# define DOCARGS_3 _DOARGS_3 (20)
-# define POPCARGS_3 _POPCARGS_3
-# define _PUSHCARGS_3 _PUSHCARGS_2
-# define _POPCARGS_3 _POPCARGS_2
-
-# define PUSHCARGS_4 _PUSHCARGS_4
-# define DOCARGS_4 _DOARGS_4 (28)
-# define POPCARGS_4 _POPCARGS_4
-# define _PUSHCARGS_4 pushl %esi; cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (esi, 0); _PUSHCARGS_3
-# define _POPCARGS_4 _POPCARGS_3; popl %esi; \
- cfi_adjust_cfa_offset (-4); cfi_restore (esi);
-
-# define PUSHCARGS_5 _PUSHCARGS_5
-# define DOCARGS_5 _DOARGS_5 (36)
-# define POPCARGS_5 _POPCARGS_5
-# define _PUSHCARGS_5 pushl %edi; cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (edi, 0); _PUSHCARGS_4
-# define _POPCARGS_5 _POPCARGS_4; popl %edi; \
- cfi_adjust_cfa_offset (-4); cfi_restore (edi);
-
-# define PUSHCARGS_6 _PUSHCARGS_6
-# define DOCARGS_6 _DOARGS_6 (44)
-# define POPCARGS_6 _POPCARGS_6
-# define _PUSHCARGS_6 pushl %ebp; cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (ebp, 0); _PUSHCARGS_5
-# define _POPCARGS_6 _POPCARGS_5; popl %ebp; \
- cfi_adjust_cfa_offset (-4); cfi_restore (ebp);
-
-# ifdef IS_IN_libpthread
-# define CENABLE call __pthread_enable_asynccancel;
-# define CDISABLE call __pthread_disable_asynccancel
-# elif !defined NOT_IN_libc
-# define CENABLE call __libc_enable_asynccancel;
-# define CDISABLE call __libc_disable_asynccancel
-# elif defined IS_IN_librt
-# define CENABLE call __librt_enable_asynccancel;
-# define CDISABLE call __librt_disable_asynccancel
-# else
-# error Unsupported library
-# endif
-# define POPSTATE_0 \
- pushl %eax; cfi_adjust_cfa_offset (4); movl %ecx, %eax; \
- CDISABLE; popl %eax; cfi_adjust_cfa_offset (-4);
-# define POPSTATE_1 POPSTATE_0
-# define POPSTATE_2 xchgl (%esp), %eax; CDISABLE; popl %eax; \
- cfi_adjust_cfa_offset (-4);
-# define POPSTATE_3 POPSTATE_2
-# define POPSTATE_4 POPSTATE_3
-# define POPSTATE_5 POPSTATE_4
-# define POPSTATE_6 POPSTATE_5
-
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
-# endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P (1)
# define NO_CANCELLATION 1
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h
index c44b1039d..72823c0f2 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h
@@ -1,5 +1,4 @@
/* Copyright (C) 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,120 +22,16 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-/* NOTE: We do mark syscalls with unwind annotations, for the benefit of
- cancellation; but they're really only accurate at the point of the
- syscall. The ARM unwind directives are not rich enough without adding
- a custom personality function. */
-
-#ifdef __ASSEMBLER__
-#undef ret
-#define ret \
- CMP D0Re0, #-4095; \
- MOVLO PC, D1RtP; \
- MOV D1Ar1, D0Re0; \
- B SYSCALL_ERROR;
-#endif /* __ASSEMBLER__ */
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .section ".text"; \
- .type ___##syscall_name##_nocancel,%function; \
- .globl ___##syscall_name##_nocancel; \
- ___##syscall_name##_nocancel: \
- cfi_startproc; \
- DO_CALL (syscall_name, args); \
- MOV PC, D1RtP; \
- cfi_endproc; \
- .size ___##syscall_name##_nocancel,.-___##syscall_name##_nocancel; \
- .globl _##name; \
- .type _##name, @function; \
-name##: \
-_##name##: \
- DOCARGS_##args; \
- SINGLE_THREAD_P; \
- UNDOCARGS_##args; \
- BNE .Lpseudo_cancel; \
- cfi_remember_state; \
- DO_CALL (syscall_name, 0); \
- ret \
- cfi_restore_state; \
- .Lpseudo_cancel: \
- MSETL [A0StP++], D0FrT, D0.5; \
- DOCARGS_##args; /* save syscall args etc. around CENABLE. */ \
- CENABLE; \
- MOV D0FrT, D0Re0; /* put mask in safe place. */ \
- UNDOCARGS_##args; /* restore syscall args. */ \
- DO_CALL(syscall_name, 0); /* do the call. */ \
- MOV D0.5, D0Re0; /* save syscall return value. */ \
- MOV D1Ar1, D0FrT; /* get mask back. */ \
- CDISABLE; \
- MOV D0Re0, D0.5; /* retrieve return value. */ \
- GETL D0.5, D1.5, [--A0StP]; \
- GETL D0FrT, D1RtP, [--A0StP];
-
-# define DOCARGS_0
-# define UNDOCARGS_0
-
-# define DOCARGS_1 \
- SETL [A0StP++], D1Ar1, D0Ar2
-# define UNDOCARGS_1 \
- GETL D1Ar1, D0Ar2, [--A0StP]
-
-# define DOCARGS_2 DOCARGS_1
-
-# define UNDOCARGS_2 UNDOCARGS_2
-
-# define DOCARGS_3 \
- MSETL [A0StP++], D1Ar1, D1Ar3
-
-# define UNDOCARGS_3 \
- GETL D1Ar1, D0Ar2, [--A0StP]; \
- GETL D1Ar3, D0Ar4, [--A0StP]
-
-# define DOCARGS_4 DOCARGS_3
-# define UNDOCARGS_4 UNDOCARGS_3
-
-# define DOCARGS_5 \
- MSETL [A0StP++], D1Ar1, D1Ar3, D1Ar5
-# define UNDOCARGS_5 \
- GETL D1Ar1, D0Ar2, [--A0StP]; \
- GETL D1Ar3, D0Ar4, [--A0StP]; \
- GETL D1Ar5, D0Ar6, [--A0StP]
-
-# define DOCARGS_6 DOCARGS_5
-# define UNDOCARGS_6 UNDOCARGS_5
-
# ifdef IS_IN_libpthread
-# define CENABLE CALLR D1RtP, ___pthread_enable_asynccancel@PLT
-# define CDISABLE CALLR D1RtP, ___pthread_disable_asynccancel@PLT
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE CALLR D1RtP, ___libc_enable_asynccancel@PLT
-# define CDISABLE CALLR D1RtP, ___libc_disable_asynccancel@PLT
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE CALLR D1RtP, ___librt_enable_asynccancel@PLT
-# define CDISABLE CALLR D1RtP, ___librt_disable_asynccancel@PLT
-# else
-# error Unsupported library
# endif
-#ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+#define SINGLE_THREAD_P \
likely(THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0)
#else
-# define SINGLE_THREAD_P \
- SETL [A0StP++], D0FrT, D1RtP; \
- CALLR D1RtP, ___metag_load_tp@PLT; \
- SUB D0Re0, D0Re0, #TLS_PRE_TCB_SIZE; \
- GETD D0Re0, [D0Re0 + #MULTIPLE_THREADS_OFFSET]; \
- CMP D0Re0, #0; \
- GETL D0FrT, D1RtP, [--A0StP]
-#endif
-
-
-#elif !defined __ASSEMBLER__
/* For rtld, et cetera. */
# define SINGLE_THREAD_P 1
@@ -144,8 +39,6 @@ _##name##: \
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
likely(THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h
index a03e42a40..0baa76f2e 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 2014-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,129 +22,28 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# if !defined IS_IN_librt || !defined(PIC)
-# define AC_STACK_SIZE 16 /* space for r15, async_cancel arg and 2 temp words */
-# define AC_SET_GOT /* empty */
-# define AC_RESTORE_GOT /* empty */
-# else
-# define AC_STACK_SIZE 20 /* extra 4 bytes for r20 */
-# define AC_SET_GOT \
- swi r20, r1, AC_STACK_SIZE-4; \
- mfs r20, rpc; \
- addik r20, r20, _GLOBAL_OFFSET_TABLE_+8;
-# define AC_RESTORE_GOT \
- lwi r20, r1, AC_STACK_SIZE-4;
-# endif
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- SINGLE_THREAD_P(r12); \
- bnei r12, L(pseudo_cancel); \
- .globl __##syscall_name##_nocancel; \
- .type __##syscall_name##_nocancel,@function; \
-__##syscall_name##_nocancel: \
- DO_CALL (syscall_name, args); \
- addik r4, r0, -4095; \
- cmpu r4, r4, r3; \
- bgei r4, SYSCALL_ERROR_LABEL; \
- rtsd r15, 8; \
- nop; \
- .size __##syscall_name##_nocancel, .-__##syscall_name##_nocancel; \
-L(pseudo_cancel): \
- addik r1, r1, -AC_STACK_SIZE; \
- swi r15, r1, 0; \
- AC_SET_GOT \
- DOCARGS_##args \
- CENABLE; \
- swi r3, r1, 8; \
- UNDOCARGS_##args \
- DO_CALL (syscall_name, args); \
- swi r3, r1, 12; \
- lwi r5, r1, 8; \
- CDISABLE; \
- lwi r3, r1, 12; \
- lwi r15, r1, 0; \
- AC_RESTORE_GOT \
- addik r1, r1, AC_STACK_SIZE; \
- addik r4, r0, -4095; \
- cmpu r4, r4, r3; \
- bgei r4, SYSCALL_ERROR_LABEL; \
- rtsd r15, 8; \
- nop;
-
-/*
- * Macros to save/restore syscall arguments across CENABLE
- * The arguments are saved into the caller's stack (original r1 + 4)
- */
-
-# define DOCARGS_0
-# define DOCARGS_1 swi r5, r1, AC_STACK_SIZE + 4;
-# define DOCARGS_2 swi r6, r1, AC_STACK_SIZE + 8; DOCARGS_1
-# define DOCARGS_3 swi r7, r1, AC_STACK_SIZE + 12; DOCARGS_2
-# define DOCARGS_4 swi r8, r1, AC_STACK_SIZE + 16; DOCARGS_3
-# define DOCARGS_5 swi r9, r1, AC_STACK_SIZE + 20; DOCARGS_4
-# define DOCARGS_6 swi r10, r1, AC_STACK_SIZE + 24; DOCARGS_5
-
-# define UNDOCARGS_0
-# define UNDOCARGS_1 lwi r5, r1, AC_STACK_SIZE + 4;
-# define UNDOCARGS_2 UNDOCARGS_1 lwi r6, r1, AC_STACK_SIZE + 8;
-# define UNDOCARGS_3 UNDOCARGS_2 lwi r7, r1, AC_STACK_SIZE + 12;
-# define UNDOCARGS_4 UNDOCARGS_3 lwi r8, r1, AC_STACK_SIZE + 16;
-# define UNDOCARGS_5 UNDOCARGS_4 lwi r9, r1, AC_STACK_SIZE + 20;
-# define UNDOCARGS_6 UNDOCARGS_5 lwi r10, r1, AC_STACK_SIZE + 24;
-
-# ifdef PIC
-# define PSEUDO_JMP(sym) brlid r15, sym##@PLTPC; addk r0, r0, r0
-# else
-# define PSEUDO_JMP(sym) brlid r15, sym; addk r0, r0, r0
-# endif
-
# if defined IS_IN_libpthread
-# define CENABLE PSEUDO_JMP (__pthread_enable_asynccancel)
-# define CDISABLE PSEUDO_JMP (__pthread_disable_asynccancel)
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE PSEUDO_JMP (__libc_enable_asynccancel)
-# define CDISABLE PSEUDO_JMP (__libc_disable_asynccancel)
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE PSEUDO_JMP (__librt_enable_asynccancel)
-# define CDISABLE PSEUDO_JMP (__librt_disable_asynccancel)
-# else
-# error Unsupported library
# endif
-#if !defined NOT_IN_libc || defined IS_IN_libpthread
-# ifndef __ASSEMBLER__
+# if !defined NOT_IN_libc || defined IS_IN_libpthread
extern int __local_multiple_threads attribute_hidden;
-# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
-# else
-# if !defined PIC
-# define SINGLE_THREAD_P(reg) lwi reg, r0, __local_multiple_threads;
-# else
-# define SINGLE_THREAD_P(reg) \
- mfs reg, rpc; \
- addik reg, reg, _GLOBAL_OFFSET_TABLE_+8; \
- lwi reg, reg, __local_multiple_threads@GOT; \
- lwi reg, reg, 0;
-# endif
-# endif
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
# else
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P(reg) \
- lwi reg, r0, MULTIPLE_THREADS_OFFSET(reg)
-# endif
# endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P (1)
# define NO_CANCELLATION (1)
#endif
+
+#define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h
index 1750f059a..57b50042b 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,165 +22,18 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# ifdef __PIC__
-# define PSEUDO_CPLOAD .cpload t9;
-# define PSEUDO_ERRJMP move a0, v0; la t9, __syscall_error; jr t9;
-# define PSEUDO_SAVEGP sw gp, 32(sp); cfi_rel_offset (gp, 32);
-# define PSEUDO_LOADGP lw gp, 32(sp);
-# else
-# define PSEUDO_CPLOAD
-# define PSEUDO_ERRJMP move a0, v0; j __syscall_error;
-# define PSEUDO_SAVEGP
-# define PSEUDO_LOADGP
-# endif
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .align 2; \
- L(pseudo_start): \
- cfi_startproc; \
- 99: PSEUDO_ERRJMP \
- .type __##syscall_name##_nocancel, @function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- .set noreorder; \
- PSEUDO_CPLOAD \
- li v0, SYS_ify(syscall_name); \
- syscall; \
- .set reorder; \
- bne a3, zero, 99b; \
- ret; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
- ENTRY (name) \
- .set noreorder; \
- PSEUDO_CPLOAD \
- .set reorder; \
- SINGLE_THREAD_P(v1); \
- bne zero, v1, L(pseudo_cancel); \
- .set noreorder; \
- li v0, SYS_ify(syscall_name); \
- syscall; \
- .set reorder; \
- bne a3, zero, 99b; \
- ret; \
- L(pseudo_cancel): \
- SAVESTK_##args; \
- sw ra, 28(sp); \
- cfi_rel_offset (ra, 28); \
- PSEUDO_SAVEGP \
- PUSHARGS_##args; /* save syscall args */ \
- CENABLE; \
- PSEUDO_LOADGP \
- sw v0, 44(sp); /* save mask */ \
- POPARGS_##args; /* restore syscall args */ \
- .set noreorder; \
- li v0, SYS_ify (syscall_name); \
- syscall; \
- .set reorder; \
- sw v0, 36(sp); /* save syscall result */ \
- sw a3, 40(sp); /* save syscall error flag */ \
- lw a0, 44(sp); /* pass mask as arg1 */ \
- CDISABLE; \
- PSEUDO_LOADGP \
- lw v0, 36(sp); /* restore syscall result */ \
- lw a3, 40(sp); /* restore syscall error flag */ \
- lw ra, 28(sp); /* restore return address */ \
- .set noreorder; \
- bne a3, zero, 99b; \
- RESTORESTK; \
- L(pseudo_end): \
- .set reorder;
-
-# undef PSEUDO_END
-# define PSEUDO_END(sym) cfi_endproc; .end sym; .size sym,.-sym
-
-# define PUSHARGS_0 /* nothing to do */
-# define PUSHARGS_1 PUSHARGS_0 sw a0, 0(sp); cfi_rel_offset (a0, 0);
-# define PUSHARGS_2 PUSHARGS_1 sw a1, 4(sp); cfi_rel_offset (a1, 4);
-# define PUSHARGS_3 PUSHARGS_2 sw a2, 8(sp); cfi_rel_offset (a2, 8);
-# define PUSHARGS_4 PUSHARGS_3 sw a3, 12(sp); cfi_rel_offset (a3, 12);
-# define PUSHARGS_5 PUSHARGS_4 /* handled by SAVESTK_## */
-# define PUSHARGS_6 PUSHARGS_5
-# define PUSHARGS_7 PUSHARGS_6
-
-# define POPARGS_0 /* nothing to do */
-# define POPARGS_1 POPARGS_0 lw a0, 0(sp);
-# define POPARGS_2 POPARGS_1 lw a1, 4(sp);
-# define POPARGS_3 POPARGS_2 lw a2, 8(sp);
-# define POPARGS_4 POPARGS_3 lw a3, 12(sp);
-# define POPARGS_5 POPARGS_4 /* args already in new stackframe */
-# define POPARGS_6 POPARGS_5
-# define POPARGS_7 POPARGS_6
-
-
-# define STKSPACE 48
-# define SAVESTK_0 subu sp, STKSPACE; cfi_adjust_cfa_offset(STKSPACE)
-# define SAVESTK_1 SAVESTK_0
-# define SAVESTK_2 SAVESTK_1
-# define SAVESTK_3 SAVESTK_2
-# define SAVESTK_4 SAVESTK_3
-# define SAVESTK_5 lw t0, 16(sp); \
- SAVESTK_0; \
- sw t0, 16(sp)
-
-# define SAVESTK_6 lw t0, 16(sp); \
- lw t1, 20(sp); \
- SAVESTK_0; \
- sw t0, 16(sp); \
- sw t1, 20(sp)
-
-# define SAVESTK_7 lw t0, 16(sp); \
- lw t1, 20(sp); \
- lw t2, 24(sp); \
- SAVESTK_0; \
- sw t0, 16(sp); \
- sw t1, 20(sp); \
- sw t2, 24(sp)
-
-# define RESTORESTK addu sp, STKSPACE; cfi_adjust_cfa_offset(-STKSPACE)
-
-
-# ifdef __PIC__
-/* We use jalr rather than jal. This means that the assembler will not
- automatically restore $gp (in case libc has multiple GOTs) so we must
- do it manually - which we have to do anyway since we don't use .cprestore.
- It also shuts up the assembler warning about not using .cprestore. */
-# define PSEUDO_JMP(sym) la t9, sym; jalr t9;
-# else
-# define PSEUDO_JMP(sym) jal sym;
-# endif
-
-# ifdef IS_IN_libpthread
-# define CENABLE PSEUDO_JMP (__pthread_enable_asynccancel)
-# define CDISABLE PSEUDO_JMP (__pthread_disable_asynccancel)
-# elif defined IS_IN_librt
-# define CENABLE PSEUDO_JMP (__librt_enable_asynccancel)
-# define CDISABLE PSEUDO_JMP (__librt_disable_asynccancel)
-# else
-# define CENABLE PSEUDO_JMP (__libc_enable_asynccancel)
-# define CDISABLE PSEUDO_JMP (__libc_disable_asynccancel)
-# endif
-
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) \
== 0, 1)
-# else
-# define SINGLE_THREAD_P(reg) \
- READ_THREAD_POINTER(reg); \
- lw reg, MULTIPLE_THREADS_OFFSET(reg)
-#endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P 1
# define NO_CANCELLATION 1
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/sysdep-cancel.h
index a0f4de5c8..fd3af9aec 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/sysdep-cancel.h
@@ -25,171 +25,12 @@
# include <pthreadP.h>
#endif
-
-
-#define PUSHARGS_0
-#define PUSHARGS_1 smw.adm $r0, [$sp], $r0, #0; \
- cfi_adjust_cfa_offset(4); \
- cfi_rel_offset(r0,0); \
- addi $sp, $sp, -4; \
- cfi_adjust_cfa_offset(4);
-#define PUSHARGS_2 smw.adm $r0, [$sp], $r1, #0; \
- cfi_adjust_cfa_offset(8); \
- cfi_rel_offset(r1, 4); \
- cfi_rel_offset(r0, 0);
-#define PUSHARGS_3 smw.adm $r0, [$sp], $r2, #0; \
- cfi_adjust_cfa_offset(12); \
- cfi_rel_offset(r2, 8); \
- cfi_rel_offset(r1, 4); \
- cfi_rel_offset(r0, 0); \
- addi $sp, $sp, -4; \
- cfi_adjust_cfa_offset(4);
-#define PUSHARGS_4 smw.adm $r0, [$sp], $r3, #0; \
- cfi_adjust_cfa_offset(16); \
- cfi_rel_offset(r3, 12); \
- cfi_rel_offset(r2, 8); \
- cfi_rel_offset(r1, 4); \
- cfi_rel_offset(r0, 0);
-#define PUSHARGS_5 smw.adm $r0, [$sp], $r4, #0; \
- cfi_adjust_cfa_offset(20); \
- cfi_rel_offset(r4, 16); \
- cfi_rel_offset(r3, 12); \
- cfi_rel_offset(r2, 8); \
- cfi_rel_offset(r1, 4); \
- cfi_rel_offset(r0, 0); \
- addi $sp, $sp, -4; \
- cfi_adjust_cfa_offset(4);
-#define PUSHARGS_6 smw.adm $r0, [$sp], $r5, #0; \
- cfi_adjust_cfa_offset(24); \
- cfi_rel_offset(r5, 20); \
- cfi_rel_offset(r4, 16); \
- cfi_rel_offset(r3, 12); \
- cfi_rel_offset(r2, 8); \
- cfi_rel_offset(r1, 4); \
- cfi_rel_offset(r0, 0);
-
-#define POPARGS2_0
-#define POPARGS2_1 addi $sp, $sp, 4; \
- cfi_adjust_cfa_offset(-4); \
- lmw.bim $r0, [$sp], $r0, #0; \
- cfi_adjust_cfa_offset(-4); \
- cfi_restore(r0);
-#define POPARGS2_2 lmw.bim $r0, [$sp], $r1, #0; \
- cfi_adjust_cfa_offset(-8); \
- cfi_restore(r0); \
- cfi_restore(r1);
-#define POPARGS2_3 addi $sp, $sp, 4; \
- cfi_adjust_cfa_offset(-4); \
- lmw.bim $r0, [$sp], $r2, #0; \
- cfi_adjust_cfa_offset(-12); \
- cfi_restore(r0); \
- cfi_restore(r1); \
- cfi_restore(r2);
-#define POPARGS2_4 lmw.bim $r0, [$sp], $r3, #0; \
- cfi_adjust_cfa_offset(-16); \
- cfi_restore(r0); \
- cfi_restore(r1); \
- cfi_restore(r2); \
- cfi_restore(r3);
-#define POPARGS2_5 addi $sp, $sp, 4; \
- cfi_adjust_cfa_offset(-4); \
- lmw.bim $r0, [$sp], $r4, #0; \
- cfi_adjust_cfa_offset(-20); \
- cfi_restore(r0); \
- cfi_restore(r1); \
- cfi_restore(r2); \
- cfi_restore(r3); \
- cfi_restore(r4);
-#define POPARGS2_6 lmw.bim $r0, [$sp], $r5, #0; \
- cfi_adjust_cfa_offset(-24); \
- cfi_restore(r0); \
- cfi_restore(r1); \
- cfi_restore(r2); \
- cfi_restore(r3); \
- cfi_restore(r4); \
- cfi_restore(r5);
-
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-/* NOTE: We do mark syscalls with unwind annotations, for the benefit of
- cancellation; but they're really only accurate at the point of the
- syscall. The ARM unwind directives are not rich enough without adding
- a custom personality function. */
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .align 2; \
- ENTRY (__##syscall_name##_nocancel); \
- __do_syscall(syscall_name); \
- PSEUDO_RET; \
- ret; \
- END (__##syscall_name##_nocancel); \
- ENTRY (name); \
- smw.adm $r6,[$sp],$r6,0x2; \
- cfi_adjust_cfa_offset(8); \
- cfi_offset(r6,-8); \
- cfi_offset(lp,-4); \
- SINGLE_THREAD_P ($r15); \
- bgtz $r15, .Lpseudo_cancel; \
- __do_syscall(syscall_name); \
- j 50f; \
- .Lpseudo_cancel: \
- PUSHARGS_##args; /* save syscall args etc. around CENABLE. */ \
- CENABLE ($r5); \
- mov55 $r6, $r0; /* put mask in safe place. */ \
- POPARGS2_##args; \
- __do_syscall(syscall_name); /* do the call. */ \
- push $r0; \
- cfi_adjust_cfa_offset(4); \
- cfi_rel_offset(r0, 0); \
- addi $sp, $sp, -4; \
- cfi_adjust_cfa_offset(4); \
- mov55 $r0, $r6; /* save syscall return value. */\
- CDISABLE($r5); \
- addi $sp, $sp, 4; \
- cfi_adjust_cfa_offset(-4); \
- pop $r0; /* retrieve return value. */ \
- cfi_adjust_cfa_offset(-4); \
- cfi_restore(r0); \
-50: \
- lmw.bim $r6,[$sp],$r6, 0x2; \
- cfi_adjust_cfa_offset(-8); \
- cfi_restore(lp); \
- cfi_restore(r6); \
- PSEUDO_RET;
-# ifndef __ASSEMBLER__
-//# if defined IS_IN_libpthread || !defined NOT_IN_libc
-//extern int __local_multiple_threads attribute_hidden;
-//# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
-//# else
-/* There is no __local_multiple_threads for librt */
-# define SINGLE_THREAD_P __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+# define SINGLE_THREAD_P __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-//# endif
-# else
-# define SINGLE_THREAD_P(reg) \
- addi reg, $r25, MULTIPLE_THREADS_OFFSET; \
- lw reg, [reg];
-# define SINGLE_THREAD_P_PIC(x) SINGLE_THREAD_P(x)
-# endif
-
-
-# ifdef IS_IN_libpthread
-# define CENABLE(reg) jmp(reg, __pthread_enable_asynccancel)
-# define CDISABLE(reg) jmp(reg, __pthread_disable_asynccancel)
-# define __local_multiple_threads __pthread_multiple_threads
-# elif !defined NOT_IN_libc
-# define CENABLE(reg) jmp(reg, __libc_enable_asynccancel)
-# define CDISABLE(reg) jmp(reg, __libc_disable_asynccancel)
-# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE(reg) jmp(reg, __librt_enable_asynccancel)
-# define CDISABLE(reg) jmp(reg, __librt_disable_asynccancel)
-# else
-# error Unsupported library
-# endif
-#elif !defined __ASSEMBLER__
+#else
/* For rtld, et cetera. */
# define SINGLE_THREAD_P 1
@@ -197,77 +38,7 @@
#endif
-
-
-
-
-
-
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
-
-
-
-#ifdef PIC
-#define PSEUDO_RET \
- .pic \
- .align 2; \
- bgez $r0, 1f; \
- sltsi $r1, $r0, -4096; \
- bgtz $r1, 1f; \
- PIC_jmp_err \
- nop; \
- 1:
-#else /* PIC*/
-#define PSEUDO_RET \
- .align 2; \
- bgez $r0, 1f; \
- sltsi $r1, $r0, -4096; \
- bgtz $r1, 1f; \
- j SYSCALL_ERROR; \
- 1:
-#endif
-#ifdef PIC
-#define jmp(reg, symble) PIC_jmpr(reg, symble)
-/* reg: available register */
-#define PIC_jmp_err \
- smw.adm $sp,[$sp],$sp,#0x6; \
- mfusr $r15, $PC; \
- sethi $gp, hi20(_GLOBAL_OFFSET_TABLE_ + 4); \
- ori $gp, $gp, lo12(_GLOBAL_OFFSET_TABLE_ + 8); \
- add $gp, $r15, $gp; \
- sethi $r15, hi20(SYSCALL_ERROR@PLT); \
- ori $r15, $r15, lo12(SYSCALL_ERROR@PLT); \
- add $r15, $r15, $gp; \
- jral $r15; \
- lmw.bim $sp,[$sp],$sp,#0x6; \
- ret;
-
-#define PIC_jmp(reg, symble) \
- mfusr $r15, $PC; \
- sethi reg, hi20(_GLOBAL_OFFSET_TABLE_ + 4); \
- ori reg, reg, lo12(_GLOBAL_OFFSET_TABLE_ + 8); \
- add reg, $r15, reg; \
- sethi $r15, hi20(symble@PLT); \
- ori $r15, $r15, lo12(symble@PLT); \
- add $r15, $r15, reg; \
- jr $r15;
-
-
-#define PIC_jmpr(reg, symble) \
- mfusr $r15, $PC; \
- sethi reg, hi20(_GLOBAL_OFFSET_TABLE_ + 4); \
- ori reg, reg, lo12(_GLOBAL_OFFSET_TABLE_ + 8); \
- add reg, $r15, reg; \
- sethi $r15, hi20(symble@PLT); \
- ori $r15, $r15, lo12(symble@PLT); \
- add $r15, $r15, reg; \
- jral $r15;
-
-#else
-#define jmp(reg, symble) jal symble
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h
index 25382dd19..a0c4799e5 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h
@@ -1,6 +1,5 @@
/* Assembler macros with cancellation support, Nios II version.
Copyright (C) 2003-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,117 +23,18 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-#ifdef __ASSEMBLER__
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .type __##syscall_name##_nocancel, @function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- cfi_startproc; \
- DO_CALL (syscall_name, args); \
- ret; \
- cfi_endproc; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
- ENTRY (name) \
- SINGLE_THREAD_P(r2); \
- bne r2, zero, pseudo_cancel; \
- DO_CALL (syscall_name, args); \
- ret; \
- pseudo_cancel: \
- SAVESTK_##args; /* save syscall args and adjust stack */ \
- SAVEREG(ra, 0); /* save return address */ \
- SAVEREG(r22, 4); /* save GOT pointer */ \
- nextpc r22; \
-1: movhi r2, %hiadj(_gp_got - 1b); \
- addi r2, r2, %lo(_gp_got - 1b); \
- add r22, r22, r2; \
- CENABLE; \
- callr r3; \
- stw r2, 8(sp); /* save mask */ \
- LOADARGS_##args; \
- movi r2, SYS_ify(syscall_name); \
- trap; \
- stw r2, 12(sp); /* save syscall result */ \
- stw r7, 16(sp); /* save syscall error flag */ \
- ldw r4, 8(sp); /* pass mask as argument 1 */ \
- CDISABLE; \
- callr r3; \
- ldw r7, 16(sp); /* restore syscall error flag */ \
- ldw r2, 12(sp); /* restore syscall result */ \
- ldw ra, 0(sp); /* restore return address */ \
- ldw r22, 4(sp); /* restore GOT pointer */ \
- RESTORESTK_##args; \
-
-
-# undef PSEUDO_END
-# define PSEUDO_END(sym) \
- END (sym)
-
-#define SAVEREG(REG, LOC) stw REG, LOC(sp); cfi_rel_offset (REG, LOC)
-#define SAVESTK(X) subi sp, sp, X; cfi_adjust_cfa_offset(X)
-#define SAVESTK_0 SAVESTK(20)
-#define SAVEARG_1 SAVEREG(r4, 20)
-#define SAVESTK_1 SAVESTK(24); SAVEARG_1
-#define SAVEARG_2 SAVEREG(r5, 24); SAVEARG_1
-#define SAVESTK_2 SAVESTK(28); SAVEARG_2
-#define SAVEARG_3 SAVEREG(r6, 28); SAVEARG_2
-#define SAVESTK_3 SAVESTK(32); SAVEARG_3
-#define SAVEARG_4 SAVEREG(r7, 32); SAVEARG_3
-#define SAVESTK_4 SAVESTK(36); SAVEARG_4
-#define SAVESTK_5 SAVESTK_4
-#define SAVESTK_6 SAVESTK_5
-
-#define LOADARGS_0
-#define LOADARGS_1 ldw r4, 20(sp)
-#define LOADARGS_2 LOADARGS_1; ldw r5, 24(sp)
-#define LOADARGS_3 LOADARGS_2; ldw r6, 28(sp)
-#define LOADARGS_4 LOADARGS_3; ldw r7, 32(sp)
-#define LOADARGS_5 LOADARGS_4; ldw r8, 36(sp)
-#define LOADARGS_6 LOADARGS_5; ldw r9, 40(sp)
-
-#define RESTORESTK(X) addi sp, sp, X; cfi_adjust_cfa_offset(-X)
-#define RESTORESTK_0 RESTORESTK(20)
-#define RESTORESTK_1 RESTORESTK(24)
-#define RESTORESTK_2 RESTORESTK(28)
-#define RESTORESTK_3 RESTORESTK(32)
-#define RESTORESTK_4 RESTORESTK(36)
-#define RESTORESTK_5 RESTORESTK(36)
-#define RESTORESTK_6 RESTORESTK(36)
-
-# endif
-
-# ifdef IS_IN_libpthread
-# define CENABLE ldw r3, %call(__pthread_enable_asynccancel)(r22)
-# define CDISABLE ldw r3, %call(__pthread_disable_asynccancel)(r22)
-# elif defined IS_IN_librt
-# define CENABLE ldw r3, %call(__librt_enable_asynccancel)(r22)
-# define CDISABLE ldw r3, %call(__librt_disable_asynccancel)(r22)
-# elif !defined NOT_IN_libc
-# define CENABLE ldw r3, %call(__libc_enable_asynccancel)(r22)
-# define CDISABLE ldw r3, %call(__libc_disable_asynccancel)(r22)
-# else
-# error Unsupported library
-# endif
-
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) \
== 0, 1)
-# else
-# define SINGLE_THREAD_P(reg) \
- ldw reg, MULTIPLE_THREADS_OFFSET(r23)
-# endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P 1
# define NO_CANCELLATION 1
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/or1k/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/or1k/sysdep-cancel.h
index 286fa0cce..f7e70514a 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/or1k/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/or1k/sysdep-cancel.h
@@ -1,5 +1,4 @@
/* Copyright (C) 2014 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,94 +22,17 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
-ENTRY(__##syscall_name##_nocancel); \
-L(pseudo_nocancel): \
- DO_CALL(syscall_name); \
- l.j L(pseudo_finish); \
- l.nop; \
-END(__##syscall_name##_nocancel); \
-ENTRY(name); \
- SINGLE_THREAD_P(r13); \
- l.sfeq r13,r0; \
- l.bnf L(pseudo_nocancel); \
- l.nop; \
- /* Reserve the same amount of stack space, effectivly disregarding \
- * how many args we're supposed to push. This makes the code easier. */ \
- l.addi r1,r1,-28; \
- cfi_adjust_cfa_offset(28); \
- PUSHARGS_##args; /* CENABLE is a function call, save args for syscall. */ \
- CENABLE; \
- l.sw 24(r1),r11; \
- POPARGS_##args; \
- DO_CALL(syscall_name); \
- l.lwz r3,24(r1); /* pass return value from CENABLE to CDISABLE. */ \
- l.sw 24(r1),r11; /* save syscall return value for after CDISABLE. */ \
- CDISABLE; \
- l.lwz r11,24(r1); /* restore syscall return value. */ \
- cfi_adjust_cfa_offset(-28); \
- l.addi r1,r1,28; \
-L(pseudo_finish): \
- /* if -4096 < ret < 0 holds, it's an error */ \
- l.sfgeui r11,0xf001; \
- l.bf L(pseudo_end); \
- l.nop
-
-# undef PSEUDO_END
-# define PSEUDO_END(name) \
-L(pseudo_end): \
- l.j SYSCALL_ERROR_NAME; \
- l.ori r3,r11,0; \
- END(name)
-
-# define PUSHARGS_0 /* nothing to do */
-# define PUSHARGS_1 PUSHARGS_0 l.sw 0(r1),r3;
-# define PUSHARGS_2 PUSHARGS_1 l.sw 4(r1),r4;
-# define PUSHARGS_3 PUSHARGS_2 l.sw 8(r1),r5;
-# define PUSHARGS_4 PUSHARGS_3 l.sw 12(r1),r6;
-# define PUSHARGS_5 PUSHARGS_4 l.sw 16(r1),r7;
-# define PUSHARGS_6 PUSHARGS_5 l.sw 20(r1),r8;
-
-# define POPARGS_0 /* nothing to do */
-# define POPARGS_1 POPARGS_0 l.lwz r3,0(r1);
-# define POPARGS_2 POPARGS_1 l.lwz r4,4(r1);
-# define POPARGS_3 POPARGS_2 l.lwz r5,8(r1);
-# define POPARGS_4 POPARGS_3 l.lwz r6,12(r1);
-# define POPARGS_5 POPARGS_4 l.lwz r7,16(r1);
-# define POPARGS_6 POPARGS_5 l.lwz r8,20(r1);
-
-# define PSEUDO_JMP(sym) l.jal sym; l.nop;
-
-# ifdef IS_IN_libpthread
-# define CENABLE PSEUDO_JMP (__pthread_enable_asynccancel)
-# define CDISABLE PSEUDO_JMP (__pthread_disable_asynccancel)
-# elif defined IS_IN_librt
-# define CENABLE PSEUDO_JMP (__librt_enable_asynccancel)
-# define CDISABLE PSEUDO_JMP (__librt_disable_asynccancel)
-# else
-# define CENABLE PSEUDO_JMP (__libc_enable_asynccancel)
-# define CDISABLE PSEUDO_JMP (__libc_disable_asynccancel)
-# endif
-
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-/* It's not super nice to have "r10" hardcoded here */
-# define SINGLE_THREAD_P(reg) l.lwz reg, MULTIPLE_THREADS_OFFSET(r10)
-#endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P 1
# define NO_CANCELLATION 1
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h
index c163dcdba..2247801b2 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h
@@ -1,6 +1,5 @@
/* Cancellable system call stubs. Linux/PowerPC version.
Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Franz Sirl <Franz.Sirl-kernel@lauterbach.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,94 +24,17 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .section ".text"; \
- ENTRY (name) \
- SINGLE_THREAD_P; \
- bne- .Lpseudo_cancel; \
- .type __##syscall_name##_nocancel,@function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- DO_CALL (SYS_ify (syscall_name)); \
- PSEUDO_RET; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
- .Lpseudo_cancel: \
- stwu 1,-48(1); \
- cfi_adjust_cfa_offset (48); \
- mflr 9; \
- stw 9,52(1); \
- cfi_offset (lr, 4); \
- DOCARGS_##args; /* save syscall args around CENABLE. */ \
- CENABLE; \
- stw 3,16(1); /* store CENABLE return value (MASK). */ \
- UNDOCARGS_##args; /* restore syscall args. */ \
- DO_CALL (SYS_ify (syscall_name)); \
- mfcr 0; /* save CR/R3 around CDISABLE. */ \
- stw 3,8(1); \
- stw 0,12(1); \
- lwz 3,16(1); /* pass MASK to CDISABLE. */ \
- CDISABLE; \
- lwz 4,52(1); \
- lwz 0,12(1); /* restore CR/R3. */ \
- lwz 3,8(1); \
- mtlr 4; \
- mtcr 0; \
- addi 1,1,48;
-
-# define DOCARGS_0
-# define UNDOCARGS_0
-
-# define DOCARGS_1 stw 3,20(1); DOCARGS_0
-# define UNDOCARGS_1 lwz 3,20(1); UNDOCARGS_0
-
-# define DOCARGS_2 stw 4,24(1); DOCARGS_1
-# define UNDOCARGS_2 lwz 4,24(1); UNDOCARGS_1
-
-# define DOCARGS_3 stw 5,28(1); DOCARGS_2
-# define UNDOCARGS_3 lwz 5,28(1); UNDOCARGS_2
-
-# define DOCARGS_4 stw 6,32(1); DOCARGS_3
-# define UNDOCARGS_4 lwz 6,32(1); UNDOCARGS_3
-
-# define DOCARGS_5 stw 7,36(1); DOCARGS_4
-# define UNDOCARGS_5 lwz 7,36(1); UNDOCARGS_4
-
-# define DOCARGS_6 stw 8,40(1); DOCARGS_5
-# define UNDOCARGS_6 lwz 8,40(1); UNDOCARGS_5
-
-# ifdef IS_IN_libpthread
-# define CENABLE bl __pthread_enable_asynccancel@local
-# define CDISABLE bl __pthread_disable_asynccancel@local
-# elif !defined NOT_IN_libc
-# define CENABLE bl __libc_enable_asynccancel@local
-# define CDISABLE bl __libc_disable_asynccancel@local
-# elif defined IS_IN_librt
-# define CENABLE bl __librt_enable_asynccancel@local
-# define CDISABLE bl __librt_disable_asynccancel@local
-# else
-# error Unsupported library
-# endif
-
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P \
- lwz 10,MULTIPLE_THREADS_OFFSET(2); \
- cmpwi 10,0
-# endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P (1)
# define NO_CANCELLATION 1
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
index f64c24f90..ec583acf9 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
@@ -1,5 +1,4 @@
/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,146 +22,17 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# define _IMM12 #-12
-# define _IMM16 #-16
-# define _IMP16 #16
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY (name); \
- .Lpseudo_start: \
- SINGLE_THREAD_P; \
- bf .Lpseudo_cancel; \
- .type __##syscall_name##_nocancel,@function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- DO_CALL (syscall_name, args); \
- mov r0,r1; \
- mov _IMM12,r2; \
- shad r2,r1; \
- not r1,r1; \
- tst r1,r1; \
- bt .Lsyscall_error; \
- bra .Lpseudo_end; \
- nop; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
- .Lpseudo_cancel: \
- sts.l pr,@-r15; \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (pr, 0); \
- add _IMM16,r15; \
- cfi_adjust_cfa_offset (16); \
- SAVE_ARGS_##args; \
- CENABLE; \
- LOAD_ARGS_##args; \
- add _IMP16,r15; \
- cfi_adjust_cfa_offset (-16); \
- lds.l @r15+,pr; \
- cfi_adjust_cfa_offset (-4); \
- cfi_restore (pr); \
- DO_CALL(syscall_name, args); \
- SYSCALL_INST_PAD; \
- sts.l pr,@-r15; \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (pr, 0); \
- mov.l r0,@-r15; \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (r0, 0); \
- CDISABLE; \
- mov.l @r15+,r0; \
- cfi_adjust_cfa_offset (-4); \
- lds.l @r15+,pr; \
- cfi_adjust_cfa_offset (-4); \
- cfi_restore (pr); \
- mov r0,r1; \
- mov _IMM12,r2; \
- shad r2,r1; \
- not r1,r1; \
- tst r1,r1; \
- bf .Lpseudo_end; \
- .Lsyscall_error: \
- SYSCALL_ERROR_HANDLER; \
- .Lpseudo_end:
-
-# undef PSEUDO_END
-# define PSEUDO_END(sym) \
- END (sym)
-
-# define SAVE_ARGS_0 /* Nothing. */
-# define SAVE_ARGS_1 SAVE_ARGS_0; mov.l r4,@(0,r15); cfi_offset (r4,-4)
-# define SAVE_ARGS_2 SAVE_ARGS_1; mov.l r5,@(4,r15); cfi_offset (r5,-8)
-# define SAVE_ARGS_3 SAVE_ARGS_2; mov.l r6,@(8,r15); cfi_offset (r6,-12)
-# define SAVE_ARGS_4 SAVE_ARGS_3; mov.l r7,@(12,r15); cfi_offset (r7,-16)
-# define SAVE_ARGS_5 SAVE_ARGS_4
-# define SAVE_ARGS_6 SAVE_ARGS_5
-
-# define LOAD_ARGS_0 /* Nothing. */
-# define LOAD_ARGS_1 LOAD_ARGS_0; mov.l @(0,r15),r4
-# define LOAD_ARGS_2 LOAD_ARGS_1; mov.l @(4,r15),r5
-# define LOAD_ARGS_3 LOAD_ARGS_2; mov.l @(8,r15),r6
-# define LOAD_ARGS_4 LOAD_ARGS_3; mov.l @(12,r15),r7
-# define LOAD_ARGS_5 LOAD_ARGS_4
-# define LOAD_ARGS_6 LOAD_ARGS_5
-
-# ifdef IS_IN_libpthread
-# define __local_enable_asynccancel __pthread_enable_asynccancel
-# define __local_disable_asynccancel __pthread_disable_asynccancel
-# elif !defined NOT_IN_libc
-# define __local_enable_asynccancel __libc_enable_asynccancel
-# define __local_disable_asynccancel __libc_disable_asynccancel
-# elif defined IS_IN_librt
-# define __local_enable_asynccancel __librt_enable_asynccancel
-# define __local_disable_asynccancel __librt_disable_asynccancel
-# else
-# error Unsupported library
-# endif
-
-# define CENABLE \
- mov.l 1f,r0; \
- bsrf r0; \
- nop; \
- 0: bra 2f; \
- mov r0,r2; \
- .align 2; \
- 1: .long __local_enable_asynccancel - 0b; \
- 2:
-
-# define CDISABLE \
- mov.l 1f,r0; \
- bsrf r0; \
- mov r2,r4; \
- 0: bra 2f; \
- nop; \
- .align 2; \
- 1: .long __local_disable_asynccancel - 0b; \
- 2:
-
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P \
- stc gbr,r0; \
- mov.w 0f,r1; \
- sub r1,r0; \
- mov.l @(MULTIPLE_THREADS_OFFSET,r0),r0; \
- bra 1f; \
- tst r0,r0; \
- 0: .word TLS_PRE_TCB_SIZE; \
- 1:
-
-# endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P (1)
# define NO_CANCELLATION 1
#endif
-#ifndef __ASSEMBLER__
# define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h
index b61ca7b52..0bf58bbbc 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h
@@ -1,5 +1,4 @@
/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,88 +23,17 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .text; \
- .globl __syscall_error; \
-ENTRY(name) \
- ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;\
- cmp %g1, 0; \
- bne 1f; \
-.type __##syscall_name##_nocancel,@function; \
-.globl __##syscall_name##_nocancel; \
-__##syscall_name##_nocancel: \
- mov SYS_ify(syscall_name), %g1; \
- ta 0x10; \
- bcc 8f; \
- mov %o7, %g1; \
- call __syscall_error; \
- mov %g1, %o7; \
-8: jmpl %o7 + 8, %g0; \
- nop; \
-.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;\
-1: save %sp, -96, %sp; \
- cfi_def_cfa_register(%fp); \
- cfi_window_save; \
- cfi_register(%o7, %i7); \
- CENABLE; \
- nop; \
- mov %o0, %l0; \
- COPY_ARGS_##args \
- mov SYS_ify(syscall_name), %g1; \
- ta 0x10; \
- bcc 1f; \
- mov %o0, %l1; \
- CDISABLE; \
- mov %l0, %o0; \
- call __syscall_error; \
- mov %l1, %o0; \
- b 2f; \
- mov -1, %l1; \
-1: CDISABLE; \
- mov %l0, %o0; \
-2: jmpl %i7 + 8, %g0; \
- restore %g0, %l1, %o0;
-
-
-# ifdef IS_IN_libpthread
-# define CENABLE call __pthread_enable_asynccancel
-# define CDISABLE call __pthread_disable_asynccancel
-# elif !defined NOT_IN_libc
-# define CENABLE call __libc_enable_asynccancel
-# define CDISABLE call __libc_disable_asynccancel
-# elif defined IS_IN_librt
-# define CENABLE call __librt_enable_asynccancel
-# define CDISABLE call __librt_disable_asynccancel
-# else
-# error Unsupported library
-# endif
-
-#define COPY_ARGS_0 /* Nothing */
-#define COPY_ARGS_1 COPY_ARGS_0 mov %i0, %o0;
-#define COPY_ARGS_2 COPY_ARGS_1 mov %i1, %o1;
-#define COPY_ARGS_3 COPY_ARGS_2 mov %i2, %o2;
-#define COPY_ARGS_4 COPY_ARGS_3 mov %i3, %o3;
-#define COPY_ARGS_5 COPY_ARGS_4 mov %i4, %o4;
-#define COPY_ARGS_6 COPY_ARGS_5 mov %i5, %o5;
-
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1
-# endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P (1)
# define NO_CANCELLATION 1
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
index 6e8041738..d731c61dd 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/* Copyright (C) 2002-2017 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,87 +23,31 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-/* The code to disable cancellation depends on the fact that the called
- functions are special. They don't modify registers other than %rax
- and %r11 if they return. Therefore we don't have to preserve other
- registers around these calls. */
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- SINGLE_THREAD_P; \
- jne L(pseudo_cancel); \
- .type __##syscall_name##_nocancel,@function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- DO_CALL (syscall_name, args); \
- cmpq $-4095, %rax; \
- jae SYSCALL_ERROR_LABEL; \
- ret; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
- L(pseudo_cancel): \
- /* We always have to align the stack before calling a function. */ \
- subq $8, %rsp; cfi_adjust_cfa_offset (8); \
- CENABLE \
- /* The return value from CENABLE is argument for CDISABLE. */ \
- movq %rax, (%rsp); \
- DO_CALL (syscall_name, args); \
- movq (%rsp), %rdi; \
- /* Save %rax since it's the error code from the syscall. */ \
- movq %rax, %rdx; \
- CDISABLE \
- movq %rdx, %rax; \
- addq $8,%rsp; cfi_adjust_cfa_offset (-8); \
- cmpq $-4095, %rax; \
- jae SYSCALL_ERROR_LABEL; \
- L(pseudo_end):
-
-
# ifdef IS_IN_libpthread
-# define CENABLE call __pthread_enable_asynccancel;
-# define CDISABLE call __pthread_disable_asynccancel;
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE call __libc_enable_asynccancel;
-# define CDISABLE call __libc_disable_asynccancel;
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE call __librt_enable_asynccancel;
-# define CDISABLE call __librt_disable_asynccancel;
-# else
-# error Unsupported library
# endif
# if defined IS_IN_libpthread || !defined NOT_IN_libc
-# ifndef __ASSEMBLER__
extern int __local_multiple_threads attribute_hidden;
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (__local_multiple_threads == 0, 1)
-# else
-# define SINGLE_THREAD_P cmpl $0, __local_multiple_threads(%rip)
-# endif
# else
-# ifndef __ASSEMBLER__
# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P cmpl $0, %fs:MULTIPLE_THREADS_OFFSET
-# endif
-
# endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P (1)
# define NO_CANCELLATION 1
#endif
-#ifndef __ASSEMBLER__
# define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/sysdep-cancel.h
index db1cfdc04..181412c0c 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/sysdep-cancel.h
@@ -1,5 +1,4 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -17,142 +16,25 @@
#include <sysdep.h>
#include <tls.h>
-/* #include <pt-machine.h> */
#ifndef __ASSEMBLER__
# include <pthreadP.h>
#endif
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-#ifdef __ASSEMBLER__
-#if defined(__XTENSA_WINDOWED_ABI__)
-/* CENABLE/CDISABLE in PSEUDO below use call8, stack frame size must be
- * at least 32.
- */
-#if FRAMESIZE < 32
-#undef FRAMESIZE
-#define FRAMESIZE 32
-#endif
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- SINGLE_THREAD_P(a15); \
- bnez a15, .Lpseudo_cancel; \
- DO_CALL (syscall_name, args); \
- bgez a2, .Lpseudo_done; \
- movi a4, -4095; \
- blt a2, a4, .Lpseudo_done; \
- j SYSCALL_ERROR_LABEL; \
- .Lpseudo_done: \
- retw; \
- .Lpseudo_cancel: \
- /* The syscall args are in a2...a7; no need to save */ \
- CENABLE; \
- /* The return value is in a10 and preserved across the syscall */ \
- DO_CALL (syscall_name, args); \
- CDISABLE; \
- bgez a2, .Lpseudo_end; \
- movi a4, -4095; \
- blt a2, a4, .Lpseudo_end; \
- j SYSCALL_ERROR_LABEL; \
- .Lpseudo_end:
-
-# define CENABLE movi a8, CENABLE_FUNC; \
- callx8 a8
-# define CDISABLE movi a8, CDISABLE_FUNC; \
- callx8 a8
-#elif defined(__XTENSA_CALL0_ABI__)
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- SINGLE_THREAD_P(a10); \
- bnez a10, .Lpseudo_cancel; \
- DO_CALL (syscall_name, args); \
- bgez a2, .Lpseudo_done; \
- movi a4, -4095; \
- blt a2, a4, .Lpseudo_done; \
- j SYSCALL_ERROR_LABEL; \
- .Lpseudo_done: \
- ret; \
- .Lpseudo_cancel: \
- addi a1, a1, -32; \
- /* The syscall args are in a2...a7; save them */ \
- s32i a0, a1, 0; \
- s32i a2, a1, 4; \
- s32i a3, a1, 8; \
- s32i a4, a1, 12; \
- s32i a5, a1, 16; \
- s32i a6, a1, 20; \
- s32i a7, a1, 24; \
- CENABLE; \
- /* Move return value to a10 preserved across the syscall */ \
- mov a10, a2; \
- l32i a2, a1, 4; \
- l32i a3, a1, 8; \
- l32i a4, a1, 12; \
- l32i a5, a1, 16; \
- l32i a6, a1, 20; \
- l32i a7, a1, 24; \
- DO_CALL (syscall_name, args); \
- s32i a2, a1, 4; \
- mov a2, a10; \
- CDISABLE; \
- l32i a2, a1, 4; \
- l32i a0, a1, 0; \
- addi a1, a1, 32; \
- bgez a2, .Lpseudo_end; \
- movi a4, -4095; \
- blt a2, a4, .Lpseudo_end; \
- j SYSCALL_ERROR_LABEL; \
- .Lpseudo_end:
-
-# define CENABLE movi a0, CENABLE_FUNC; \
- callx0 a0
-# define CDISABLE movi a0, CDISABLE_FUNC; \
- callx0 a0
-#else
-#error Unsupported Xtensa ABI
-#endif
-#endif
-
# ifdef IS_IN_libpthread
-# define CENABLE_FUNC __pthread_enable_asynccancel
-# define CDISABLE_FUNC __pthread_disable_asynccancel
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE_FUNC __libc_enable_asynccancel
-# define CDISABLE_FUNC __libc_disable_asynccancel
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE_FUNC __librt_enable_asynccancel
-# define CDISABLE_FUNC __librt_disable_asynccancel
-# else
-# error Unsupported library
# endif
# if defined IS_IN_libpthread || !defined NOT_IN_libc
-# ifndef __ASSEMBLER__
extern int __local_multiple_threads attribute_hidden;
-# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
-# else
-# define SINGLE_THREAD_P(reg) movi reg, __local_multiple_threads; \
- l32i reg, reg, 0;
-# endif
-
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
# else
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P(reg) \
- rur reg, threadptr; \
- l32i reg, reg, MULTIPLE_THREADS_OFFSET;
-# endif
# endif
#else
@@ -163,9 +45,6 @@ extern int __local_multiple_threads attribute_hidden;
#endif
-
-#ifndef __ASSEMBLER__
# define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif