public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/56473] New: Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed @ 2013-02-27 15:16 tomdean at speakeasy dot org 2013-02-27 15:42 ` [Bug c/56473] " redi at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: tomdean at speakeasy dot org @ 2013-02-27 15:16 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56473 Bug #: 56473 Summary: Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: tomdean@speakeasy.org Created attachment 29548 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29548 Script of the compile/link I compiled and linked on Ubuntu x86_64 for the Raspberry Pi. The compiler/linker completed with no errors. int main() { return 0;} When hello is executed on Raspberry Pi, I got a Segmentation fault. If I compile on Ubuntu with -nostdlib and explicitly list the Raspberry Pi crtxxx.o files and the Raspberry Pi libs, the resultant executable completes without error on Raspberry Pi. I attached a script of the compile actions on Ubuntu. I believe this to be a problem with the crtxxxx.o files and the libs distributed with arm-linux-gnueabihf-gcc-4.6 package. The same package on Raspberry Pi works Ok. On Ubuntu > uname -a Linux P9X79 3.2.0-38-generic #60-Ubuntu SMP Wed Feb 13 13:22:43 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux On Raspberry Pi > uname -a Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/56473] Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed 2013-02-27 15:16 [Bug c/56473] New: Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed tomdean at speakeasy dot org @ 2013-02-27 15:42 ` redi at gcc dot gnu.org 2013-02-27 18:13 ` [Bug target/56473] " pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: redi at gcc dot gnu.org @ 2013-02-27 15:42 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56473 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-27 15:41:34 UTC --- If these files come form an Ubuntu package then it should be reported to Ubuntu ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/56473] Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed 2013-02-27 15:16 [Bug c/56473] New: Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed tomdean at speakeasy dot org 2013-02-27 15:42 ` [Bug c/56473] " redi at gcc dot gnu.org @ 2013-02-27 18:13 ` pinskia at gcc dot gnu.org 2013-02-28 0:25 ` tomdean at speakeasy dot org 2013-02-28 0:39 ` tomdean at speakeasy dot org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2013-02-27 18:13 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56473 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c |target --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-02-27 18:13:00 UTC --- Have you tried running gdb on it to see why it is segfaulting? It sounds like you are using maybe an incompatible ABI. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/56473] Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed 2013-02-27 15:16 [Bug c/56473] New: Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed tomdean at speakeasy dot org 2013-02-27 15:42 ` [Bug c/56473] " redi at gcc dot gnu.org 2013-02-27 18:13 ` [Bug target/56473] " pinskia at gcc dot gnu.org @ 2013-02-28 0:25 ` tomdean at speakeasy dot org 2013-02-28 0:39 ` tomdean at speakeasy dot org 3 siblings, 0 replies; 5+ messages in thread From: tomdean at speakeasy dot org @ 2013-02-28 0:25 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56473 --- Comment #3 from Thomas Dean <tomdean at speakeasy dot org> 2013-02-28 00:24:44 UTC --- On Ubuntu, I recompiled with -g On RaspberryPi, I ran gdb on the resulting executable tomdean@raspberrypi:~/p9x79/bug$ gdb hello GNU gdb (GDB) 7.4.1-debian <snip> Reading symbols from /home/tomdean/p9x79/bug/hello...done. (gdb) b main Breakpoint 1 at 0x8364: file hello.c, line 3. (gdb) r Starting program: /home/tomdean/p9x79/bug/hello Program received signal SIGSEGV, Segmentation fault. 0x000573a6 in ?? () (gdb) bt #0 0x000573a6 in ?? () #1 0x000082ee in _start () I think the ubuntu crtxxx.o files and the unbunt arm-linux-gnueabihf-gcc-4.6 libs were not built correctly. diff says they are not the same as the RaspberryPi files. If I compile on ubuntu and link on RaspberryPi, all is well. If I compile on ubuntu and link, using the crtxxx.o and libs from RaspberryPi, all is well. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/56473] Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed 2013-02-27 15:16 [Bug c/56473] New: Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed tomdean at speakeasy dot org ` (2 preceding siblings ...) 2013-02-28 0:25 ` tomdean at speakeasy dot org @ 2013-02-28 0:39 ` tomdean at speakeasy dot org 3 siblings, 0 replies; 5+ messages in thread From: tomdean at speakeasy dot org @ 2013-02-28 0:39 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56473 --- Comment #4 from Thomas Dean <tomdean at speakeasy dot org> 2013-02-28 00:38:56 UTC --- Looking again at gdb, _start from ubuntu is not the same as _start on RaspberryPi, although both compiler versions are the same. ################### ## build on ubuntu ## gdb on raspi tomdean@raspberrypi:~/p9x79/bug$ gdb hello GNU gdb (GDB) 7.4.1-debian <snip> Reading symbols from /home/tomdean/p9x79/bug/hello...done. (gdb) b main Breakpoint 1 at 0x8364: file hello.c, line 3. (gdb) r Starting program: /home/tomdean/p9x79/bug/hello Program received signal SIGSEGV, Segmentation fault. 0x000573a6 in ?? () (gdb) bt #0 0x000573a6 in ?? () #1 0x000082ee in _start () (gdb) disassemble/r _start Dump of assembler code for function _start: 0x000082e4 <+0>: 4f f0 00 0b mov.w r11, #0 0x000082e8 <+4>: 4f f0 00 0e mov.w lr, #0 0x000082ec <+8>: 5d f8 04 1b ldr.w r1, [sp], #4 0x000082f0 <+12>: 6a 46 mov r2, sp 0x000082f2 <+14>: 4d f8 04 2d str.w r2, [sp, #-4]! 0x000082f6 <+18>: 4d f8 04 0d str.w r0, [sp, #-4]! 0x000082fa <+22>: df f8 14 c0 ldr.w r12, [pc, #20] ; 0x8310 <_start+44> 0x000082fe <+26>: 4d f8 04 cd str.w r12, [sp, #-4]! 0x00008302 <+30>: 04 48 ldr r0, [pc, #16] ; (0x8314 <_start+48>) 0x00008304 <+32>: 04 4b ldr r3, [pc, #16] ; (0x8318 <_start+52>) 0x00008306 <+34>: ff f7 da ef blx 0x82bc <__libc_start_main> 0x0000830a <+38>: ff f7 e6 ef blx 0x82d8 <abort> 0x0000830e <+42>: 00 00 bd 83 ; <UNDEFINED> instruction: 0x83bd0000 0x00008312 <+46>: 00 00 5c 83 cmphi r12, #0 0x00008316 <+50>: 00 00 79 83 cmnhi r9, #0 0x0000831a <+54>: 00 00 03 4b blmi 0xc8322 End of assembler dump. ################### ## compile on ubuntu ## link on raspi ## gdb on raspi ubuntu> arm-linux-gnueabihf-gcc-4.6 -g -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -marm hello.c -Wl,-t -c -o hello.o tomdean@raspberrypi:~/p9x79/bug$ arm-linux-gnueabihf-gcc-4.6 -g -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -marm hello.o -Wl,-t -o ~/work/hello tomdean@raspberrypi:~/p9x79/bug$ gdb ~/work/hello GNU gdb (GDB) 7.4.1-debian <snip> Reading symbols from /home/tomdean/work/hello...done. (gdb) b main Breakpoint 1 at 0x8398: file hello.c, line 3. (gdb) r Starting program: /home/tomdean/work/hello Breakpoint 1, main () at hello.c:3 3 return 0; (gdb) disassemble/r _start Dump of assembler code for function _start: 0x000082e4 <+0>: 00 b0 a0 e3 mov r11, #0 0x000082e8 <+4>: 00 e0 a0 e3 mov lr, #0 0x000082ec <+8>: 04 10 9d e4 pop {r1} ; (ldr r1, [sp], #4) 0x000082f0 <+12>: 0d 20 a0 e1 mov r2, sp 0x000082f4 <+16>: 04 20 2d e5 push {r2} ; (str r2, [sp, #-4]!) 0x000082f8 <+20>: 04 00 2d e5 push {r0} ; (str r0, [sp, #-4]!) 0x000082fc <+24>: 10 c0 9f e5 ldr r12, [pc, #16] ; 0x8314 <_start+48> 0x00008300 <+28>: 04 c0 2d e5 push {r12} ; (str r12, [sp, #-4]!) 0x00008304 <+32>: 0c 00 9f e5 ldr r0, [pc, #12] ; 0x8318 <_start+52> 0x00008308 <+36>: 0c 30 9f e5 ldr r3, [pc, #12] ; 0x831c <_start+56> 0x0000830c <+40>: eb ff ff eb bl 0x82c0 <__libc_start_main> 0x00008310 <+44>: f0 ff ff eb bl 0x82d8 <abort> 0x00008314 <+48>: 0c 84 00 00 andeq r8, r0, r12, lsl #8 0x00008318 <+52>: 90 83 00 00 muleq r0, r0, r3 0x0000831c <+56>: ac 83 00 00 andeq r8, r0, r12, lsr #7 End of assembler dump. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-02-28 0:39 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-02-27 15:16 [Bug c/56473] New: Cross Compile Ubuntu x86_64 to Raspberry Pi Code Seg Faults When Executed tomdean at speakeasy dot org 2013-02-27 15:42 ` [Bug c/56473] " redi at gcc dot gnu.org 2013-02-27 18:13 ` [Bug target/56473] " pinskia at gcc dot gnu.org 2013-02-28 0:25 ` tomdean at speakeasy dot org 2013-02-28 0:39 ` tomdean at speakeasy dot org
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 read-only IMAP folder(s) and NNTP newsgroup(s).