[GHC] #10863: "hello world" produces illegal instruction error

#10863: "hello world" produces illegal instruction error -----------------------------------+---------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Linux Architecture: arm | Type of failure: Runtime crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -----------------------------------+---------------------------------- I saw there was a new debian experimental package for 7.10.2, so I installed it on my raspberry pi 2, an arm v7 computer running debian jessie. Someone on twitter had some success with the package, but it didn't work for me. https://packages.debian.org/experimental/armhf/ghc/download See the attached file for versions of things, and test results. This is similar to another attempt where I installed the 7.10.2 binary available from the ghc website. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by Ansible): * Attachment "install_log" added. install and test of ghc 7.10.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by Ansible): * Attachment "cpuinfo" added. /proc/cpuinfo -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by Ansible): * Attachment "ghcinfo" added. ghc --info -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by rwbarton): Thanks for the report. Could you also try running the crashing executable under gdb and attach the output of `bt`, `disas` and `info reg`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): Ok here you go. I build it like so:
ghc hello.hs -debug
And the gdb output:
`(gdb) run
Starting program: /home/bburdette/code/ghcbug/hello
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-
gnueabihf/libthread_db.so.1".
Program received signal SIGILL, Illegal instruction.
0x0000abc0 in main ()
(gdb) bt
#0 0x0000abc0 in main ()
(gdb) disas
Dump of assembler code for function main:
0x0000abb0 <+0>: push {r4, r7, lr}
0x0000abb2 <+2>: sub sp, #36 ; 0x24
0x0000abb4 <+4>: add r7, sp, #8
0x0000abb6 <+6>: str r0, [r7, #4]
0x0000abb8 <+8>: str r1, [r7, #0]
0x0000abba <+10>: movw r3, #57520 ; 0xe0b0
0x0000abbe <+14>: movt r3, #61 ; 0x3d
0x0000abc2 <+18>: add.w r4, r7, #12
0x0000abc6 <+22>: ldmia.w r3, {r0, r1, r2}
0x0000abca <+26>: stmia.w r4, {r0, r1, r2}
0x0000abce <+30>: movs r3, #1
0x0000abd0 <+32>: str r3, [r7, #12]
0x0000abd2 <+34>: movs r3, #1
0x0000abd4 <+36>: str r3, [r7, #20]
0x0000abd6 <+38>: mov r2, sp
0x0000abd8 <+40>: add.w r3, r7, #16
0x0000abdc <+44>: ldmia.w r3, {r0, r1}
0x0000abe0 <+48>: stmia.w r2, {r0, r1}
0x0000abe4 <+52>: ldr r3, [r7, #12]
0x0000abe6 <+54>: ldr r0, [r7, #4]
0x0000abe8 <+56>: ldr r1, [r7, #0]
0x0000abea <+58>: movw r2, #45368 ; 0xb138
0x0000abee <+62>: movt r2, #62 ; 0x3e
0x0000abf2 <+66>: bl 0x38f26c

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by Ansible): * Attachment "gdb_output" added. gdb output -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by rwbarton): Ok so `main` is Thumb code (mixed 2- and 4-byte instructions) but it was called as ARM mode. The evidence is that the T bit (bit 5, `0x00000200`) in the CPSR is not set, and we are in the middle of a Thumb instruction `main+16`, presumably by managing to stumble through four 32-bit ARM instructions. I don't understand ''why'' `main` is Thumb code though. `main` is built from a C file with `gcc` when the executable is built. Could you attach the output of building your program with `ghc -v`? I assume `gcc` is not being invoked with `-mthumb`... Maybe a dumb question, but can you compile and run a simple C hello world program? If you run it in gdb and break on `main`, is it ARM code or Thumb code? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by Ansible): * Attachment "gcc_test" added. test of gcc - hello world C prog -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by Ansible): * Attachment "ghc-v" added. "ghc -v hello.hs -debug" -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by Ansible): * Attachment "break_on_main" added. break on main in gdb. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): Ok I compiled a 'hello world' program in gdb and broke on main and did 'disas'. Whether these are ARM instructions or not I have no idea. Also added other attachments for ghc -v and 'hello world' output. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by rwbarton): Ok, so the C main is clearly Thumb code too. Can you check `info reg`? And also use `-fforce-recomp` for ghc. Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by Ansible): * Attachment "break_on_main" added. break on main in gdb. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): Ok appended the info_reg section onto the existing break_on_main file. I gave it a shot with "ghc -fforce-recomp hello.hs" but the resulting executable still crashes. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by rwbarton): Sorry, I meant `ghc -v -fforce-recomp`. Otherwise it doesn't really rebuild anything, and the `-v` output is not helpful. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by rwbarton): Ok so here CPSR is `0x60000030` which has the T bit set (`0x20`). So the CPU knows it is executing Thumb instructions. I don't understand what is different about what we are doing though... I mean we are presumably linking against the same libc that contains the call to `main`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by Ansible): * Attachment "ghc-v-fforce-recomp" added. output from: "ghc -v -fforce-recomp hello.hs" -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by erikd): * cc: erikd (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by rwbarton): Since I don't have any other good ideas, does your C program also work if you build it with `-fuse-ld=gold`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): yep, it does work with that option. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by erikd): I grabbed the same compiler from http://ftp.us.debian.org/debian/pool/main/g/ghc/ghc_7.10.2-2_armhf.deb and compiled up a "hello world" program. The compiler worked fine as did the resulting executable. I inspected the file `/usr/lib/ghc/settings` and found: {{{ ("C compiler link flags", " -fuse-ld=gold -Wl,-z,noexecstack"), ("ld command", "/usr/bin/ld.gold"), ("LLVM llc command", "llc-3.5"), ("LLVM opt command", "opt-3.5") }}} which is exactly as I expected. Here are the versions of llvm/binutils/gcc that I have on my machine: {{{ llvm-3.5 1:3.5.2-1 armhf Modular compiler and toolchain technologies binutils 2.25.1-1 armhf GNU assembler, linker and binary utilities gcc 4:4.9.2-4 armhf GNU C compiler }}} @Ansible, please check your versions of the above. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): Ok here's some version info from my machine. Check your reddit pms, rwbarton. {{{ ("C compiler link flags", " -fuse-ld=gold -Wl,-z,noexecstack"), ("ld command", "/usr/bin/ld.gold"), ("LLVM llc command", "llc-3.5"), ("LLVM opt command", "opt-3.5") }}} {{{ ii llvm-3.5 1:3.5-10 armhf Modular compiler and toolchain technologies ii llvm-3.5-dev 1:3.5-10 armhf Modular compiler and toolchain technologies, libraries and headers ii llvm-3.5-runtime 1:3.5-10 armhf Modular compiler and toolchain technologies, IR interpreter ii gcc 4:4.9.2-2 armhf GNU C compiler ii binutils 2.25-5 armhf GNU assembler, linker and binary utilities }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by erikd): I suspect binutils. Is it possible to upgrade just that, possibly to the version that is currently in debian testing? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): I'll all for it, but I don't spend too much time on debian. Do you know the command sequence for installing just binutils from testing? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by erikd): Simple, go to https://www.debian.org/distrib/packages , scroll down to the section titled "Search package directories", enter the name "binutils" and choose the "testing" distribution which will give you a link to https://packages.debian.org/stretch/binutils , then go to the bottom of the page where it says "Download binutils", and click on "armhf" which leads you to https://packages.debian.org/stretch/armhf/binutils/download which gives a number of links to the binary package. See, simple (not) when you know how :-). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): Ok I installed the binutils, but no dice it seems... {{{ bburdette@jessie-rpi:~/code/ghcbug$ sudo dpkg -i binutils_2.25.1-1_armhf.deb [sudo] password for bburdette: (Reading database ... 38788 files and directories currently installed.) Preparing to unpack binutils_2.25.1-1_armhf.deb ... Unpacking binutils (2.25.1-1) over (2.25-5) ... Setting up binutils (2.25.1-1) ... Processing triggers for man-db (2.7.0.2-5) ... Processing triggers for libc-bin (2.19-18) ... bburdette@jessie-rpi:~/code/ghcbug$ ls a.out core hello hello.hs install_log binutils_2.25.1-1_armhf.deb frout hello.hi hello.o main.cpp bburdette@jessie-rpi:~/code/ghcbug$ ghc -fforce-recomp hello.hs [1 of 1] Compiling Main ( hello.hs, hello.o ) Linking hello ... bburdette@jessie-rpi:~/code/ghcbug$ ./hello Illegal instruction bburdette@jessie-rpi:~/code/ghcbug$ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by erikd): Sorry, I mis-read the information you had provided. I thought it was the compiler that was crashing, not the compiled executable. Since it is not the compiler and it *is* the executable, I am 100% certain that the version of the llvm tools you have contains a bug (discussed in ticket #9920). The fix for that LLVM bug is to install llvm-3.5.2 from debian testing. You should list all the llvm-3.5 packages you have installed using `dpkg -l | grep llvm-3.5` and then replace them with the relevant replacements here http://ftp.us.debian.org/debian/pool/main/l/llvm-toolchain-3.5/ whose package names match `*3.5.2-2_armhf.deb`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): Ok, running into dependency hell trying to install these packages manually. I'm going to try just changing over to debian testing and then see if it works. Will post back with results. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by erikd): Actually, I suspect that those packages along will not trigger dependency hell, but Debian testing may be safer. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): Moved over to testing, but still getting the SIGILL, unfortunately. I did install ghc while it had the 3.5.2-1 llvm on there, but then upgraded to 3.5.2-2 {{{ bburdette@jessie-rpi:~/code/ghcbug$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.10.2 bburdette@jessie-rpi:~/code/ghcbug$ ghc hello.hs bburdette@jessie-rpi:~/code/ghcbug$ ./hello Illegal instruction bburdette@jessie-rpi:~/code/ghcbug$ ls a.out hello.o binutils_2.25.1-1_armhf.deb install_log core libllvm3.5v5_3.5.2-2_armhf.deb download libstdc++6_5.2.1-16_armhf.deb download.1 libtinfo5_6.0+20150810-1_armhf.deb frout llvm-3.5-dev_3.5.2-2_armhf.deb hello llvm-3.5-runtime_3.5.2-2_armhf.deb hello.hi llvm-3.5_3.5.2-2_armhf.deb hello.hs main.cpp bburdette@jessie-rpi:~/code/ghcbug$ rm hello bburdette@jessie-rpi:~/code/ghcbug$ ghc hello.hs Linking hello ... bburdette@jessie-rpi:~/code/ghcbug$ ./hello Illegal instruction bburdette@jessie-rpi:~/code/ghcbug$ dpkg -l | grep llvm-3.5 ii llvm-3.5 1:3.5.2-2 armhf Modular compiler and toolchain technologies ii llvm-3.5-dev 1:3.5.2-2 armhf Modular compiler and toolchain technologies, libraries and headers ii llvm-3.5-runtime 1:3.5.2-2 armhf Modular compiler and toolchain technologies, IR interpreter bburdette@jessie-rpi:~/code/ghcbug$ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by erikd): This: {{{ bburdette@jessie-rpi:~/code/ghcbug$ ghc hello.hs Linking hello ... }}} suggests that it the executable wasn't compiled, just linked (because the object file was already there). Use `ghc -fforce-recomp hello.hs -o hello`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Comment (by Ansible): that worked! thanks for the help. seems like it would be worth noting that an exact version of llvm is required on the download page, which only mentions llvm 3.5. https://www.haskell.org/ghc/download_ghc_7_10_2#linux_armv7 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10863: "hello world" produces illegal instruction error ----------------------------------+--------------------------------- Reporter: Ansible | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: invalid | Keywords: Operating System: Linux | Architecture: arm Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+--------------------------------- Changes (by erikd): * status: new => closed * resolution: => invalid Comment: Great. Got this one figured out. I'll close this but I'll also see if I can get that download page updated. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10863#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC