mirror of git://git.musl-libc.org/musl
workaround for gcc's optimizer breaking dynamic symbol resolution
This commit is contained in:
parent
6ab444d97a
commit
e91c375fd0
|
@ -5,7 +5,7 @@
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
|
|
||||||
int __vdso_clock_gettime(clockid_t, struct timespec *) __attribute__((weak));
|
int __vdso_clock_gettime(clockid_t, struct timespec *) __attribute__((weak));
|
||||||
static int (*const cgt)(clockid_t, struct timespec *) = __vdso_clock_gettime;
|
static int (*cgt)(clockid_t, struct timespec *) = __vdso_clock_gettime;
|
||||||
|
|
||||||
int __clock_gettime(clockid_t clk, struct timespec *ts)
|
int __clock_gettime(clockid_t clk, struct timespec *ts)
|
||||||
{
|
{
|
||||||
|
@ -14,6 +14,7 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
|
||||||
r = __syscall(SYS_clock_gettime, clk, ts);
|
r = __syscall(SYS_clock_gettime, clk, ts);
|
||||||
if (!r) return r;
|
if (!r) return r;
|
||||||
if (r == -ENOSYS) {
|
if (r == -ENOSYS) {
|
||||||
|
cgt = 0;
|
||||||
if (clk == CLOCK_REALTIME) {
|
if (clk == CLOCK_REALTIME) {
|
||||||
__syscall(SYS_gettimeofday, clk, ts, 0);
|
__syscall(SYS_gettimeofday, clk, ts, 0);
|
||||||
ts->tv_nsec = (int)ts->tv_nsec * 1000;
|
ts->tv_nsec = (int)ts->tv_nsec * 1000;
|
||||||
|
|
Loading…
Reference in New Issue