Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
aa837470
Commit
aa837470
authored
Feb 02, 2011
by
Janne Blomqvist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PR 47571 Weakref trickery for clock_gettime()
From-SVN: r169517
parent
e829c321
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
13 deletions
+42
-13
libgfortran/ChangeLog
+9
-0
libgfortran/configure
+2
-2
libgfortran/configure.ac
+3
-3
libgfortran/intrinsics/time_1.h
+28
-8
No files found.
libgfortran/ChangeLog
View file @
aa837470
2011-02-02 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/47571
* configure: Regenerated.
* configure.ac: Don't add librt to LIBS.
* intrinsics/time_1.h (weak_gettime): Weakref trickery for
clock_gettime().
(gf_gettime): Use weak_gettime() instead of clock_gettime().
2011-02-01 Janne Blomqvist <jb@gcc.gnu.org>
* intrinsics/time_1.h: Include errno.h needed by fallbacks.
...
...
libgfortran/configure
View file @
aa837470
...
...
@@ -25262,7 +25262,8 @@ fi
# At least for glibc, clock_gettime is in librt. But don't pull that
# in if it still doesn't give us the function we want.
# This test is copied from libgomp.
# This test is copied from libgomp, and modified to not link in -lrt
# as libgfortran calls clock_gettime via a weak reference.
if
test
$ac_cv_func_clock_gettime
=
no
;
then
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for clock_gettime in -lrt"
>
&5
$as_echo_n
"checking for clock_gettime in -lrt... "
>
&6
;
}
...
...
@@ -25304,7 +25305,6 @@ fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_lib_rt_clock_gettime
"
>
&5
$as_echo
"
$ac_cv_lib_rt_clock_gettime
"
>
&6
;
}
if
test
"x
$ac_cv_lib_rt_clock_gettime
"
=
x
""
yes
;
then
:
LIBS
=
"-lrt
$LIBS
"
$as_echo
"#define HAVE_CLOCK_GETTIME 1"
>>
confdefs.h
...
...
libgfortran/configure.ac
View file @
aa837470
...
...
@@ -486,11 +486,11 @@ AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENA
# At least for glibc, clock_gettime is in librt. But don't pull that
# in if it still doesn't give us the function we want.
# This test is copied from libgomp.
# This test is copied from libgomp, and modified to not link in -lrt
# as libgfortran calls clock_gettime via a weak reference.
if test $ac_cv_func_clock_gettime = no; then
AC_CHECK_LIB(rt, clock_gettime,
[LIBS="-lrt $LIBS"
AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
[AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
[Define to 1 if you have the `clock_gettime' function.])])
fi
...
...
libgfortran/intrinsics/time_1.h
View file @
aa837470
...
...
@@ -189,6 +189,22 @@ gf_cputime (long *user_sec, long *user_usec, long *system_sec, long *system_usec
#define GF_CLOCK_MONOTONIC GF_CLOCK_REALTIME
#endif
/* Weakref trickery for clock_gettime(). On Glibc, clock_gettime()
requires us to link in librt, which also pulls in libpthread. In
order to avoid this by default, only call clock_gettime() through a
weak reference. */
#ifdef HAVE_CLOCK_GETTIME
#ifdef SUPPORTS_WEAK
static
int
weak_gettime
(
clockid_t
,
struct
timespec
*
)
__attribute__
((
__weakref__
(
"clock_gettime"
)));
#else
static
inline
int
weak_gettime
(
clockid_t
clk_id
,
struct
timespec
*
res
)
{
return
clock_gettime
(
clk_id
,
res
);
}
#endif
#endif
/* Arguments:
clock_id - INPUT, must be either GF_CLOCK_REALTIME or GF_CLOCK_MONOTONIC
secs - OUTPUT, seconds
...
...
@@ -208,14 +224,18 @@ gf_gettime (int clock_id __attribute__((unused)), time_t * secs,
long
*
nanosecs
)
{
#ifdef HAVE_CLOCK_GETTIME
struct
timespec
ts
;
int
err
;
err
=
clock_gettime
(
clock_id
,
&
ts
);
*
secs
=
ts
.
tv_sec
;
if
(
nanosecs
)
*
nanosecs
=
ts
.
tv_nsec
;
return
err
;
#elif HAVE_GETTIMEOFDAY
if
(
weak_gettime
)
{
struct
timespec
ts
;
int
err
;
err
=
weak_gettime
(
clock_id
,
&
ts
);
*
secs
=
ts
.
tv_sec
;
if
(
nanosecs
)
*
nanosecs
=
ts
.
tv_nsec
;
return
err
;
}
#endif
#ifdef HAVE_GETTIMEOFDAY
struct
timeval
tv
;
int
err
;
err
=
gettimeofday
(
&
tv
,
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment