All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@systemhalted.org>
To: parisc-linux@lists.parisc-linux.org,
	John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Subject: [parisc-linux] NPTL pthread_cancel and libgcc_s.so.2 vs. libgcc_s.so.1 (Why the DSO version bump?)
Date: Tue, 2 Aug 2005 09:59:10 -0400	[thread overview]
Message-ID: <20050802135905.GD9703@systemhalted.org> (raw)


Dave,

When I attempt to test syscall cancellation with NPTL threads the
interface complains that:

libgcc_s.so.1 must be installed for pthread_cancel to work

I don't have this installed, instead I have libgcc_s.so.2 installed by
gcc 4.x during the tls toolchain compile/install.

The code in question is nptl/sysdeps/pthread/unwind-resume.c, which does this:

---
static void
init (void)
{
  void *resume, *personality;
  void *handle;

  handle = __libc_dlopen ("libgcc_s.so.1");

  if (handle == NULL 
      || (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL 
      || (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL)
    __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");

  libgcc_s_resume = resume; 
  libgcc_s_personality = personality;
}
---
or
---
void
pthread_cancel_init (void)
{
  void *resume, *personality, *forcedunwind, *getcfa;
  void *handle;

  if (__builtin_expect (libgcc_s_getcfa != NULL, 1))
    return; 

  handle = __libc_dlopen ("libgcc_s.so.1");

  if (handle == NULL 
      || (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL 
      || (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL 
      || (forcedunwind = __libc_dlsym (handle, "_Unwind_ForcedUnwind"))
         == NULL 
      || (getcfa = __libc_dlsym (handle, "_Unwind_GetCFA")) == NULL 
#ifdef ARCH_CANCEL_INIT
      || ARCH_CANCEL_INIT (handle)
#endif
      )
    __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");

  libgcc_s_resume = resume; 
  libgcc_s_personality = personality;
  libgcc_s_forcedunwind = forcedunwind;
  libgcc_s_getcfa = getcfa; 
}
---

It wants to "forward" the local calls for _Unwind_Resume, __gcc_personality_v0,
_Unwind_ForcedUnwind and _Unwind_GetCFA to those in ligcc_s.so.1.

The call sequence is like this:

(Enter cancellable syscall)
...
__libc_enable_asynccancel
  __do_cancel
    __pthread_unwind
      (Calls _Unwind_GetCFA ...)
...
(Do the syscall)
...
__libc_disable_asynccancel
...
(Done)

This is called to enable unwinding out of a cancelled syscall.
What was the reason for DSO version bump in libgcc_s.so.1?

c.


_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

             reply	other threads:[~2005-08-02 13:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-02 13:59 Carlos O'Donell [this message]
2005-08-02 14:13 ` [parisc-linux] Re: NPTL pthread_cancel and libgcc_s.so.2 vs. libgcc_s.so.1 (Why the DSO version bump?) John David Anglin
2005-08-02 15:42   ` Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050802135905.GD9703@systemhalted.org \
    --to=carlos@systemhalted.org \
    --cc=dave.anglin@nrc-cnrc.gc.ca \
    --cc=parisc-linux@lists.parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.