diff mbox

[committed] Reinstate pthread stubs needed for build GCC on hppa-hpux11 with old libc.sl

Message ID 20110218212557.GA17396@hiauly1.hia.nrc.ca
State New
Headers show

Commit Message

John David Anglin Feb. 18, 2011, 9:25 p.m. UTC
It seems I was too agressive in removing the pthread stubs needed to
build GCC with old versions of libc.sl on HP-UX 11.  I forgot that
old versions of libc.sl don't have pthread stubs, and some people
still have the old library.

Tested on hppa64-hp-hpux11.11 and hppa2.0w-hp-hpux11.11 by building
with libc.a which doesn't contain pthread stubs.

Committed to trunk.

Dave
diff mbox

Patch

Index: config.gcc
===================================================================
--- config.gcc	(revision 170274)
+++ config.gcc	(working copy)
@@ -1165,6 +1165,7 @@ 
 	else
 	    tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
 	fi
+	extra_parts="libgcc_stub.a"
 	case x${enable_threads} in
 	x | xyes | xposix )
 		thread_file=posix
Index: config/pa/t-pa-hpux11
===================================================================
--- config/pa/t-pa-hpux11	(revision 170274)
+++ config/pa/t-pa-hpux11	(working copy)
@@ -1,2 +1,31 @@ 
 TARGET_LIBGCC2_CFLAGS = -fPIC -frandom-seed=fixed-seed
 LIB2FUNCS_EXTRA=lib2funcs.asm quadlib.c
+LIBGCCSTUB_OBJS = pthread_default_stacksize_np-stub.o \
+	pthread_mutex_lock-stub.o \
+	pthread_mutex_unlock-stub.o \
+	pthread_once-stub.o
+
+stublib.c: $(srcdir)/config/pa/stublib.c
+	rm -f stublib.c
+	cp $(srcdir)/config/pa/stublib.c .
+
+pthread_default_stacksize_np-stub.o: stublib.c $(GCC_PASSES)
+	$(GCC_FOR_TARGET) -c -O2 -DL_pthread_default_stacksize_np stublib.c \
+	  -o pthread_default_stacksize_np-stub.o
+
+pthread_mutex_lock-stub.o: stublib.c $(GCC_PASSES)
+	$(GCC_FOR_TARGET) -c -O2 -DL_pthread_mutex_lock stublib.c \
+	  -o pthread_mutex_lock-stub.o
+
+pthread_mutex_unlock-stub.o: stublib.c $(GCC_PASSES)
+	$(GCC_FOR_TARGET) -c -O2 -DL_pthread_mutex_unlock stublib.c \
+	  -o pthread_mutex_unlock-stub.o
+
+pthread_once-stub.o: stublib.c $(GCC_PASSES)
+	$(GCC_FOR_TARGET) -c -O2 -DL_pthread_once stublib.c \
+	  -o pthread_once-stub.o
+
+$(T)libgcc_stub.a: $(LIBGCCSTUB_OBJS)
+	-rm -rf $(T)libgcc_stub.a
+	$(AR) rc $(T)libgcc_stub.a $(LIBGCCSTUB_OBJS)
+	$(RANLIB) $(T)libgcc_stub.a
Index: config/pa/pa-hpux11.h
===================================================================
--- config/pa/pa-hpux11.h	(revision 170274)
+++ config/pa/pa-hpux11.h	(working copy)
@@ -127,6 +127,11 @@ 
        %{!mt:%{!pthread:-a shared -lc -a archive}}}}\
    %{shared:%{mt|pthread:-lpthread}}"
 
+/* The libgcc_stub.a library needs to come last.  */
+#undef LINK_GCC_C_SEQUENCE_SPEC
+#define LINK_GCC_C_SEQUENCE_SPEC \
+  "%G %L %G %{!nostdlib:%{!nodefaultlibs:%{!shared:-lgcc_stub}}}"
+
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC \
   "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}} \
Index: config/pa/t-pa64
===================================================================
--- config/pa/t-pa64	(revision 170274)
+++ config/pa/t-pa64	(working copy)
@@ -19,7 +19,11 @@ 
 
 TARGET_LIBGCC2_CFLAGS = -fPIC -Dpa64=1 -DELF=1 -mlong-calls
 LIB2FUNCS_EXTRA = quadlib.c
-LIBGCCSTUB_OBJS = rfi-stub.o dfi-stub.o jvrc-stub.o cxaf-stub.o
+LIBGCCSTUB_OBJS = rfi-stub.o dfi-stub.o jvrc-stub.o cxaf-stub.o \
+	pthread_default_stacksize_np-stub.o \
+	pthread_mutex_lock-stub.o \
+	pthread_mutex_unlock-stub.o \
+	pthread_once-stub.o
 
 stublib.c: $(srcdir)/config/pa/stublib.c
 	rm -f stublib.c
@@ -41,6 +45,22 @@ 
 	$(GCC_FOR_TARGET) -c -O2 -DL_Jv_RegisterClasses stublib.c \
 	  -o jvrc-stub.o
 
+pthread_default_stacksize_np-stub.o: stublib.c $(GCC_PASSES)
+	$(GCC_FOR_TARGET) -c -O2 -DL_pthread_default_stacksize_np stublib.c \
+	  -o pthread_default_stacksize_np-stub.o
+
+pthread_mutex_lock-stub.o: stublib.c $(GCC_PASSES)
+	$(GCC_FOR_TARGET) -c -O2 -DL_pthread_mutex_lock stublib.c \
+	  -o pthread_mutex_lock-stub.o
+
+pthread_mutex_unlock-stub.o: stublib.c $(GCC_PASSES)
+	$(GCC_FOR_TARGET) -c -O2 -DL_pthread_mutex_unlock stublib.c \
+	  -o pthread_mutex_unlock-stub.o
+
+pthread_once-stub.o: stublib.c $(GCC_PASSES)
+	$(GCC_FOR_TARGET) -c -O2 -DL_pthread_once stublib.c \
+	  -o pthread_once-stub.o
+
 $(T)libgcc_stub.a: $(LIBGCCSTUB_OBJS)
 	-rm -rf $(T)libgcc_stub.a
 	$(AR) rc $(T)libgcc_stub.a $(LIBGCCSTUB_OBJS)
Index: config/pa/stublib.c
===================================================================
--- config/pa/stublib.c	(revision 170274)
+++ config/pa/stublib.c	(working copy)
@@ -56,3 +56,42 @@ 
 {
 }
 #endif
+
+#ifdef L_pthread_default_stacksize_np
+int pthread_default_stacksize_np (unsigned long __attribute__((unused)),
+				  unsigned long *);
+int
+pthread_default_stacksize_np (unsigned long new, unsigned long *old)
+{
+  if (old)
+    *old = 0;
+  return 0;
+}
+#endif
+
+#ifdef L_pthread_mutex_lock
+int pthread_mutex_lock (void);
+int
+pthread_mutex_lock (void)
+{
+  return 0;
+}
+#endif
+
+#ifdef L_pthread_mutex_unlock
+int pthread_mutex_unlock (void);
+int
+pthread_mutex_unlock (void)
+{
+  return 0;
+}
+#endif
+
+#ifdef L_pthread_once
+int pthread_once (void);
+int
+pthread_once (void)
+{
+  return 0;
+}
+#endif