This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp merge] Stage 2: OpenMP for the Fortran front end (take 2)
On Fri, Feb 10, 2006 at 10:18:17AM -0800, Steve Kargl wrote:
> On Fri, Feb 10, 2006 at 01:04:25PM -0500, Jakub Jelinek wrote:
> >
> > > jakub and I have discussed. The other failures are probably
> > > due to FreeBSD's loader. I'll pursue that issue on the FreeBSD
> > > mailing lists.
> >
> > libgomp.so.0 not linking against libpthread.so.* is indeed IMHO a FreeBSD
> > bug.
> > For FreeBSD 6+, there is:
> > #define FBSD_LIB_SPEC " \
> > %{!shared: \
> > %{!pg: %{pthread:-lpthread} -lc} \
> > %{pg: %{pthread:-lpthread_p} -lc_p} \
> > }"
> > #endif
> >
> > This means that -pthread doesn't imply -lpthread for -shared.
> > Can anyone from the FreeBSD crowd explain why it isn't
> > %{pthread:-lpthread%{pg:_p}} %{!shared:-lc%{pg:_p}}
> > or better yet, why isn't -lc linked in automatically as well for -shared?
> >
>
> I don't know the answer. I've forwarded the above question to
> the FreeBSD-current mailing list.
Jakub, please XFAIL these tests for now. I've included the text
of an email exchange between myself and a few FreeBSD guys. The
short answer is that FreeBSD use to support several thread libraries
and one was expected to explicitly link to a particular library to
avoid mismatches. Anyway, it appears FreeBSD is moving towards
what you expected.
Steve
Date: Fri, 10 Feb 2006 19:16:37 -0500
From: Alexander Kabaev <kabaev@gmail.com>
To: Dan Nelson <dnelson@allantgroup.com>
Cc: Steve Kargl <sgk@troutmask.apl.washington.edu>,
Subject: Re: [jakub@redhat.com:Linking against libpthread via -pthread?
On Fri, 10 Feb 2006 13:52:04 -0600
Dan Nelson <dnelson@allantgroup.com> wrote:
] In the last episode (Feb 10), Steve Kargl said:
]] On Fri, Feb 10, 2006 at 01:39:08PM -0600, Dan Nelson wrote:
]]] In the last episode (Feb 10), Steve Kargl said:
]]]] Some background information: I routinely build GCC mainline on
]]]] i386-*-freebsd and amd64-*-freebsd. GCC mainline is introducing
]]]] OpenMP support. When libgomp.so.1 is built, the compiler is
]]]] given the -pthread option throughout the construction of
]]]] libgomp.so.1. However, a "ldd libgomp.so.1" shows no dependence
]]]] on libpthread.so.2
]]]
]]] There was a discussion about this back when the default switched
]]] from libc_r to libpthread, and I think the consensus was that
]]] shared libraries should never record dependencies against threads
]]] libs, which means you have to add -pthread to the link line when
]]] building the final executable. This avoids problems where an
]]] executable links to three shlibs, one library is linked to libc_r,
]]] one's linked to libkse, and a third is linked to libpthread.
]]
]] Does this still apply with the symbol versioning that was committed
]] some weeks (months?) ago? Additionally, I thought libc_r is
]] deprecated in FreeBSD-current (has it been moved to the attic?).
]
] I think symbol versioning only helps if you want to provide multiple
] compat wrappers for a single symbol depending on the age of the
] calling program. It won't help two libraries that both want to
] provide the same public symbols but have different internal ABIs
] cooperate.
]
] libc_r is still the only threads library that provides reliable %CPU
] stats and readable ktrace/truss/strace output afaik.
]
No. The change to link in libc by default and libpthread with -pthread
are in the works and will be committed shortly. There is no way around
this if we want working versioned libc and libpthread in our system.
Alexander Kabaev