This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/11626] New: "libgcc_s.so.1 must be installed for pthread_cancel to work" error
- From: "kscrosbie at yahoo dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 24 May 2010 13:40:53 -0000
- Subject: [Bug nptl/11626] New: "libgcc_s.so.1 must be installed for pthread_cancel to work" error
- Reply-to: sourceware-bugzilla at sourceware dot org
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.