tile: add vDSO support for gettimeofday()

This commit is contained in:
Chris Metcalf 2012-10-26 09:21:08 -04:00
parent 19f1dd5f2d
commit d11260f86a
5 changed files with 114 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2012-10-26 Chris Metcalf <cmetcalf@tilera.com>
* sysdeps/unix/sysv/linux/tile/Makefile (sysdep_routines):
Include dl-vdso.
* sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h: New file.
* sysdeps/unix/sysv/linux/tile/gettimeofday.c: New file.
* sysdeps/unix/sysv/linux/tile/init-first.c: New file.
2012-10-19 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist:

View File

@ -13,3 +13,7 @@ sysdep_headers += sys/dataplane.h
sysdep_routines += set_dataplane
endif
ifeq ($(subdir),elf)
sysdep_routines += dl-vdso
endif

View File

@ -0,0 +1,30 @@
/* Resolve function pointers to VDSO functions.
Copyright (C) 2012 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/>. */
#ifndef _LIBC_VDSO_H
#define _LIBC_VDSO_H
#ifdef SHARED
extern long int (*__vdso_gettimeofday) (struct timeval *, void *)
attribute_hidden;
#endif
#endif /* _LIBC_VDSO_H */

View File

@ -0,0 +1,38 @@
/* Copyright (C) 2012 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>
#include <stddef.h>
#include <sys/time.h>
#include <time.h>
#undef __gettimeofday
#include <bits/libc-vdso.h>
int
__gettimeofday (struct timeval *tv, struct timezone *tz)
{
#ifdef SHARED
/* If the vDSO is available we use it. */
if (__vdso_gettimeofday != NULL)
return __vdso_gettimeofday (tv, tz);
#endif
return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
}
strong_alias (__gettimeofday, __gettimeofday_internal)
weak_alias (__gettimeofday, gettimeofday)

View File

@ -0,0 +1,34 @@
/* Copyright (C) 2012 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/>. */
#ifdef SHARED
#include <dl-vdso.h>
#include <bits/libc-vdso.h>
long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden;
static inline void
_libc_vdso_platform_setup (void)
{
PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
__vdso_gettimeofday = _dl_vdso_vsym ("__vdso_gettimeofday", &linux26);
}
#define VDSO_SETUP _libc_vdso_platform_setup
#endif
#include "../init-first.c"