Hi,

I've got a systematic segfault in qemu-i386 ( 0.8.2, 0.9.0 and CVS, but not 
0.8.1) on my x86_64. The segfault happens in glibc (2.4) initialization 
phase, before main :

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000000006004a06f in __libc_csu_init ()
#2  0x00002acb8cc1dbce in __libc_start_main (main=0x60005120 <main>, argc=1, 
ubp_av=0x7fff1e3192e8, init=0x6004a010 <__libc_csu_init>, fini=0x2acb8cf39270 
<initial+16>,
    rtld_fini=0x2acb8c799c30 <_dl_fini>, stack_end=0x7fff1e3192d8) at 
libc-start.c:190
#3  0x0000000060004b89 in _start ()

Basically, it tries to call a function through a function pointer, but this 
pointer is NULL, hence the segfault. 

The problems lies in the declaration in linux-user/main.c of 
__init_array_start variable and friends. Simply removing them do the trick 
and makes qemu-i386 work nicely. 

I don't really know why this is here; commit tells "RH9 fix - path patch" and 
code comment refers to a probable bug in ld. So I've just changed (in the 
attached patch) glibc requirement for those variable declarations from  
glibc>=2.3  to glibc == 2.3. 
I guess it would need additional tests on a more wide variety of hosts.

Pierre Palatin
Index: linux-user/main.c
===================================================================
--- linux-user/main.c	(révision 527)
+++ linux-user/main.c	(copie de travail)
@@ -44,7 +44,7 @@
 
 /* for recent libc, we add these dummy symbols which are not declared
    when generating a linked object (bug in ld ?) */
-#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(CONFIG_STATIC)
+#if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3) && !defined(CONFIG_STATIC)
 long __preinit_array_start[0];
 long __preinit_array_end[0];
 long __init_array_start[0];
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to