[Bug bootstrap/11313] New: #pragma weak and static inline functions

georgaj at navcanada dot ca gcc-bugzilla@gcc.gnu.org
Tue Jun 24 20:44:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: #pragma weak and static inline functions
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: bootstrap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: georgaj at navcanada dot ca
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: hppa64-hp-hpux11.00
  GCC host triplet: hppa64-hp-hpux11.00
GCC target triplet: hppa64-hp-hpux11.00

When bootstrapping with pthread support, the compiler complains that 
pthread_create() must be public in order to be declared as a weak symbol using 
#pragma weak. The problem is that the sys/pthread.h that comes with HPUX11.00 
has the following code in it:

	static int pthread_create( 
				  pthread_t *tid, 
				  const pthread_attr_t *attr,
                                  void *(*start_routine)(void *), 
				  void *arg)
	    { return(__pthread_create_system(tid, attr, start_routine, arg)); }

This function just redirects to the "real" pthread creation function.

Removing the static modifier gets rid of the visibility error, but then the 
compiler complains that the weak declaration must precede the function 
definition.

Hack: I commented out the "#pragma weak" line for pthread_create() in 
gthr-posix.h, but I'm not sure what the consequences of this are.

I'm kind of missing the point of these pragmas. Are they there so gcc, 
configured for pthread support, will bootstrap whether or not the host actually 
has pthread support?



More information about the Gcc-bugs mailing list