]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
config.gcc (hppa[12]*-*-hpux11*): Set extra_parts.
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Thu, 24 Feb 2011 23:02:14 +0000 (23:02 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Thu, 24 Feb 2011 23:02:14 +0000 (23:02 +0000)
* config.gcc (hppa[12]*-*-hpux11*): Set extra_parts.
* config/pa/stublib.c (pthread_default_stacksize_np, pthread_mutex_lock,
pthread_mutex_unlock, pthread_once): New pthread stubs.
* config/pa/t-pa-hpux11: Add rules to build pthread stubs.
* config/pa/t-pa64: Likewise.
* config/pa/pa-hpux11.h (LINK_GCC_C_SEQUENCE_SPEC): Define.
(LIB_SPEC): In static links, link against shared libc if not linking
against libpthread.
* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.

From-SVN: r170481

gcc/ChangeLog
gcc/config.gcc
gcc/config/pa/pa-hpux11.h
gcc/config/pa/pa64-hpux.h
gcc/config/pa/stublib.c
gcc/config/pa/t-pa-hpux11
gcc/config/pa/t-pa64

index 5056f07c48dc29901bec89b27eaddea5006be83c..3c940831657928c11064a96c9adc3752f9a264eb 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-24  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       * config.gcc (hppa[12]*-*-hpux11*): Set extra_parts.
+       * config/pa/stublib.c (pthread_default_stacksize_np, pthread_mutex_lock,
+       pthread_mutex_unlock, pthread_once): New pthread stubs.
+       * config/pa/t-pa-hpux11: Add rules to build pthread stubs.
+       * config/pa/t-pa64: Likewise.
+       * config/pa/pa-hpux11.h (LINK_GCC_C_SEQUENCE_SPEC): Define.
+       (LIB_SPEC): In static links, link against shared libc if not linking
+       against libpthread.
+       * config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
+
 2010-12-30  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        * config/pa/pa.md: Add ",*" condition to 64-bit add/subtract boolean
index 7a8c5d54b4c45585bf68d40b049926c7a754da13..2e5cf8eed6dd8de98b3814aa411c1364d25b5cbe 100644 (file)
@@ -1062,6 +1062,7 @@ hppa[12]*-*-hpux11*)
        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 8d4a807cbe316232073e4dc0266bed552d938c5d..4d486d501f5ac31736459f54c2782fb7b65ff161 100644 (file)
@@ -115,18 +115,24 @@ along with GCC; see the file COPYING3.  If not see
    -z %{mlinker-opt:-O} %{!shared:-u main -u __gcc_plt_call}\
    %{static:-a archive} %{shared:-b}"
 
-/* HP-UX 11 has posix threads.  HP libc contains pthread stubs so that
-   non-threaded applications can be linked with a thread-safe libc
-   without a subsequent loss of performance.  For more details, see
-   <http://docs.hp.com/en/1896/pthreads.html>.  */
+/* HP-UX 11 has posix threads.  HP's shared libc contains pthread stubs
+   so that non-threaded applications can be linked with a thread-safe
+   libc without a subsequent loss of performance.  For more details,
+   see <http://docs.hp.com/en/1896/pthreads.html>.  */
 #undef LIB_SPEC
 #define LIB_SPEC \
   "%{!shared:\
-     %{static|mt|pthread:%{fopenmp:%{static:-a archive_shared} -lrt\
-       %{static:-a archive}} -lpthread} -lc\
-     %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}}}\
+     %{fopenmp:%{static:-a archive_shared} -lrt %{static:-a archive}}\
+     %{mt|pthread:-lpthread} -lc\
+     %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}\
+       %{!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 4c909f0df66158eb174b03a48473f6fbd4dde11c..4248a7f638ab57e6ddb3b9001ee0d8b9578280cb 100644 (file)
@@ -57,36 +57,42 @@ along with GCC; see the file COPYING3.  If not see
 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
 #define LIB_SPEC \
   "%{!shared:\
-     %{!p:%{!pg:%{static|mt|pthread:%{fopenmp:%{static:-a shared} -lrt\
-                 %{static:-a archive}} -lpthread} -lc\
-           %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
+     %{!p:%{!pg:%{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\
+           %{mt|pthread:-lpthread} -lc\
+           %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
+               %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{p:%{!pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
           -lprof %{static:-a archive}\
-          %{static|mt|pthread:%{fopenmp:%{static:-a shared} -lrt\
-            %{static:-a archive}} -lpthread} -lc\
-          %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
+          %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\
+          %{mt|pthread:-lpthread} -lc\
+          %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
+               %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
        -lgprof %{static:-a archive}\
-       %{static|mt|pthread:%{fopenmp:%{static:-a shared} -lrt\
-        %{static:-a archive}} -lpthread} -lc\
-       %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
+       %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\
+       %{mt|pthread:-lpthread} -lc\
+       %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
+               %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
    %{shared:%{mt|pthread:-lpthread}}"
 #else
 #define LIB_SPEC \
   "%{!shared:\
-     %{!p:%{!pg:%{static|mt|pthread:%{fopenmp:%{static:-a shared} -lrt\
-                 %{static:-a archive}} -lpthread} -lc\
-           %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
+     %{!p:%{!pg:%{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\
+           %{mt|pthread:-lpthread} -lc\
+           %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
+               %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{p:%{!pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
           -lprof %{static:-a archive}\
-          %{static|mt|pthread:%{fopenmp:%{static:-a shared} -lrt\
-            %{static:-a archive}} -lpthread} -lc\
-          %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
+          %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\
+          %{mt|pthread:-lpthread} -lc\
+          %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
+               %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
        -lgprof %{static:-a archive}\
-       %{static|mt|pthread:%{fopenmp:%{static:-a shared} -lrt\
-        %{static:-a archive}} -lpthread} -lc\
-       %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
+       %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\
+       %{mt|pthread:-lpthread} -lc\
+       %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
+               %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
    %{shared:%{mt|pthread:-lpthread}}"
 #endif
 
index b3c412eb675cdecf32a107c6ce21b6a546de13cf..9ec55a8ac34cf08745fece0ade2d789489152f45 100644 (file)
@@ -61,3 +61,42 @@ _Jv_RegisterClasses (void *p)
 {
 }
 #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 * __attribute__((unused)));
+int
+pthread_mutex_lock (void *p)
+{
+  return 0;
+}
+#endif
+
+#ifdef L_pthread_mutex_unlock
+int pthread_mutex_unlock (void * __attribute__((unused)));
+int
+pthread_mutex_unlock (void *p)
+{
+  return 0;
+}
+#endif
+
+#ifdef L_pthread_once
+int pthread_once (void);
+int
+pthread_once (void)
+{
+  return 0;
+}
+#endif
index f36a75cb9c5e56e6eec3976cbd9ea9d1b8096165..3b830fdefaa2851155af33595534c03288b89741 100644 (file)
@@ -1,2 +1,31 @@
 TARGET_LIBGCC2_CFLAGS = -fPIC
 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 9fd9607eb9982c4f592afa55d979b7d21425a56e..558a2a8e2943681a5a9718683bb46cae891a3fe4 100644 (file)
@@ -1,6 +1,10 @@
 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
@@ -22,6 +26,22 @@ jvrc-stub.o: stublib.c $(GCC_PASSES)
        $(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)