This is the mail archive of the gcc-patches@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]

[PATCH] Add -lpthread even with -pthread -shared


Hi!

-lpthread needs to be added even when linking shared libs which use
threading, e.g. because of symbol versioning or for less prelink conflicts.
Ok to commit?

2002-12-10  Jakub Jelinek  <jakub@redhat.com>

	* config/linux.h (LIB_SPEC): If -pthread, add -lpthread even if
	-shared.
	* config/alpha/linux-elf.h (LIB_SPEC): Likewise.
	* config/alpha/linux.h (LIB_SPEC): Likewise.
	* config/arm/linux-elf.h (LIB_SPEC): Likewise.
	* config/pa/pa-linux.h (LIB_SPEC): Likewise.
	* config/sparc/linux.h (LIB_SPEC): Likewise.
	* config/sparc/linux64.h (LIB_SPEC): Likewise.

--- gcc/config/linux.h.jj	2002-09-30 17:32:59.000000000 +0200
+++ gcc/config/linux.h	2002-12-10 01:57:39.000000000 +0100
@@ -93,9 +93,9 @@ Boston, MA 02111-1307, USA.  */
      %{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}"
 #else
 #define LIB_SPEC \
-  "%{shared: -lc} \
-   %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
-	%{profile:-lc_p} %{!profile: -lc}}"
+  "%{pthread:-lpthread} \
+   %{shared:-lc} \
+   %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
 #endif
 #else
 #define LIB_SPEC \
--- gcc/config/alpha/linux-elf.h.jj	2002-05-09 22:04:06.000000000 +0200
+++ gcc/config/alpha/linux-elf.h	2002-12-10 01:57:38.000000000 +0100
@@ -45,5 +45,5 @@ Boston, MA 02111-1307, USA.  */
 #ifndef USE_GNULIBC_1
 #undef LIB_SPEC
 #define LIB_SPEC \
-"%{shared:-lc}%{!shared:%{pthread:-lpthread }%{profile:-lc_p}%{!profile:-lc}} "
+"%{pthread:-lpthread }%{shared:-lc}%{!shared:%{profile:-lc_p}%{!profile:-lc}} "
 #endif
--- gcc/config/alpha/linux.h.jj	2002-05-22 11:22:46.000000000 +0200
+++ gcc/config/alpha/linux.h	2002-12-10 01:57:38.000000000 +0100
@@ -37,9 +37,9 @@ Boston, MA 02111-1307, USA.  */
 
 #undef LIB_SPEC
 #define LIB_SPEC \
-  "%{shared: -lc} \
-   %{!shared: %{pthread:-lpthread} \
-              %{profile:-lc_p} %{!profile: -lc}}"
+  "%{pthread:-lpthread} \
+   %{shared:-lc} \
+   %{!shared: %{profile:-lc_p}%{!profile:-lc}}"
 
 /* Show that we need a GP when profiling.  */
 #undef TARGET_PROFILING_NEEDS_GP
--- gcc/config/arm/linux-elf.h.jj	2002-07-20 12:36:07.000000000 +0200
+++ gcc/config/arm/linux-elf.h	2002-12-10 01:57:38.000000000 +0100
@@ -48,9 +48,9 @@ Boston, MA 02111-1307, USA.  */
 
 /* Now we define the strings used to build the spec file.  */
 #define LIB_SPEC \
-  "%{shared: -lc} \
-   %{!shared: %{pthread:-lpthread} \
-   %{profile:-lc_p} %{!profile: -lc}}"
+  "%{pthread:-lpthread} \
+   %{shared:-lc} \
+   %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
 
 #define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
 
--- gcc/config/pa/pa-linux.h.jj	2002-11-14 00:54:23.000000000 +0100
+++ gcc/config/pa/pa-linux.h	2002-12-10 01:57:38.000000000 +0100
@@ -71,9 +71,9 @@ Boston, MA 02111-1307, USA.  */
 
 #undef	LIB_SPEC
 #define LIB_SPEC \
-  "%{shared: -lgcc -lc} \
-   %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
-	%{shared-libgcc: -lgcc} %{profile:-lc_p} %{!profile: -lc}}"
+  "%{pthread:-lpthread} \
+   %{shared:-lgcc -lc} \
+   %{!shared:%{mieee-fp:-lieee} %{shared-libgcc:-lgcc} %{profile:-lc_p}%{!profile:-lc}}"
 
 #undef ASM_SPEC
 #define ASM_SPEC \
--- gcc/config/sparc/linux.h.jj	2002-09-20 12:14:48.000000000 +0200
+++ gcc/config/sparc/linux.h	2002-12-10 01:57:38.000000000 +0100
@@ -123,9 +123,9 @@ Boston, MA 02111-1307, USA.  */
      %{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}"
 #else
 #define LIB_SPEC \
-  "%{shared: -lc} \
-   %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
-     %{profile:-lc_p} %{!profile: -lc}}"
+  "%{pthread:-lpthread} \
+   %{shared:-lc} \
+   %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
 #endif
 #else
 #define LIB_SPEC \
--- gcc/config/sparc/linux64.h.jj	2002-10-03 21:21:03.000000000 +0200
+++ gcc/config/sparc/linux64.h	2002-12-10 01:57:39.000000000 +0100
@@ -124,9 +124,9 @@ Boston, MA 02111-1307, USA.  */
 
 #undef LIB_SPEC
 #define LIB_SPEC \
-  "%{shared: -lc} \
-   %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
-     %{profile:-lc_p} %{!profile: -lc}}"
+  "%{pthread:-lpthread} \
+   %{shared:-lc} \
+   %{!shared: %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
 
 /* Provide a LINK_SPEC appropriate for GNU/Linux.  Here we provide support
    for the special GCC options -static and -shared, which allow us to

	Jakub


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