Skip to contentSkip to conversation

qemu-arm dynamically linked binary problem

Qemu-devel Lennert Buytenhek 3 participants 8 messages Dec 31, 2004 – Jan 8, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I have three sets of {ld-linux,libc} for little-endian ARM: one from qemu-gnemul-0.5.1.tar.gz from the qemu site, one hand-built with gcc 3.3.4 and glibc 2.3.3, and one hand-built with gcc 3.4.2 and glibc 2.3.3. Yours works and mine don't.

Is there anything special about your libraries? Which versions of gcc/glibc did you use to build them?

thanks,
Lennert

% qemu-arm -L /usr/gnemul/qemu-arm-bellard ./hello-le hello world

% qemu-arm -L /usr/gnemul/qemu-arm-gcc-3.3.4-glibc-2.3.3 ./hello-le
Inconsistency detected by ld.so: dymanic-link.h: 150: elf_get_dynamic_info: Assertion `info[20]->d_un.d_val == 17 || info[20]->d_un.d_val == 7' failed!

% qemu-arm -L /usr/gnemul/qemu-arm-gcc-3.4.2-glibc-2.3.3 ./hello-le
qemu: uncaught signal 11 (Segmentation fault) - exiting
(Here it seems to be segfaulting while emulating the first ~30 instructions of match_symbol() in ld-linux.so.2.)

#1 lore raw
Quoted 1 line · Lennert Buytenhek

Hi,

Hi,

Quoted 8 lines

% qemu-arm -L /usr/gnemul/qemu-arm-gcc-3.3.4-glibc-2.3.3 ./hello-le
Inconsistency detected by ld.so: dymanic-link.h: 150: elf_get_dynamic_info: Assertion `info[20]->d_un.d_val == 17 || info[20]->d_un.d_val == 7' failed!

% qemu-arm -L /usr/gnemul/qemu-arm-gcc-3.4.2-glibc-2.3.3 ./hello-le
qemu: uncaught signal 11 (Segmentation fault) - exiting
(Here it seems to be segfaulting while emulating the first ~30 instructions of match_symbol() in ld-linux.so.2.)

I tried this again with the dynamic linker built by gcc 2.95.3 and glibc 2.1.3, and that works.

I guess nobody really cares about this stuff and I should just be implementing ARM system emulation instead, right?

--L

#2 lore raw
In reply to Lennert Buytenhek

Hello,

Quoted 9 lines · Lennert Buytenhek

Hi,

I have three sets of {ld-linux,libc} for little-endian ARM: one from qemu-gnemul-0.5.1.tar.gz from the qemu site, one hand-built with gcc 3.3.4 and glibc 2.3.3, and one hand-built with gcc 3.4.2 and glibc 2.3.3. Yours works and mine don't.

Is there anything special about your libraries? Which versions of gcc/glibc did you use to build them?

I have not much experience with ARM, but have you tried to use a toolchain built with crosstool? Maybe there are some patches there?

I also grepped for arm in the glibc directory of my portage tree and it looks like there are some arm-specific patches there too.

/ magnus

#3 lore raw
Quoted 1 line · Magnus Damm

Hello,

Hello,

Quoted 10 lines
Quoted 7 lines

I have three sets of {ld-linux,libc} for little-endian ARM: one from qemu-gnemul-0.5.1.tar.gz from the qemu site, one hand-built with gcc 3.3.4 and glibc 2.3.3, and one hand-built with gcc 3.4.2 and glibc 2.3.3. Yours works and mine don't.

Is there anything special about your libraries? Which versions of gcc/glibc did you use to build them?

I have not much experience with ARM, but have you tried to use a toolchain built with crosstool? Maybe there are some patches there?

Yes, I did build these with crosstool. I do have quite some experience with ARM platforms, and the binaries that all these toolchains generate do run just fine on 'real' ARM hardware.

I just think there's something in qemu's ELF setup that the glibc 2.3 dynamic linker doesn't like.

cheers,
Lennert

#4 lore raw
Quoted 16 lines · Lennert Buytenhek
Quoted 1 line · Magnus Damm

Hello,

Hello,

Quoted 10 lines
Quoted 7 lines

I have three sets of {ld-linux,libc} for little-endian ARM: one from qemu-gnemul-0.5.1.tar.gz from the qemu site, one hand-built with gcc 3.3.4 and glibc 2.3.3, and one hand-built with gcc 3.4.2 and glibc 2.3.3. Yours works and mine don't.

Is there anything special about your libraries? Which versions of gcc/glibc did you use to build them?

I have not much experience with ARM, but have you tried to use a toolchain built with crosstool? Maybe there are some patches there?

Quoted 6 lines

Yes, I did build these with crosstool. I do have quite some experience with ARM platforms, and the binaries that all these toolchains generate do run just fine on 'real' ARM hardware.

I just think there's something in qemu's ELF setup that the glibc 2.3 dynamic linker doesn't like.

It working with a gcc3.4-csl/glibc2.3.3 soft-float armv4 toolchain.

Quoted 2 lines

Inconsistency detected by ld.so: dymanic-link.h: 150: elf_get_dynamic_info:
Assertion `info[20]->d_un.d_val == 17 || info[20]->d_un.d_val == 7' failed!

I remember seeing something like this. IIRC It was caused by the (recently fixed) rrx bug.

Paul

#5 lore raw
Quoted 4 lines · Paul Brook
Quoted 2 lines

I just think there's something in qemu's ELF setup that the glibc 2.3 dynamic linker doesn't like.

It working with a gcc3.4-csl/glibc2.3.3 soft-float armv4 toolchain.

You're using dynamically linked binaries, and you have the glibc 2.3.3 dynamic linker in /usr/gnemul/qemu-arm/lib ?

Quoted 5 lines
Quoted 2 lines

Inconsistency detected by ld.so: dymanic-link.h: 150: elf_get_dynamic_info:
Assertion `info[20]->d_un.d_val == 17 || info[20]->d_un.d_val == 7' failed!

I remember seeing something like this. IIRC It was caused by the (recently fixed) rrx bug.

I'm using CVS from a few days ago, which does like look it has those rrx fixes in. I've also applied your selfmodify fix by hand. I didn't apply your 5e diff.

--L

#6 lore raw
Quoted 8 lines · Lennert Buytenhek
Quoted 4 lines · Paul Brook
Quoted 2 lines

I just think there's something in qemu's ELF setup that the glibc 2.3 dynamic linker doesn't like.

It working with a gcc3.4-csl/glibc2.3.3 soft-float armv4 toolchain.

You're using dynamically linked binaries, and you have the glibc 2.3.3 dynamic linker in /usr/gnemul/qemu-arm/lib ?

I've tested two types of applications:

- Cross-toolchain based on CodeSourcery gcc(3.4+bits of 4.0 backported), CVS glibc and binutils, plus minor config hacks to for soft-float and to use ld.so and shared libraries from my build sysroot.

- A Debian chroot via binfmt_misc and a static qemu-arm binary. This is a normal Debian Arm install with no modifications.

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

Inconsistency detected by ld.so: dymanic-link.h: 150:
elf_get_dynamic_info: Assertion `info[20]->d_un.d_val == 17 || info[20]->d_un.d_val == 7' failed!

I remember seeing something like this. IIRC It was caused by the (recently fixed) rrx bug.

I'm using CVS from a few days ago, which does like look it has those rrx fixes in. I've also applied your selfmodify fix by hand. I didn't apply your 5e diff.

I've just tired qemu CVS head, and that also works for me.

However I'll I did need to rebuild from a clean source tree,
ie "make clean && make" after changing things.
There are obviously missing makefile dependencies somewhere.

Paul

#7 lore raw
Quoted 5 lines · Paul Brook

I've just tired qemu CVS head, and that also works for me.

However I'll I did need to rebuild from a clean source tree,
ie "make clean && make" after changing things.
There are obviously missing makefile dependencies somewhere.

I did that as well.

It seems that it doesn't matter which gcc version I use for compiling the app. I can use gcc 3.4.2 compiled apps just fine, as long as I use the glibc 2.1.3 dynamic linker. If I copy the glibc 2.3.2 ld.so into my chroot (over the 2.1.3 one) things just go splat.

I'll play around with some other combinations as well.

--L