public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libgcc patch committed: Change __real_pthread_create ref to be non-weak
@ 2013-01-14 19:33 Ian Lance Taylor
  2013-01-14 19:38 ` Ian Lance Taylor
  2013-01-14 19:42 ` H.J. Lu
  0 siblings, 2 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2013-01-14 19:33 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]

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.

Ian


2013-01-14  Ian Lance Taylor  <iant@google.com>

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



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 574 bytes --]

Index: generic-morestack-thread.c
===================================================================
--- generic-morestack-thread.c	(revision 195171)
+++ generic-morestack-thread.c	(working copy)
@@ -136,8 +136,7 @@ int __wrap_pthread_create (pthread_t *,
   __attribute__ ((visibility ("hidden")));
 
 extern int __real_pthread_create (pthread_t *, const pthread_attr_t *,
-				  void *(*start_routine) (void *), void *)
-  __attribute__ ((weak));
+				  void *(*start_routine) (void *), void *);
 
 int
 __wrap_pthread_create (pthread_t *tid, const pthread_attr_t *attr,

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

* Re: libgcc patch committed: Change __real_pthread_create ref to be non-weak
  2013-01-14 19:33 libgcc patch committed: Change __real_pthread_create ref to be non-weak Ian Lance Taylor
@ 2013-01-14 19:38 ` Ian Lance Taylor
  2013-01-14 19:42 ` H.J. Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2013-01-14 19:38 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

On Mon, Jan 14, 2013 at 11:33 AM, Ian Lance Taylor <iant@google.com> wrote:
> 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.

Sigh, this turned out to be wrong because it causes libgcc_s.so to
require libpthread.so.

Reverted.

Ian

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

* Re: libgcc patch committed: Change __real_pthread_create ref to be non-weak
  2013-01-14 19:33 libgcc patch committed: Change __real_pthread_create ref to be non-weak Ian Lance Taylor
  2013-01-14 19:38 ` Ian Lance Taylor
@ 2013-01-14 19:42 ` H.J. Lu
  1 sibling, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2013-01-14 19:42 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-patches, gofrontend-dev

On Mon, Jan 14, 2013 at 11:33 AM, Ian Lance Taylor <iant@google.com> wrote:
> 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.
>
> Ian
>
>
> 2013-01-14  Ian Lance Taylor  <iant@google.com>
>
>         * generic-morestack-thread.c: Change declaration of
>         __real_pthread_create to not be weak.
>

I think you run into:

http://sourceware.org/bugzilla/show_bug.cgi?id=14556


-- 
H.J.

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

end of thread, other threads:[~2013-01-14 19:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-14 19:33 libgcc patch committed: Change __real_pthread_create ref to be non-weak Ian Lance Taylor
2013-01-14 19:38 ` Ian Lance Taylor
2013-01-14 19:42 ` H.J. Lu

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).