public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Avoid overriding LIB_THREAD_LDFLAGS_SPEC on Solaris 8 (PR target/49541)
@ 2011-07-13 18:50 Rainer Orth
  2011-07-15 10:02 ` Rainer Orth
  0 siblings, 1 reply; 2+ messages in thread
From: Rainer Orth @ 2011-07-13 18:50 UTC (permalink / raw)
  To: gcc-patches

As reported in the PR, LIB_THREAD_LDFLAGS_SPEC (effectively
-L/usr/lib/lwp(/64)? -R/usr/lib/lwp(/64)? to make use of the alternate
thread library on Solaris 8, which also provides the only implementation
of __tls_get_addr) could be overridden by the regular -L flags from the
%D spec for 64-bit compilations to find /lib/sparcv9/libthread.so
instead, which lacks that function, causing link failures.

This patch fixes this by moving the -L/-R flags from LIB_SPEC to
LINK_SPEC which is before %D.

Bootstrapped without regressions on sparc-sun-solaris2.8 and
i386-pc-solaris2.8 by myself (though in a branded zone which doesn't
show the problem directly) and by Eric on bare-metal Solaris 8.

Installed on mainline, will backport to the 4.6 branch after testing.

	Rainer


2011-07-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/49541
	* config/sol2.h (LIB_SPEC): Simplify.
	Move LIB_THREAD_LDFLAGS_SPEC ...
	(LINK_SPEC): ... here.

diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -109,10 +109,8 @@ along with GCC; see the file COPYING3.  
 #undef LIB_SPEC
 #define LIB_SPEC \
   "%{!symbolic:\
-     %{pthreads|pthread:" \
-        LIB_THREAD_LDFLAGS_SPEC " -lpthread " LIB_TLS_SPEC "} \
-     %{fprofile-generate*:" \
-        LIB_THREAD_LDFLAGS_SPEC " " LIB_TLS_SPEC "} \
+     %{pthreads|pthread:-lpthread} \
+     %{pthreads|pthread|fprofile-generate*:" LIB_TLS_SPEC "} \
      %{p|pg:-ldl} -lc}"
 
 #ifndef CROSS_DIRECTORY_STRUCTURE
@@ -175,6 +173,7 @@ along with GCC; see the file COPYING3.  
    %{static:-dn -Bstatic} \
    %{shared:-G -dy %{!mimpure-text:-z text}} \
    %{symbolic:-Bsymbolic -G -dy -z text} \
+   %{pthreads|pthread|fprofile-generate*:" LIB_THREAD_LDFLAGS_SPEC "} \
    %(link_arch) \
    %{Qy:} %{!Qn:-Qy}"
 
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Avoid overriding LIB_THREAD_LDFLAGS_SPEC on Solaris 8 (PR target/49541)
  2011-07-13 18:50 Avoid overriding LIB_THREAD_LDFLAGS_SPEC on Solaris 8 (PR target/49541) Rainer Orth
@ 2011-07-15 10:02 ` Rainer Orth
  0 siblings, 0 replies; 2+ messages in thread
From: Rainer Orth @ 2011-07-15 10:02 UTC (permalink / raw)
  To: gcc-patches

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> Installed on mainline, will backport to the 4.6 branch after testing.

Here's the 4.6 branch version I've just installed after
i386-pc-solaris2.8 and sparc-sun-solaris2.8 testing by Eric and myself.

	Rainer


2011-07-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	Backport from mainline:
	2011-07-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/49541
	* config/sol2.h (LIB_SPEC): Simplify.
	Move LIB_THREAD_LDFLAGS_SPEC ...
	(LINK_SPEC): ... here.

diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -132,10 +132,8 @@ along with GCC; see the file COPYING3.  
 #define LIB_SPEC \
   "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
    %{!symbolic:\
-     %{pthreads|pthread:" \
-        LIB_THREAD_LDFLAGS_SPEC " -lpthread " LIB_TLS_SPEC "} \
-     %{!pthreads:%{!pthread:%{threads:" \
-	LIB_THREAD_LDFLAGS_SPEC " -lthread}}} \
+     %{pthreads|pthread:-lpthread " LIB_TLS_SPEC "} \
+     %{!pthreads:%{!pthread:%{threads:-lthread}}} \
      %{p|pg:-ldl} -lc}"
 
 #undef  ENDFILE_SPEC
@@ -185,6 +183,7 @@ along with GCC; see the file COPYING3.  
    %{static:-dn -Bstatic} \
    %{shared:-G -dy %{!mimpure-text:-z text}} \
    %{symbolic:-Bsymbolic -G -dy -z text} \
+   %{pthreads|pthread|threads:" LIB_THREAD_LDFLAGS_SPEC "} \
    %(link_arch) \
    %{Qy:} %{!Qn:-Qy}"
 

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-15  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-13 18:50 Avoid overriding LIB_THREAD_LDFLAGS_SPEC on Solaris 8 (PR target/49541) Rainer Orth
2011-07-15 10:02 ` Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).