Bug 34787 - fix -shared + -pthread for mips/linux
Summary: fix -shared + -pthread for mips/linux
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-15 03:18 UTC by Mike Frysinger
Modified: 2008-04-07 06:00 UTC (History)
3 users (show)

See Also:
Host:
Target: mips-linux
Build:
Known to work: 4.3.0
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2008-01-15 03:18:05 UTC
like so many other bugs, "-shared -pthread" is broken on mips linux:
$ mips-linux-gcc -dumpspecs
...
%{!shared: %{pthread:-lpthread} ...
...

simple fix until a general solution (as proposed in Bug 20705) is implemented:
--- gcc/config/mips/linux.h
+++ gcc/config/mips/linux.h
@@ -175,7 +175,7 @@
 #undef LIB_SPEC
 #define LIB_SPEC "\
 %{shared: -lc} \
-%{!shared: %{pthread:-lpthread} \
-  %{profile:-lc_p} %{!profile: -lc}}"
+%{pthread:-lpthread} \
+%{!shared: %{profile:-lc_p} %{!profile: -lc}}"

 #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
--- gcc/config/mips/linux64.h
+++ gcc/config/mips/linux64.h
@@ -33,8 +33,8 @@
 #undef LIB_SPEC
 #define LIB_SPEC "\
 %{shared: -lc} \
-%{!shared: %{pthread:-lpthread} \
-  %{profile:-lc_p} %{!profile: -lc}}"
+%{pthread:-lpthread} \
+%{!shared: %{profile:-lc_p} %{!profile: -lc}}"

 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"

this follows the same lines as all other Linux arches:
http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00526.html
Comment 1 Richard Biener 2008-01-15 10:37:52 UTC
Patches should be sent to gcc-patches@gcc.gnu.org
Comment 2 Richard Sandiford 2008-01-24 19:52:56 UTC
FWIW, this was fixed on mainline by:

2007-06-13  Thiemo Seufer  <ths@networkno.de>

	* config/mips/linux.h, config/mips/linux64.h (LIB_SPEC): Always
	imply -lpthread for -pthread.

By the letter of the law, this shouldn't be backported because
it doesn't fix a regression.  Interested parties: please shout
if you think an exception should be made.

Richard
Comment 3 Mike Frysinger 2008-04-07 06:00:42 UTC
this is in gcc-4.3.0 and that's fine by me