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

dave at hiauly1 dot hia.nrc.ca gcc-bugzilla@gcc.gnu.org
Thu Feb 3 15:33:00 GMT 2011


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

--- Comment #20 from dave at hiauly1 dot hia.nrc.ca 2011-02-03 15:33:37 UTC ---
> > on hppa2.0w-hp-hpux11.11.  Weak references don't work on this target and
> > probably others.
> 
> If weak symbols do not work, why is then SUPPORTS_WEAK set? (Or, if it isn't
> set, why does it fail?)

The situation is messy and difficult:

1) The backend defines TARGET_SUPPORTS_WEAK.  This is needed for C++.
   The support varies based on assembler, etc.

   The target has COMDAT and secondary symbol symbol support when GAS
   is used.  This allows for multiple definitions of functions and data.
   However, undefined weak symbols are not supported.  It is not possible
   to check whether a function is defined or not using a `if'.  A
   function pointer is actually a pointer to a function descriptor (plabel).

2) Libgfortran defines SUPPORTS_WEAK based on #pragma weak.  This is
   probably wrong for PA HP-UX.  There is a similar situation in
   gthr-posix.h where there is a mechanism to override SUPPORTS_WEAK.

3) I think the actual error was caused by the lack of a declaration
   for clock_gettime as a function.  The default symbol type is data.
   Was <time.h> included?

4) Because of 1, the `if' will always evaluate to true.  HP-UX has
   clock_gettime, so this shouldn't be a problem.

Dave



More information about the Gcc-bugs mailing list