libgcc patch committed: Change __real_pthread_create ref to be non-weak

Ian Lance Taylor
Mon Jan 14 19:33:00 GMT 2013

The declaration of __real_pthread_create in generic-morestack-thread.c
had attribute weak.  Note that this code is linked with --wrap
pthread_create, so the reference to __real_pthread_create is really to
pthread_create.  Using weak was incorrect, because the reference really
is a strong one.  There is no support for __real_pthread_create aka
pthread_create to not be defined.  It caused some Go programs to fail
when linking statically, because a weak reference does not cause a
symbol definition to be included from an archive.  If there was no other
reason to include pthread_create, then pthread_create would never be
defined, so the call to __real_pthread_create would crash at runtime.

This fixes a regression, as static linking of Go programs used to work.

Bootstrapped and ran Go testsuite and split-stack tests on
x86_64-unknown-linux-gnu.  Committed to mainline.


2013-01-14  Ian Lance Taylor  <>

	* generic-morestack-thread.c: Change declaration of
	__real_pthread_create to not be weak.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 574 bytes
Desc: patch
URL: <>

More information about the Gcc-patches mailing list