public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/11626] New: "libgcc_s.so.1 must be installed for pthread_cancel to work" error
@ 2010-05-24 13:41 kscrosbie at yahoo dot com
  2010-05-24 13:50 ` [Bug nptl/11626] " drepper at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: kscrosbie at yahoo dot com @ 2010-05-24 13:41 UTC (permalink / raw)
  To: glibc-bugs

BACKGROUND

I'm modifying an emulator that runs under Linux (kernel 2.6) and want to leave
the emulator process's address space from address zero free to map in (4
megabyte paged) shared memory at run time. This shared memory then holds the
emulated machine's memory, and having both the emulated machine and emulator
process see them mapped from address zero reduces the cost of mapping the
emulated machine's address accesses to resulting emulator's address accesses.

I reserved as empty the early address space of the emulator process by
explicitly siting the bss, data and text sections at high addresses: passing the
params -Xlinker "-Tbss=0xB3000000" -Xlinker "-Tdata=0xB5000000" -Xlinker
"-Ttext=0xBA000000" to gcc. Gcc in turn forwards these link requests to the
linker/loader to perform. Using 0xB0000000 and higher addresses 
would enable me to map in to the emulator process up to 2Gbytes of shared memory
in the range 0x00000000 to 0x7FFFFFFF.

ERROR

But when I ran my emulator it failed after printing the error message:

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

I've tracked the generation of the above error to the following glibc code:

  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;
    /* Make sure libgcc_s_getcfa is written last.  Otherwise,
       pthread_cancel_init might return early even when the pointer the
       caller is interested in is not initialized yet.  */
    atomic_write_barrier ();
    libgcc_s_getcfa = getcfa;
  }

Two instances of the above "handle = __libc_dlopen" code occur in
nptl/sysdeps/pthread/unwind-resume.c and /nptl/sysdeps/pthread/unwind-forcedunwind.c

I suspect the link library opening (handl = __libc_dlopen) of libgcc_s.so.1 is
failing for some reason. But when I lower the address of the text section to
below 0x40000000 the above error doesn't occur, and the emulator works fine.
Note: placing the text section between 0x40000000 and 0x80000000 
does not correct matters.

My two queries are: 

1) Is there a bug in the dynamic link library loading of glibc (including
version 2.3.4) which is activated when the text section is located above a
certain memory address? 

Or 2) is there something special about a piece of dynamic link library (dll)
code where if the two most signicant bits of 
its code memory addresses are non-zero (i.e. in the address range 0x40000000 to
0xFFFFFFFF) then the dll or its symbols can not be loaded?

-- 
           Summary: "libgcc_s.so.1 must be installed for pthread_cancel to
                    work" error
           Product: glibc
           Version: 2.3.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: kscrosbie at yahoo dot com
                CC: glibc-bugs at sources dot redhat dot com,kscrosbie at
                    yahoo dot com
 GCC build triplet: i686
  GCC host triplet: i686
GCC target triplet: i686


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug nptl/11626] "libgcc_s.so.1 must be installed for pthread_cancel to work" error
  2010-05-24 13:41 [Bug nptl/11626] New: "libgcc_s.so.1 must be installed for pthread_cancel to work" error kscrosbie at yahoo dot com
@ 2010-05-24 13:50 ` drepper at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: drepper at redhat dot com @ 2010-05-24 13:50 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2010-05-24 13:49 -------
This is no place to ask questions and in general nobody cares if you do not use
the default build mechanism by using you own linker options.  You have to know
what you're doing.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2010-05-24 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-24 13:41 [Bug nptl/11626] New: "libgcc_s.so.1 must be installed for pthread_cancel to work" error kscrosbie at yahoo dot com
2010-05-24 13:50 ` [Bug nptl/11626] " drepper at redhat dot com

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