diff options
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/Versions | 11 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h | 45 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/init-first.c | 74 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/m68k-helpers.S | 95 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/m68k-helpers.c | 26 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/m68k-vdso.c | 34 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/m68k-vdso.h | 60 |
9 files changed, 27 insertions, 321 deletions
diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile index ce1f696a6f..be40fae68a 100644 --- a/sysdeps/unix/sysv/linux/m68k/Makefile +++ b/sysdeps/unix/sysv/linux/m68k/Makefile @@ -18,8 +18,6 @@ endif ifeq ($(subdir),elf) sysdep-dl-routines += dl-static -sysdep_routines += dl-vdso libc-m68k-vdso -sysdep-rtld-routines += m68k-vdso sysdep-others += lddlibc4 install-bin += lddlibc4 endif diff --git a/sysdeps/unix/sysv/linux/m68k/Versions b/sysdeps/unix/sysv/linux/m68k/Versions index 7ecc96ea97..8e72cd18cb 100644 --- a/sysdeps/unix/sysv/linux/m68k/Versions +++ b/sysdeps/unix/sysv/linux/m68k/Versions @@ -40,15 +40,4 @@ libc { GLIBC_2.12 { __m68k_read_tp; } - GLIBC_PRIVATE { - __vdso_atomic_cmpxchg_32; __vdso_atomic_barrier; - } -} - -ld { - GLIBC_PRIVATE { - __rtld___vdso_read_tp; - __rtld___vdso_atomic_cmpxchg_32; - __rtld___vdso_atomic_barrier; - } } diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h b/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h index 7465a98fef..0a2aa9ffa5 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h @@ -21,7 +21,6 @@ #include <stdint.h> #include <sysdep.h> -#include <m68k-vdso.h> /* Coldfire has no atomic compare-and-exchange operation, but the kernel provides userspace atomicity operations. Use them. */ @@ -43,33 +42,7 @@ typedef uintmax_t uatomic_max_t; #define ATOMIC_EXCHANGE_USES_CAS 1 /* The only basic operation needed is compare and exchange. */ -/* For ColdFire we'll have to trap into the kernel mode anyway, - so trap from the library rather then from the kernel wrapper. */ -#ifdef SHARED -# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ - ({ \ - /* Use temporary variables to workaround call-clobberness of \ - the registers. */ \ - __typeof (mem) _mem = mem; \ - __typeof (oldval) _oldval = oldval; \ - __typeof (newval) _newval = newval; \ - register uint32_t *_a0 asm ("a0") = (uint32_t *) _mem; \ - register uint32_t _d0 asm ("d0") = (uint32_t) _oldval; \ - register uint32_t _d1 asm ("d1") = (uint32_t) _newval; \ - void *tmp; \ - \ - asm ("movel #_GLOBAL_OFFSET_TABLE_@GOTPC, %2\n\t" \ - "lea (-6, %%pc, %2), %2\n\t" \ - "movel " STR_M68K_VDSO_SYMBOL (__vdso_atomic_cmpxchg_32) \ - "@GOT(%2), %2\n\t" \ - "movel (%2), %2\n\t" \ - "jsr (%2)\n\t" \ - : "+d" (_d0), "+m" (*_a0), "=&a" (tmp) \ - : "a" (_a0), "d" (_d1)); \ - (__typeof (oldval)) _d0; \ - }) -#else -# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ ({ \ /* Use temporary variables to workaround call-clobberness of \ the registers. */ \ @@ -86,24 +59,8 @@ typedef uintmax_t uatomic_max_t; : "a" (_a0), "d" (_d2), "d" (_d1)); \ (__typeof (oldval)) _d0; \ }) -#endif -#ifdef SHARED -# define atomic_full_barrier() \ - ({ \ - void *tmp; \ - \ - asm ("movel #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t" \ - "lea (-6, %pc, %0), %0\n\t" \ - "movel " STR_M68K_VDSO_SYMBOL (__vdso_atomic_barrier) \ - "@GOT(%0), %0\n\t" \ - "movel (%0), %0\n\t" \ - "jsr (%0)\n\t" \ - : "=&a" (tmp)); \ - }) -#else # define atomic_full_barrier() \ (INTERNAL_SYSCALL (atomic_barrier, , 0), (void) 0) -#endif #endif diff --git a/sysdeps/unix/sysv/linux/m68k/init-first.c b/sysdeps/unix/sysv/linux/m68k/init-first.c deleted file mode 100644 index f8f0910839..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/init-first.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. Linux/m68k. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -/* Note: linking in vDSO to a static binary requires changes to - the main GLIBC proper. Not yet implemented. */ -#ifdef SHARED - -#include <dl-vdso.h> -#include <m68k-vdso.h> - -static inline void -_libc_vdso_platform_setup (void) -{ - void *p; - - PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); - - /* It may happen that rtld didn't initialize the vDSO, so fallback - to the syscall implementations if _dl_vdso_vsym returns NULL. - This may happen when a static executable dlopen's a dynamic library. - This really is nothing more than a workaround for rtld/csu - deficiency. Ideally, init code would setup the vDSO for static - binaries too. */ - - p = _dl_vdso_vsym ("__kernel_read_tp", &linux26); - if (p != NULL) - { - __vdso_read_tp = p; - __rtld___vdso_read_tp = p; - } - else - assert (__vdso_read_tp == (void *) __vdso_read_tp_stub); - - p = _dl_vdso_vsym ("__kernel_atomic_cmpxchg_32", &linux26); - if (p != NULL) - { - __vdso_atomic_cmpxchg_32 = p; - __rtld___vdso_atomic_cmpxchg_32 = p; - } - else - assert (__vdso_atomic_cmpxchg_32 - == (void *) __vdso_atomic_cmpxchg_32_stub); - - p = _dl_vdso_vsym ("__kernel_atomic_barrier", &linux26); - if (p != NULL) - { - __vdso_atomic_barrier = p; - __rtld___vdso_atomic_barrier = p; - } - else - assert (__vdso_atomic_barrier == (void *) __vdso_atomic_barrier_stub); -} - -#define VDSO_SETUP _libc_vdso_platform_setup - -#endif /* SHARED */ - -#include <csu/init-first.c> diff --git a/sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c b/sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c deleted file mode 100644 index 45982e99b9..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c +++ /dev/null @@ -1 +0,0 @@ -#include "m68k-vdso.c" diff --git a/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S b/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S deleted file mode 100644 index 5e3ffb0a7f..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010. - - The GNU C Library is free software; you can redistribute it and/or - 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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <m68k-vdso.h> - - .text - - .hidden __vdso_read_tp_stub -ENTRY (__vdso_read_tp_stub) - move.l #__NR_get_thread_area, %d0 - trap #0 - move.l %d0, %a0 - rts -END (__vdso_read_tp_stub) - -# ifdef SHARED -/* GCC will emit calls to this routine. Linux has an - equivalent helper function (which clobbers fewer registers than - a normal function call) in a vdso; tail call to the - helper. */ -# if IS_IN (rtld) -/* rtld gets a hidden copy of __m68k_read_tp. */ - .hidden __m68k_read_tp -# endif -ENTRY (__m68k_read_tp) - LOAD_GOT (%a0) - move.l M68K_VDSO_SYMBOL (__vdso_read_tp)@GOT(%a0), %a0 - move.l (%a0), %a0 - jmp (%a0) -END (__m68k_read_tp) - -/* The following two stubs are for macros in atomic.h, they can't - clobber anything. */ - - .hidden __vdso_atomic_cmpxchg_32_stub -ENTRY (__vdso_atomic_cmpxchg_32_stub) - move.l %d2, -(%sp) - cfi_adjust_cfa_offset (4) - cfi_rel_offset (%d2, 0) - move.l %d0, %d2 - move.l #SYS_ify (atomic_cmpxchg_32), %d0 - trap #0 - move.l (%sp)+, %d2 - cfi_adjust_cfa_offset (-4) - cfi_restore (%d2) - rts -END (__vdso_atomic_cmpxchg_32_stub) - - .hidden __vdso_atomic_barrier_stub -ENTRY (__vdso_atomic_barrier_stub) - move.l %d0, -(%sp) - cfi_adjust_cfa_offset (4) - move.l #SYS_ify (atomic_barrier), %d0 - trap #0 - move.l (%sp)+, %d0 - cfi_adjust_cfa_offset (-4) - rts -END (__vdso_atomic_barrier_stub) -# else /* !SHARED */ -/* If the vDSO is not available, use a syscall to get TP. */ - strong_alias (__vdso_read_tp_stub, __m68k_read_tp) -# endif /* SHARED */ diff --git a/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c b/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c new file mode 100644 index 0000000000..df02d560aa --- /dev/null +++ b/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2019 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 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> + +void * +__m68k_read_tp (void) +{ + INTERNAL_SYSCALL_DECL (err); + return (void*) INTERNAL_SYSCALL_CALL (get_thread_area, err); +} diff --git a/sysdeps/unix/sysv/linux/m68k/m68k-vdso.c b/sysdeps/unix/sysv/linux/m68k/m68k-vdso.c deleted file mode 100644 index a1345a3a5b..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/m68k-vdso.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#ifdef SHARED - -#include <m68k-vdso.h> - -/* Because these pointers are used from other libraries than libc, - they are exported at GLIBC_PRIVATE version. - We initialize them to syscall implementation so that they will be ready - to use from the very beginning. */ -void * M68K_VDSO_SYMBOL (__vdso_read_tp) -= (void *) __vdso_read_tp_stub; -void * M68K_VDSO_SYMBOL (__vdso_atomic_cmpxchg_32) -= (void *) __vdso_atomic_cmpxchg_32_stub; -void * M68K_VDSO_SYMBOL (__vdso_atomic_barrier) -= (void *) __vdso_atomic_barrier_stub; - -#endif /* SHARED */ diff --git a/sysdeps/unix/sysv/linux/m68k/m68k-vdso.h b/sysdeps/unix/sysv/linux/m68k/m68k-vdso.h deleted file mode 100644 index fc71c0f4e1..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/m68k-vdso.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Resolve function pointers to VDSO functions. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - - -#ifndef _M68K_VDSO_H -#define _M68K_VDSO_H - -#ifdef SHARED - -# if IS_IN (rtld) -# define M68K_VDSO_SYMBOL(name) __rtld_##name -# define STR_M68K_VDSO_SYMBOL(name) "__rtld_" #name -# else -# define M68K_VDSO_SYMBOL(name) name -# define STR_M68K_VDSO_SYMBOL(name) #name -# endif - -# ifndef __ASSEMBLER__ - -/* We define __rtld_* copies for rtld. - We need them visible in libc to initialize. */ -# if IS_IN (rtld) || IS_IN (libc) -extern void *__rtld___vdso_read_tp; -extern void *__rtld___vdso_atomic_cmpxchg_32; -extern void *__rtld___vdso_atomic_barrier; - -/* These stubs are meant to be invoked only from the assembly. */ -extern void __vdso_read_tp_stub (void); -extern void __vdso_atomic_cmpxchg_32_stub (void); -extern void __vdso_atomic_barrier_stub (void); -# endif /* IS_IN (rtld) || IS_IN (libc) */ - -/* RTLD should only use its own copies. */ -# if !IS_IN (rtld) -extern void *__vdso_read_tp; -extern void *__vdso_atomic_cmpxchg_32; -extern void *__vdso_atomic_barrier; -# endif /* !IS_IN (rtld) */ - -# endif /* !__ASSEMBLER__ */ - -#endif /* SHARED */ - -#endif /* _M68K_VDSO_H */ |