okay, the plot thickens - a static-compiled executable works!:

jruble@jruble-linux:~/ppc_qemu_test$ powerpc-linux-gnu-gcc test.c
-static -o test_static

jruble@jruble-linux:~/ppc_qemu_test$ powerpc-linux-gnu-gcc test.c -o
test_dynamic

jruble@jruble-linux:~/ppc_qemu_test$ file test_static 
test_static: ELF 32-bit MSB  executable, PowerPC or cisco 4500, version 1 
(SYSV), statically linked, for GNU/Linux 2.6.32, 
BuildID[sha1]=accb82b5eb863eb8e7a15b420e8929a010afcbaa, not stripped

jruble@jruble-linux:~/ppc_qemu_test$ file test_dynamic 
test_dynamic: ELF 32-bit MSB  executable, PowerPC or cisco 4500, version 1 
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, 
BuildID[sha1]=714f9cfad9e06d0478bcd238ccbcbd10468741fc, not stripped
jruble@jruble-linux:~/ppc_qemu_test$ 

jruble@jruble-linux:~/ppc_qemu_test$ ./test_static 
asdf
jruble@jruble-linux:~/ppc_qemu_test$ ./test_dynamic 
Invalid data memory access: 0xfa98c008
NIP f67e2b9c   LR f67e2c40 CTR 00000000 XER 00000000
MSR 00006040 HID0 00000000  HF 00006000 idx 0
TB 00000000 00000000
GPR00 00000000f67e2c1c 00000000f6ffe710 0000000000000000 00000000feb6c010
GPR04 00000000f67ec784 000000000000000b 0000000000000002 0000000000000000
GPR08 0000000000000030 00000000083c0010 00000000f67ac00a 0000000080808080
GPR12 00000000f67dcfc8 0000000000000000 0000000000000000 00000000f67fe8c4
GPR16 00000000f67fe900 00000000f6ffe988 00000000f6ffe98c 00000000f67feaf0
GPR20 00000000f67fd6c4 000000000000000a 00000000feb6c010 00000000f67fd320
GPR24 00000000fa98bff4 00000000f7c5ef8d 00000000100001f9 00000000041dfff4
GPR28 00000000f67fe900 000000005604ffff 00000000f67fdff4 000000002b027fff
CR 44284042  [ G  G  E  L  G  -  G  E  ]             RES ffffffff
FPR00 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR04 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR08 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR12 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR16 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR20 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR24 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR28 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPSCR 00000000
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)


jruble@jruble-linux:~/ppc_qemu_test$ powerpc-linux-gnu-readelf -d
test_dynamic

Dynamic section at offset 0xf20 contains 21 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0x1000029c
 0x0000000d (FINI)                       0x10000730
 0x6ffffef5 (GNU_HASH)                   0x10000188
 0x00000005 (STRTAB)                     0x100001f8
 0x00000006 (SYMTAB)                     0x100001a8
 0x0000000a (STRSZ)                      74 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x10011000
 0x00000002 (PLTRELSZ)                   36 (bytes)
 0x00000014 (PLTREL)                     RELA
 0x00000017 (JMPREL)                     0x10000278
 0x70000000 (PPC_GOT)                    0x10010ff4
 0x00000007 (RELA)                       0x1000026c
 0x00000008 (RELASZ)                     48 (bytes)
 0x00000009 (RELAENT)                    12 (bytes)
 0x6ffffffe (VERNEED)                    0x1000024c
 0x6fffffff (VERNEEDNUM)                 1
 0x6ffffff0 (VERSYM)                     0x10000242
 0x00000000 (NULL)                       0x0


I've also attached gdb to each of these, and in the dynamic case the segv 
occurs before reaching main() in the user code. What's the correct way to get a 
debug version of the powerpc libc.so? ( 'libc6-dbg-powerpc-cross' package?)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1349941

Title:
  qemu-ppc segfault on simple hello world

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1349941/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to