qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Uncaught target signal 11 (Segmentation Faullt)
@ 2019-09-02  4:16 =?gb18030?B?TGlibyBaaG91?=
  2019-09-02 11:25 ` =?gb18030?B?TGlibyBaaG91?=
  2019-09-02 16:08 ` Aleksandar Markovic
  0 siblings, 2 replies; 4+ messages in thread
From: =?gb18030?B?TGlibyBaaG91?= @ 2019-09-02  4:16 UTC (permalink / raw)
  To: =?gb18030?B?cWVtdS1kZXZlbA==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 615 bytes --]

I am trying to run a simple MIPS program with QEMU user mode.



Host: Ubuntu 18.04 LTS on x86_64
QEMU config: ../configure --target-list=mips-linux-user

Cross Compiler: sudo apt install gcc-mips-linux-gnu


My test.c is simple: int main(void) {int a = 1; int b =2; int c; c = a + b; return 0;}
After compiling it with "mips-linux-gnu-gcc test.c -o test", I ran it with "./qemu-mips -L /usr/mips-linux-gnu test", then I got the following error message:
qemu: uncaught target signal 11 (Segmentation fault) - core dumped


Does anyone have a solution to this? Thank you in advance.


Cheers,
Libo

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

* Re: [Qemu-devel] Uncaught target signal 11 (Segmentation Faullt)
  2019-09-02  4:16 [Qemu-devel] Uncaught target signal 11 (Segmentation Faullt) =?gb18030?B?TGlibyBaaG91?=
@ 2019-09-02 11:25 ` =?gb18030?B?TGlibyBaaG91?=
  2019-09-02 16:08 ` Aleksandar Markovic
  1 sibling, 0 replies; 4+ messages in thread
From: =?gb18030?B?TGlibyBaaG91?= @ 2019-09-02 11:25 UTC (permalink / raw)
  To: =?gb18030?B?cWVtdS1kZXZlbA==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 1813 bytes --]

Adding some useful information, enabling strace gives me the following messages. It looks like the segmentation fault is ultimately caused by missing ld.so.nohwcap and ld.so.preload?



$ ./qemu-mips -L /usr/mips-linux-gnu -strace test
10255 brk(NULL) = 0x00412000
10255 mmap2(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x7f7c8000
10255 uname(0x7fffe8c8) = 0
10255 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
10255 access("/etc/ld.so.preload",R_OK) = -1 errno=2 (No such file or directory)
10255 openat(AT_FDCWD,"/etc/ld.so.cache",O_RDONLY|O_CLOEXEC) = 3
10255 fstat64(3,0x7fffe518) = 0
10255 mmap2(NULL,106802,PROT_READ,MAP_PRIVATE,3,0) = 0x7f7ad000
10255 close(3) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=1, si_addr=0x2392d008} ---
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
[1]    10255 segmentation fault (core dumped)  ./qemu-mips -strace test






------------------ Original ------------------
From:  "Libo Zhou";<zhlb29@foxmail.com>;
Send time: Monday, Sep 2, 2019 12:16 PM
To: "qemu-devel"<qemu-devel@nongnu.org>; 

Subject:  Uncaught target signal 11 (Segmentation Faullt)



I am trying to run a simple MIPS program with QEMU user mode.



Host: Ubuntu 18.04 LTS on x86_64
QEMU config: ../configure --target-list=mips-linux-user

Cross Compiler: sudo apt install gcc-mips-linux-gnu


My test.c is simple: int main(void) {int a = 1; int b =2; int c; c = a + b; return 0;}
After compiling it with "mips-linux-gnu-gcc test.c -o test", I ran it with "./qemu-mips -L /usr/mips-linux-gnu test", then I got the following error message:
qemu: uncaught target signal 11 (Segmentation fault) - core dumped


Does anyone have a solution to this? Thank you in advance.


Cheers,
Libo

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

* Re: [Qemu-devel] Uncaught target signal 11 (Segmentation Faullt)
  2019-09-02  4:16 [Qemu-devel] Uncaught target signal 11 (Segmentation Faullt) =?gb18030?B?TGlibyBaaG91?=
  2019-09-02 11:25 ` =?gb18030?B?TGlibyBaaG91?=
@ 2019-09-02 16:08 ` Aleksandar Markovic
  2019-09-03  9:44   ` Aleksandar Markovic
  1 sibling, 1 reply; 4+ messages in thread
From: Aleksandar Markovic @ 2019-09-02 16:08 UTC (permalink / raw)
  To: Libo Zhou; +Cc: qemu-devel

02.09.2019. 06.17, "Libo Zhou" <zhlb29@foxmail.com> је написао/ла:
>
> I am trying to run a simple MIPS program with QEMU user mode.
>
>
>
> Host: Ubuntu 18.04 LTS on x86_64
> QEMU config: ../configure --target-list=mips-linux-user
>
> Cross Compiler: sudo apt install gcc-mips-linux-gnu
>
>
> My test.c is simple: int main(void) {int a = 1; int b =2; int c; c = a +
b; return 0;}
> After compiling it with "mips-linux-gnu-gcc test.c -o test", I ran it
with "./qemu-mips -L /usr/mips-linux-gnu test", then I got the following
error message:
> qemu: uncaught target signal 11 (Segmentation fault) - core dumped
>
>
> Does anyone have a solution to this? Thank you in advance.
>

Hi, Libo.

Please try this:

cd /usr/mips-linux-gnu
sudo mkdir etc
sudo ldconfig -c etc/ld.do.cache -r .

... and start qemu as you described.

Sincerely,
Aleksandar

>
> Cheers,
> Libo

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

* Re: [Qemu-devel] Uncaught target signal 11 (Segmentation Faullt)
  2019-09-02 16:08 ` Aleksandar Markovic
@ 2019-09-03  9:44   ` Aleksandar Markovic
  0 siblings, 0 replies; 4+ messages in thread
From: Aleksandar Markovic @ 2019-09-03  9:44 UTC (permalink / raw)
  To: Libo Zhou; +Cc: qemu-devel

02.09.2019. 18.08, "Aleksandar Markovic" <aleksandar.m.mail@gmail.com> је
написао/ла:
>
>
> 02.09.2019. 06.17, "Libo Zhou" <zhlb29@foxmail.com> је написао/ла:
> >
> > I am trying to run a simple MIPS program with QEMU user mode.
> >
> >
> >
> > Host: Ubuntu 18.04 LTS on x86_64
> > QEMU config: ../configure --target-list=mips-linux-user
> >
> > Cross Compiler: sudo apt install gcc-mips-linux-gnu
> >
> >
> > My test.c is simple: int main(void) {int a = 1; int b =2; int c; c = a
+ b; return 0;}
> > After compiling it with "mips-linux-gnu-gcc test.c -o test", I ran it
with "./qemu-mips -L /usr/mips-linux-gnu test", then I got the following
error message:
> > qemu: uncaught target signal 11 (Segmentation fault) - core dumped
> >
> >
> > Does anyone have a solution to this? Thank you in advance.
> >
>
> Hi, Libo.
>
> Please try this:
>
> cd /usr/mips-linux-gnu
> sudo mkdir etc
> sudo ldconfig -c etc/ld.do.cache -r .
>
> ... and start qemu as you described.
>

Or, unless you really need dynamicly linked executables, compile with
"-static", and you will never need "-L" QEMU switch, and will never have
the problem you described.

> Sincerely,
> Aleksandar
>
> >
> > Cheers,
> > Libo

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

end of thread, other threads:[~2019-09-03  9:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02  4:16 [Qemu-devel] Uncaught target signal 11 (Segmentation Faullt) =?gb18030?B?TGlibyBaaG91?=
2019-09-02 11:25 ` =?gb18030?B?TGlibyBaaG91?=
2019-09-02 16:08 ` Aleksandar Markovic
2019-09-03  9:44   ` Aleksandar Markovic

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).