This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix -pthread for PowerPC/Linux shared libraries
On Wed, Sep 17, 2003 at 10:47:36AM -0400, Jakub Jelinek wrote:
> On Wed, Sep 17, 2003 at 10:44:29AM -0400, Daniel Jacobowitz wrote:
> > On Wed, Sep 17, 2003 at 11:39:37PM +0930, Alan Modra wrote:
> > > On Wed, Sep 17, 2003 at 09:44:01AM -0400, Daniel Jacobowitz wrote:
> > > > --- sysv4.h 19 Jun 2003 21:47:22 -0000 1.135
> > > > +++ sysv4.h 17 Sep 2003 13:41:52 -0000
> > > > @@ -1065,7 +1065,7 @@ extern int fixuplabelno;
> > > >
> > > > /* GNU/Linux support. */
> > > > #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
> > > > -%{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
> > > > +%{!mnewlib: %{shared:-lc} %{pthread:-lpthread } %{!shared: \
> > > > %{profile:-lc_p} %{!profile:-lc}}}"
> > > >
> > > > #ifdef HAVE_LD_PIE
> > >
> > > I find the library order a little suspect, both before and after this
> > > patch. Why is -lc listed before -lpthread when shared?
> >
> > Again, coincidence, I imagine. But does it matter? My impression was
> > that library order only made a difference with shared libraries.
> >
> > Oh, blech, libc.so and libpthread.so are both linker scripts with a
> > _nonshared.a now...
>
> For older glibcs (ie. < this year) it matters a lot.
> Link dynamically with -lc -lpthread and lots of things will not be
> thread safe.
Oh - this is because of the weak symbol search order changes, right?
In that case, how about this.
2003-09-17 Daniel Jacobowitz <drow@mvista.com>
* config/rs6000/sysv4.h (LIB_LINUX_SPEC): Give -lpthread before -lc.
Index: sysv4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.137
diff -u -p -r1.137 sysv4.h
--- sysv4.h 17 Sep 2003 14:04:52 -0000 1.137
+++ sysv4.h 17 Sep 2003 14:51:22 -0000
@@ -1065,8 +1065,8 @@ extern int fixuplabelno;
/* GNU/Linux support. */
#define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
-%{!mnewlib: %{shared:-lc} %{pthread:-lpthread } %{!shared: \
-%{profile:-lc_p} %{!profile:-lc}}}"
+%{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
+%{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
#ifdef HAVE_LD_PIE
#define STARTFILE_LINUX_SPEC "\
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer