mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-11 05:40:06 +00:00
b39d84adff
This patch adds support for using the implementations of gettimeofday() and clock_gettime() provided by the kernel in the VDSO. The VDSO will always provide clock_gettime() as CLOCK_{REALTIME,MONOTONIC}_COARSE can be implemented regardless of platform. CLOCK_{REALTIME,MONOTONIC}, along with gettimeofday(), are only implemented on platforms which make use of either the CP0 count or GIC as their clocksource. On other platforms, the VDSO does not provide the __vdso_gettimeofday symbol, as it is never useful. The VDSO functions return ENOSYS when they encounter an unsupported request, in which case glibc should fall back to the standard syscall. Tested with upstream kernel 4.5 and QEMU emulating Malta. ./vdsotest gettimeofday bench gettimeofday: syscall: 1021 nsec/call gettimeofday: libc: 262 nsec/call gettimeofday: vdso: 174 nsec/call * sysdeps/unix/sysv/linux/mips/Makefile (sysdep_routines): Include dl-vdso. * sysdeps/unix/sysv/linux/mips/Versions: Add __vdso_clock_gettime. * sysdeps/unix/sysv/linux/mips/init-first.c: New file. * sysdeps/unix/sysv/linux/mips/libc-vdso.h: New file. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: (INTERNAL_VSYSCALL_CALL): Define to be compatible with MIPS definitions of INTERNAL_SYSCALL_{ERROR_P,ERRNO}. (HAVE_CLOCK_GETTIME_VSYSCALL): Define. (HAVE_GETTIMEOFDAY_VSYSCALL): Define. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Likewise.
107 lines
3.9 KiB
Makefile
107 lines
3.9 KiB
Makefile
ifeq ($(subdir),signal)
|
|
#sysdep_routines += sigsuspend
|
|
endif
|
|
|
|
ifeq ($(subdir),misc)
|
|
sysdep_routines += cachectl cacheflush sysmips _test_and_set
|
|
|
|
sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
|
|
endif
|
|
|
|
abi-variants := o32_soft o32_hard o32_soft_2008 o32_hard_2008
|
|
abi-variants += n32_soft n32_hard n32_soft_2008 n32_hard_2008
|
|
abi-variants += n64_soft n64_hard n64_soft_2008 n64_hard_2008
|
|
|
|
ifeq (,$(filter $(default-abi),$(abi-variants)))
|
|
Unknown ABI, must be one of $(abi-variants)
|
|
endif
|
|
|
|
abi-includes := sgidefs.h
|
|
|
|
# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3
|
|
abi-o32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
|
|
-D__mips_soft_float -U__mips_hard_float \
|
|
-U__mips_nan2008
|
|
abi-o32_soft-condition := !defined(__mips_nan2008) \
|
|
&& defined(__mips_soft_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_ABI32)
|
|
abi-o32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
|
|
-D__mips_hard_float -U__mips_soft_float \
|
|
-U__mips_nan2008
|
|
abi-o32_hard-condition := !defined(__mips_nan2008) \
|
|
&& defined(__mips_hard_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_ABI32)
|
|
abi-o32_soft_2008-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
|
|
-D__mips_soft_float -U__mips_hard_float \
|
|
-D__mips_nan2008
|
|
abi-o32_soft_2008-condition := defined(__mips_nan2008) \
|
|
&& defined(__mips_soft_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_ABI32)
|
|
abi-o32_hard_2008-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
|
|
-D__mips_hard_float -U__mips_soft_float \
|
|
-D__mips_nan2008
|
|
abi-o32_hard_2008-condition := defined(__mips_nan2008) \
|
|
&& defined(__mips_hard_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_ABI32)
|
|
abi-n32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
|
|
-D__mips_soft_float -U__mips_hard_float \
|
|
-U__mips_nan2008
|
|
abi-n32_soft-condition := !defined(__mips_nan2008) \
|
|
&& defined(__mips_soft_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_NABI32)
|
|
abi-n32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
|
|
-D__mips_hard_float -U__mips_soft_float \
|
|
-U__mips_nan2008
|
|
abi-n32_hard-condition := !defined(__mips_nan2008) \
|
|
&& defined(__mips_hard_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_NABI32)
|
|
abi-n32_soft_2008-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
|
|
-D__mips_soft_float -U__mips_hard_float \
|
|
-D__mips_nan2008
|
|
abi-n32_soft_2008-condition := defined(__mips_nan2008) \
|
|
&& defined(__mips_soft_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_NABI32)
|
|
abi-n32_hard_2008-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
|
|
-D__mips_hard_float -U__mips_soft_float \
|
|
-D__mips_nan2008
|
|
abi-n32_hard_2008-condition := defined(__mips_nan2008) \
|
|
&& defined(__mips_hard_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_NABI32)
|
|
abi-n64_soft-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
|
|
-D__mips_soft_float -U__mips_hard_float \
|
|
-U__mips_nan2008
|
|
abi-n64_soft-condition := !defined(__mips_nan2008) \
|
|
&& defined(__mips_soft_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_ABI64)
|
|
abi-n64_hard-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
|
|
-D__mips_hard_float -U__mips_soft_float \
|
|
-U__mips_nan2008
|
|
abi-n64_hard-condition := !defined(__mips_nan2008) \
|
|
&& defined(__mips_hard_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_ABI64)
|
|
abi-n64_soft_2008-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
|
|
-D__mips_soft_float -U__mips_hard_float \
|
|
-D__mips_nan2008
|
|
abi-n64_soft_2008-condition := defined(__mips_nan2008) \
|
|
&& defined(__mips_soft_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_ABI64)
|
|
abi-n64_hard_2008-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
|
|
-D__mips_hard_float -U__mips_soft_float \
|
|
-D__mips_nan2008
|
|
abi-n64_hard_2008-condition := defined(__mips_nan2008) \
|
|
&& defined(__mips_hard_float) \
|
|
&& (_MIPS_SIM == _MIPS_SIM_ABI64)
|
|
|
|
ifeq ($(subdir),elf)
|
|
ifeq ($(build-shared),yes)
|
|
# This is needed for DSO loading from static binaries.
|
|
sysdep-dl-routines += dl-static
|
|
|
|
sysdep_routines += dl-vdso
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(subdir),stdlib)
|
|
gen-as-const-headers += ucontext_i.sym
|
|
endif
|