This is the mail archive of the
mailing list for the glibc project.
Re: simple pthread program and static link
On Wed, 3 Oct 2007 09:38:48 +0200, Jakub Jelinek <firstname.lastname@example.org> wrote:
> > Usually __static_tls_size, etc. are required by pthread_create() or
> > something, so nptl/init.o is linked anyway. But if simple test
> > program like this did not work properly, it might surprise some
> > people.
> The answer is simple, don't link threaded programs statically, there are
> many reasons why it is a wrong thing to do.
> If you really must do so, the safest solution is
> -Wl,--whole-archive -lpthread -Wl,--no-while-archive
> while will bloat the program, but will ensure everything needed (and a lot
> of other stuff) is linked in.
Thanks, I see. I know static-link + nptl + gdb issue, but are there
so many other problems with static-link with nptl? It would be useful
if problems or limitations with static-link were listed on somewhere.