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 bootstrap/11313] New: #pragma weak and static inline functions


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?


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