Skip to contentSkip to conversation

Uncaught target signal 11 (Segmentation Faullt)

Qemu-devel Libo Zhou 2 participants 4 messages Sep 2, 2019 – Sep 3, 2019

lore
Share & tools
lore

Libo Zhou

author
#0 lore raw

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

author
#1 lore raw

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";<[email protected]>;
Send time: Monday, Sep 2, 2019 12:16 PM
To: "qemu-devel"<[email protected]>;

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

#2 lore raw
In reply to Libo Zhou

02.09.2019. 06.17, "Libo Zhou" <[email protected]> је написао/ла:

Quoted 5 lines

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

Quoted 7 lines

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;}

Quoted 1 line

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:

Quoted 5 lines

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

Quoted 3 lines

Cheers,
Libo

#3 lore raw

02.09.2019. 18.08, "Aleksandar Markovic" <[email protected]> је написао/ла:

Quoted 15 lines

02.09.2019. 06.17, "Libo Zhou" <[email protected]> је написао/ла:

Quoted 12 lines

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;}

Quoted 1 line
Quoted 1 line

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:

Quoted 8 lines
Quoted 5 lines

qemu: uncaught target signal 11 (Segmentation fault) - core dumped

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

Hi, Libo.

Quoted 8 lines

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.

Quoted 6 lines

Sincerely,
Aleksandar

Quoted 3 lines

Cheers,
Libo