qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] ARM in big endian mode?
@ 2004-07-03 16:03 Lennert Buytenhek
  2004-07-04 11:30 ` Gianni Tedesco
  0 siblings, 1 reply; 11+ messages in thread
From: Lennert Buytenhek @ 2004-07-03 16:03 UTC (permalink / raw)
  To: qemu-devel

Hi,

For a project I'm working on, I would love to be able to simulate an
ARM in big endian mode (such as the intel xscale core).  If I try to
run an MSB executable on qemu current, I just get this:

# file init
init: ELF 32-bit MSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.3, statically linked, stripped
# qemu-arm ./init
Error loading ./init
# 

Would it be a lot of effort to add this?


cheers,
Lennert

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

* Re: [Qemu-devel] ARM in big endian mode?
  2004-07-03 16:03 [Qemu-devel] ARM in big endian mode? Lennert Buytenhek
@ 2004-07-04 11:30 ` Gianni Tedesco
  2004-07-04 11:57   ` Lennert Buytenhek
  2004-07-04 13:11   ` [Qemu-devel] ARM in big endian mode? Fabrice Bellard
  0 siblings, 2 replies; 11+ messages in thread
From: Gianni Tedesco @ 2004-07-04 11:30 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

On Sat, 2004-07-03 at 18:03 +0200, Lennert Buytenhek wrote:
> Hi,
> 
> For a project I'm working on, I would love to be able to simulate an
> ARM in big endian mode (such as the intel xscale core).  If I try to
> run an MSB executable on qemu current, I just get this:
> 
> # file init
> init: ELF 32-bit MSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.3, statically linked, stripped
> # qemu-arm ./init
> Error loading ./init
> # 
> 
> Would it be a lot of effort to add this?

Compile with TARGET_WORDS_BIGENDIAN 1 ought to do it.

-- 
// Gianni Tedesco (gianni at scaramanga dot co dot uk)
lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import
8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [Qemu-devel] ARM in big endian mode?
  2004-07-04 11:30 ` Gianni Tedesco
@ 2004-07-04 11:57   ` Lennert Buytenhek
  2004-07-11 23:17     ` David Woodhouse
  2004-07-04 13:11   ` [Qemu-devel] ARM in big endian mode? Fabrice Bellard
  1 sibling, 1 reply; 11+ messages in thread
From: Lennert Buytenhek @ 2004-07-04 11:57 UTC (permalink / raw)
  To: qemu-devel

On Sun, Jul 04, 2004 at 12:30:20PM +0100, Gianni Tedesco wrote:

> > For a project I'm working on, I would love to be able to simulate an
> > ARM in big endian mode (such as the intel xscale core).  If I try to
> > run an MSB executable on qemu current, I just get this:
> > 
> > # file init
> > init: ELF 32-bit MSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.3, statically linked, stripped
> > # qemu-arm ./init
> > Error loading ./init
> > # 
> > 
> > Would it be a lot of effort to add this?
> 
> Compile with TARGET_WORDS_BIGENDIAN 1 ought to do it.

That didn't go very well..

% pwd
/data/qemu/qemu_cvs/arm-user
% cat x.c
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
	return 0;
}
% armv5b-softfloat-linux-gcc -Wall -o x x.c -static
% file x
x: ELF 32-bit MSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.3, statically linked, not stripped
% tail -1 config.h
#define TARGET_WORDS_BIGENDIAN 1
% ./qemu-arm ./x
qemu: uncaught target signal 11 (Segmentation fault) - exiting
%                                                 

Same binary works fine on my target board.


--L

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

* Re: [Qemu-devel] ARM in big endian mode?
  2004-07-04 11:30 ` Gianni Tedesco
  2004-07-04 11:57   ` Lennert Buytenhek
@ 2004-07-04 13:11   ` Fabrice Bellard
  2004-07-04 13:28     ` Lennert Buytenhek
  1 sibling, 1 reply; 11+ messages in thread
From: Fabrice Bellard @ 2004-07-04 13:11 UTC (permalink / raw)
  To: qemu-devel

Gianni Tedesco wrote:
> On Sat, 2004-07-03 at 18:03 +0200, Lennert Buytenhek wrote:
> 
>>Hi,
>>
>>For a project I'm working on, I would love to be able to simulate an
>>ARM in big endian mode (such as the intel xscale core).  If I try to
>>run an MSB executable on qemu current, I just get this:
>>
>># file init
>>init: ELF 32-bit MSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.3, statically linked, stripped
>># qemu-arm ./init
>>Error loading ./init
>># 
>>
>>Would it be a lot of effort to add this?
> 
> 
> Compile with TARGET_WORDS_BIGENDIAN 1 ought to do it.

There may be some problems left with the floats. But basically it should 
work. Send me a statically linked executable so that I can test.

Fabrice.

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

* Re: [Qemu-devel] ARM in big endian mode?
  2004-07-04 13:11   ` [Qemu-devel] ARM in big endian mode? Fabrice Bellard
@ 2004-07-04 13:28     ` Lennert Buytenhek
  0 siblings, 0 replies; 11+ messages in thread
From: Lennert Buytenhek @ 2004-07-04 13:28 UTC (permalink / raw)
  To: Fabrice Bellard; +Cc: qemu-devel

On Sun, Jul 04, 2004 at 03:11:56PM +0200, Fabrice Bellard wrote:

> >Compile with TARGET_WORDS_BIGENDIAN 1 ought to do it.
> 
> There may be some problems left with the floats. But basically it should 
> work. Send me a statically linked executable so that I can test.

Hi,

I generated a few testcases, but because they are rather big, I put
them (bzipped) online at: http://www2.wantstofly.org/arm_big_endian/

Thanks in advance!


cheers,
Lennert

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

* Re: [Qemu-devel] ARM in big endian mode?
  2004-07-04 11:57   ` Lennert Buytenhek
@ 2004-07-11 23:17     ` David Woodhouse
  2004-07-11 23:43       ` Lennert Buytenhek
  0 siblings, 1 reply; 11+ messages in thread
From: David Woodhouse @ 2004-07-11 23:17 UTC (permalink / raw)
  To: qemu-devel

On Sun, 2004-07-04 at 13:57 +0200, Lennert Buytenhek wrote:
> % ./qemu-arm ./x
> qemu: uncaught target signal 11 (Segmentation fault) - exiting

Are you sure that's happening only for BE ARM binaries? I have a vague
recollection that last time I tried qemu-arm it was doing that even for
LE executables.

-- 
dwmw2

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

* Re: [Qemu-devel] ARM in big endian mode?
  2004-07-11 23:17     ` David Woodhouse
@ 2004-07-11 23:43       ` Lennert Buytenhek
  2004-08-06 14:55         ` David Woodhouse
  0 siblings, 1 reply; 11+ messages in thread
From: Lennert Buytenhek @ 2004-07-11 23:43 UTC (permalink / raw)
  To: qemu-devel

On Mon, Jul 12, 2004 at 12:17:27AM +0100, David Woodhouse wrote:

> > % ./qemu-arm ./x
> > qemu: uncaught target signal 11 (Segmentation fault) - exiting
> 
> Are you sure that's happening only for BE ARM binaries? I have a vague
> recollection that last time I tried qemu-arm it was doing that even for
> LE executables.

Just checked, and indeed, LE binaries segfault too.

That's strange, since I remember checking LE ARM binaries a while ago,
and after patching qemu to correct some O_* flags (I think it had O_DIRECT
and O_DIRECTORY mixed up, or something like that), things seemed to work
okay.  I even built a small debian ARM chroot, fully emulated with qemu,
with an sshd running in there, etc.

So it looks like it (might have) worked in the past but broke somewhere
between then and now.


--L

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

* Re: [Qemu-devel] ARM in big endian mode?
  2004-07-11 23:43       ` Lennert Buytenhek
@ 2004-08-06 14:55         ` David Woodhouse
  2004-08-06 15:59           ` [PROBLEM FOUND] qemu-arm on FC2 (was: Re: [Qemu-devel] ARM in big endian mode?) Lennert Buytenhek
  0 siblings, 1 reply; 11+ messages in thread
From: David Woodhouse @ 2004-08-06 14:55 UTC (permalink / raw)
  To: qemu-devel

On Mon, 2004-07-12 at 01:43 +0200, Lennert Buytenhek wrote:
> On Mon, Jul 12, 2004 at 12:17:27AM +0100, David Woodhouse wrote:
> 
> > > % ./qemu-arm ./x
> > > qemu: uncaught target signal 11 (Segmentation fault) - exiting
  <...>
> Just checked, and indeed, LE binaries segfault too.
  <...>
> So it looks like it (might have) worked in the past but broke somewhere
> between then and now.

Are you using a newer glibc now than the one you were using before?

-- 
dwmw2

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

* [PROBLEM FOUND] qemu-arm on FC2 (was: Re: [Qemu-devel] ARM in big endian mode?)
  2004-08-06 14:55         ` David Woodhouse
@ 2004-08-06 15:59           ` Lennert Buytenhek
  2004-08-06 16:31             ` David Woodhouse
  0 siblings, 1 reply; 11+ messages in thread
From: Lennert Buytenhek @ 2004-08-06 15:59 UTC (permalink / raw)
  To: qemu-devel

On Fri, Aug 06, 2004 at 03:55:07PM +0100, David Woodhouse wrote:

> > > > % ./qemu-arm ./x
> > > > qemu: uncaught target signal 11 (Segmentation fault) - exiting
>   <...>
> > Just checked, and indeed, LE binaries segfault too.
>   <...>
> > So it looks like it (might have) worked in the past but broke somewhere
> > between then and now.
> 
> Are you using a newer glibc now than the one you were using before?

Yes.  Now I'm using Fedora Core 2, but Red Hat 9 back then, I think.

I just found some time for some more testing, and it's FC2's noexecstack
messing up in this particular case.  If I create, using gcc 2.95.3 and
glibc 2.1.3 vanilla, a static ARM little-endian "Hello world" binary, and
run it with qemu-arm latest CVS, it works if I specify -Wl,-z,execstack
when linking qemu-arm, and crashes with sig11 if I do not.


--L

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

* Re: [PROBLEM FOUND] qemu-arm on FC2 (was: Re: [Qemu-devel] ARM in big endian mode?)
  2004-08-06 15:59           ` [PROBLEM FOUND] qemu-arm on FC2 (was: Re: [Qemu-devel] ARM in big endian mode?) Lennert Buytenhek
@ 2004-08-06 16:31             ` David Woodhouse
  2004-08-06 17:18               ` Lennert Buytenhek
  0 siblings, 1 reply; 11+ messages in thread
From: David Woodhouse @ 2004-08-06 16:31 UTC (permalink / raw)
  To: qemu-devel

On Fri, 2004-08-06 at 17:59 +0200, Lennert Buytenhek wrote:
> On Fri, Aug 06, 2004 at 03:55:07PM +0100, David Woodhouse wrote:
> 
> > > > > % ./qemu-arm ./x
> > > > > qemu: uncaught target signal 11 (Segmentation fault) - exiting
> >   <...>
> > > Just checked, and indeed, LE binaries segfault too.
> >   <...>
> > > So it looks like it (might have) worked in the past but broke somewhere
> > > between then and now.
> > 
> > Are you using a newer glibc now than the one you were using before?
> 
> Yes.  Now I'm using Fedora Core 2, but Red Hat 9 back then, I think.

Hmm. I meant the ARM glibc, not the host. I have a vague recollection
that using an older ARM libc made it work OK. Using statically linked
ARM binaries also made it work.

> I just found some time for some more testing, and it's FC2's noexecstack
> messing up in this particular case.  If I create, using gcc 2.95.3 and
> glibc 2.1.3 vanilla, a static ARM little-endian "Hello world" binary, and
> run it with qemu-arm latest CVS, it works if I specify -Wl,-z,execstack
> when linking qemu-arm, and crashes with sig11 if I do not.

With 0.6.0 this doesn't do it for me. This is a Familiar 0.7.2 image
with glibc 2.3.2

shinybook /home/dwmw2/working/pkgs/qemu/qemu-0.6.0/arm-user $ gcc -g -Wl,-T,/home/dwmw2/working/pkgs/qemu/qemu-0.6.0/ppc.ld -o qemu-arm elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o nwfpe/double_cpdo.o nwfpe/extended_cpdo.o libqemu.a  -lm -Wl,-z,execstack
shinybook /home/dwmw2/working/pkgs/qemu/qemu-0.6.0/arm-user $ ./qemu-arm /usr/qemu-arm/bin/echo hello
qemu: uncaught target signal 11 (Segmentation fault) - exiting 


-- 
dwmw2

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

* Re: [PROBLEM FOUND] qemu-arm on FC2 (was: Re: [Qemu-devel] ARM in big endian mode?)
  2004-08-06 16:31             ` David Woodhouse
@ 2004-08-06 17:18               ` Lennert Buytenhek
  0 siblings, 0 replies; 11+ messages in thread
From: Lennert Buytenhek @ 2004-08-06 17:18 UTC (permalink / raw)
  To: qemu-devel

On Fri, Aug 06, 2004 at 05:31:14PM +0100, David Woodhouse wrote:

> > On Fri, Aug 06, 2004 at 03:55:07PM +0100, David Woodhouse wrote:
> > 
> > > > > > % ./qemu-arm ./x
> > > > > > qemu: uncaught target signal 11 (Segmentation fault) - exiting
> > >   <...>
> > > > Just checked, and indeed, LE binaries segfault too.
> > >   <...>
> > > > So it looks like it (might have) worked in the past but broke somewhere
> > > > between then and now.
> > > 
> > > Are you using a newer glibc now than the one you were using before?
> > 
> > Yes.  Now I'm using Fedora Core 2, but Red Hat 9 back then, I think.
> 
> Hmm. I meant the ARM glibc, not the host. I have a vague recollection
> that using an older ARM libc made it work OK. Using statically linked
> ARM binaries also made it work.

Ooooh, sorry, yes.  This is what I get on an FC2 host:


		qemu-arm default (noexecstack)		qemu-arm execstack

hello world
compiled with
gcc 2.95.3		sig11					works
and glibc
2.1.3


hello world
compiled with
gcc 3.3.3		sig11					sig11
and glibc
2.3.2


Now testing various permutations of host toolchain and target toolchain.



--L

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

end of thread, other threads:[~2004-08-06 17:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-03 16:03 [Qemu-devel] ARM in big endian mode? Lennert Buytenhek
2004-07-04 11:30 ` Gianni Tedesco
2004-07-04 11:57   ` Lennert Buytenhek
2004-07-11 23:17     ` David Woodhouse
2004-07-11 23:43       ` Lennert Buytenhek
2004-08-06 14:55         ` David Woodhouse
2004-08-06 15:59           ` [PROBLEM FOUND] qemu-arm on FC2 (was: Re: [Qemu-devel] ARM in big endian mode?) Lennert Buytenhek
2004-08-06 16:31             ` David Woodhouse
2004-08-06 17:18               ` Lennert Buytenhek
2004-07-04 13:11   ` [Qemu-devel] ARM in big endian mode? Fabrice Bellard
2004-07-04 13:28     ` Lennert Buytenhek

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 NNTP newsgroup(s).