Skip to contentSkip to conversation

qemu-i386 does not start on x86_64 or i686

Qemu-devel Ronan Keryell 3 participants 6 messages Oct 18, 2007 – Oct 26, 2007

lore
Share & tools
lore
#0 lore raw

Anybody kind enough to have a look at :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=446868

I've asked some other people and they hit the same issue. It's not clear to me where the bug is since it happens very early in the starting process...

Thank you,

Signature · 6 lines
  Ronan KERYELL                 |\/  Tel:    (+33|0) 2.29.00.14.15
  Département Informatique      |/)  Fax:    (+33|0) 2.29.00.12.82
  ENST Bretagne, CS 83818       K    GSM:    (+33|0) 6.13.14.37.66
  F-29238 PLOUZANÉ CEDEX 3      |\   E-mail: [email protected]
  FRANCE                        | \  http://enstb.org/~keryell
                                     sip:[email protected]
#1 lore raw
Quoted 8 lines · Ronan Keryell

Anybody kind enough to have a look at :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=446868

I've asked some other people and they hit the same issue. It's not clear to me where the bug is since it happens very early in the starting process...

Thank you,

There have been several earlier threads on this. Here's one I started back in
June: http://lists.gnu.org/archive/html/qemu-devel/2007-06/msg00303.html

It was still broken, last I checked. I'd try to do a git bisect, but 0.9.0 was still broken and if you go back too far it can't find "gcc-3.4" and barfs because the gcc everything else in the world builds with is 4.x. (What broke it was moving the system to glibc 2.5, I.E. upgrading Ubuntu to 7.04. Old versions of qemu don't run against that either.)

It only affects user mode, not system mode, and only the i386 target, so I just delete that executable after the install so nothing tries to use it.

Rob

Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.
#2 lore raw
In reply to Ronan Keryell
Quoted 6 lines · Ronan Keryell

Anybody kind enough to have a look at :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=446868

I've asked some other people and they hit the same issue. It's not clear to me where the bug is since it happens very early in the starting process...

I've been using this patch:

linux-user/main.c +1 -1
Index: qemu/linux-user/main.c
===================================================================
@@ -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];
#3 lore raw
Quoted 19 lines · Thayne Harbaugh
Quoted 6 lines · Ronan Keryell

Anybody kind enough to have a look at :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=446868

I've asked some other people and they hit the same issue. It's not clear to me where the bug is since it happens very early in the starting process...

I've been using this patch:

Index: qemu/linux-user/main.c
===================================================================

linux-user/main.c +0 -1
@@ -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)) &&
Quoted 4 lines

!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];

When I tried it, it went:

gcc-3.4 -Wall -O2 -g -fno-strict-aliasing -I. -I.. -I/home/landley/qemu/git/target-i386 -I/home/landley/qemu/git -I/home/landley/qemu/git/linux-user -I/home/landley/qemu/git/linux-user/i386 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/landley/qemu/git/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/home/landley/qemu/git/slirp -c -o
main.o /home/landley/qemu/git/linux-user/main.c
gcc-3.4 -g -Wl,-shared -o qemu-i386 main.o syscall.o mmap.o signal.o path.o
osdep.o thunk.o elfload.o linuxload.o vm86.o libqemu.a gdbstub.o -lm -lrt
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
(.text+0x2b): undefined reference to __init_array_end' /usr/lib/libc_nonshared.a(elf-init.oS): In function __libc_csu_init':
(.text+0x34): undefined reference to __init_array_start' /usr/bin/ld: qemu-i386: hidden symbol __init_array_end' isn't defined /usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[1]: *** [qemu-i386] Error 1
make[1]: Leaving directory `/home/landley/qemu/git/i386-linux-user'
make: *** [subdir-i386-linux-user] Error 2

Have you tried it with current cvs on Ubuntu 7.04? (qemu-i386 has never worked for me built on that.)

Rob

Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.
#4 lore raw
Quoted 27 lines · Rob Landley
Quoted 19 lines · Thayne Harbaugh
Quoted 6 lines · Ronan Keryell

Anybody kind enough to have a look at :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=446868

I've asked some other people and they hit the same issue. It's not clear to me where the bug is since it happens very early in the starting process...

I've been using this patch:

Index: qemu/linux-user/main.c
===================================================================

linux-user/main.c +0 -1
@@ -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)) &&
Quoted 4 lines

!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];

When I tried it, it went:

Quoted 14 lines

gcc-3.4 -Wall -O2 -g -fno-strict-aliasing -I. -I.. -I/home/landley/qemu/git/target-i386 -I/home/landley/qemu/git -I/home/landley/qemu/git/linux-user -I/home/landley/qemu/git/linux-user/i386 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/landley/qemu/git/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/home/landley/qemu/git/slirp -c -o
main.o /home/landley/qemu/git/linux-user/main.c
gcc-3.4 -g -Wl,-shared -o qemu-i386 main.o syscall.o mmap.o signal.o path.o
osdep.o thunk.o elfload.o linuxload.o vm86.o libqemu.a gdbstub.o -lm -lrt
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
(.text+0x2b): undefined reference to __init_array_end' /usr/lib/libc_nonshared.a(elf-init.oS): In function __libc_csu_init':
(.text+0x34): undefined reference to __init_array_start' /usr/bin/ld: qemu-i386: hidden symbol __init_array_end' isn't defined /usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[1]: *** [qemu-i386] Error 1
make[1]: Leaving directory `/home/landley/qemu/git/i386-linux-user'
make: *** [subdir-i386-linux-user] Error 2

Ick. There's some funky magic going on in qemu/x86_64.ld and the above patch is a hack-around. The segfault is caused by preinit_array function pointers (which are NULL) being dereferenced. This is a great opportunity for you to put your super-sleuth skills to work and figure out the details and fix it. 8^)

Quoted 2 lines

Have you tried it with current cvs on Ubuntu 7.04? (qemu-i386 has never worked for me built on that.)

Sorry - I'm doing work on Debian Lenny.

#5 lore raw
Quoted 5 lines · Thayne Harbaugh

Ick. There's some funky magic going on in qemu/x86_64.ld and the above patch is a hack-around. The segfault is caused by preinit_array function pointers (which are NULL) being dereferenced. This is a great opportunity for you to put your super-sleuth skills to work and figure out the details and fix it. 8^)

I did. "rm /usr/local/bin/qemu-i386:

My build system only tries to use application emulation as a smoke test on the cross compiler (build a static "hello world" for the target and see if you get hello world) if the relevant qemu-$target exists. If the relevant qemu-$target isn't there (ala qemu-x86_64) then the test is automatically skipped.

99% of what I use qemu for is system emulation, and that works fine for me. I'm happy to test out other people's fixes for this, but by response to the weird prelinking logic would probably be "rip it all out", and I suspect it's there for a reason.

Most of the qemu developers seem to be happy if it works on their machines. Thus obscure things nobody uses (like gcc 4.x and Ubuntu 7.04) fall through the cracks. If there was a stable release coming I might take a little more interest in solving this problem before then, but the last few times I asked there were no plans for such.

Rob

Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.