This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/47571] [4.6 Regression] undefined reference to clock_gettime in Linux build of 02/01/2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47571

--- Comment #28 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-03-08 09:34:36 UTC ---
(In reply to comment #26)
> Tru64 UNIX doesn't support weak undefined symbols, which seems to be
> what weakrefs are.

Hmm, I think it is going to be difficult. What we want to have:

a) If libc has clock_gettime, use it unconditionally
b) If librt has clock_gettime and weak refs are supported, use it if
   available
c) If librt has it, but no weak refs are supported, don't use it.
d) If it not available at all, don't use it.

(b) and (d) work; also (a) works - albeit with a warning. Now one needs to
support (c). I think the best would be to set (effectively) HAVE_CLOCK_GETTIME
to false.

One possibility would be to replace:

#ifdef HAVE_CLOCK_GETTIME
#  ifdef SUPPORTS_WEAK
     ...
#  else

by

#if define(HAVE_CLOCK_GETTIME) && define(SUPPORTS_WEAK)

That would exclude platforms, where libc supports clock_gettime but which do
not have weak refs. Another possibility is a link-time check which does not
work well for some cross-compilations.

What do you think?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]