Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./hello displays Illegal instruction using hg update default on ARM CPU based CISCO Linksys NSLU2 #3645

Closed
gopherbot opened this issue May 19, 2012 · 3 comments

Comments

@gopherbot
Copy link

by rounin.urashima:

./hello displays Illegal instruction using hg update default on ARM CPU based CISCO
Linksys NSLU2

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.

rounin@LKG80B859:~$ cat hello.go
package main

func main() {
        print("hello, world\n");
}
rounin@LKG80B859:~$ env|grep ARM
GOARM=5

rounin@LKG80B859:~$ go run hello.go
signal 4
rounin@LKG80B859:~$ go build hello.go
rounin@LKG80B859:~$ ./hello
Illegal instruction


What is the expected output?
hello, world

What do you see instead?
Illegal instruction

Which compiler are you using (5g, 6g, 8g, gccgo)?
go build

Which operating system are you using?

uname -a
Linux LKG80B859 2.6.32-5-ixp4xx #1 Sun May 6 12:28:42 UTC 2012 armv5tel GNU/Linux

cat /proc/cpuinfo 
Processor       : XScale-IXP42x Family rev 1 (v5l)
BogoMIPS        : 266.24
Features        : swp half thumb fastmult edsp 
CPU implementer : 0x69
CPU architecture: 5TE
CPU variant     : 0x0
CPU part        : 0x41f
CPU revision    : 1

Hardware        : Linksys NSLU2
Revision        : 0000
Serial          : 0000000000000000

cat /proc/cpu/alignment
User:           16
System:         0
Skipped:        0
Half:           0
Word:           0
DWord:          0
Multi:          0
User faults:    0 (ignored)

rounin@LKG80B859:~$ cat /etc/issue
Debian GNU/Linux 6.0 \n \l


Which version are you using?  (run 'go version')
go version
go version weekly.2012-03-27 +820ffde8c396

Did a:

hg update default

before this it was 

2ccfd4b451d3 (release-branch.go1) go1.0.1/release

With version go1.0.1/release system exhibits:

This program can only be run on EABI kernels

Please provide any additional information below.

rounin@LKG80B859:~$ strace -f ./hello
execve("./hello", ["./hello"], [/* 24 vars */]) = 0
rt_sigaction(SIGILL, {0x237fc, [RT_1], 0}, {SIG_DFL, [], 0}, 8) = 0
getpid()                                = 10347
rt_sigaction(SIGILL, {SIG_DFL, [], 0}, NULL, 8) = 0
--- SIGILL (Illegal instruction) @ 0 (0) ---
+++ killed by SIGILL +++
Illegal instruction



GOARM was set to 5
rounin@LKG80B859:~$ env|grep ARM
GOARM=5

Script started on Fri 18 May 2012 23:07:37 BST
rounin@LKG80B859:~$  env|grep ARM
GOESC[01;31mESC[KARMESC[mESC[K=5
rounin@LKG80B859:~$ cd go/src
rounin@LKG80B859:~/go/src$ ./all.bash
# Building C bootstrap tool.
cmd/dist
^C
rounin@LKG80B859:~/go/src$ time ./all.bash
# Building C bootstrap tool.
cmd/dist


# Building compilers and Go bootstrap tool for host, linux/arm.
lib9
libbio
libmach
.
.
.
.
net/http/httptest
net/http/httputil
net/mail
net/rpc
net/rpc/jsonrpc
net/smtp
old/netchan
os/signal
os/user
testing
testing/iotest
testing/quick

# Testing packages.
sfloat2 0x71924 0x159fb010
Unsupported floating point instruction
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x7624c]

goroutine 3 [running]:
created by main.(*builder).do
        /home/rounin/go/src/cmd/go/build.go:608 +0x53c

goroutine 1 [chan receive]:
main.(*builder).do(0x109a33c0, 0x10e838c0, 0x10963b40)
        /home/rounin/go/src/cmd/go/build.go:611 +0x568
main.runTest(0x456fd8, 0x109513d0, 0x3)
        /home/rounin/go/src/cmd/go/test.go:367 +0x24b8
main.main()
        /home/rounin/go/src/cmd/go/main.go:141 +0x5c8

goroutine 2 [syscall]:
created by runtime.main
        /home/rounin/go/src/pkg/runtime/proc.c:221

goroutine 9 [finalizer wait]:
created by runtime.gc
        /home/rounin/go/src/pkg/runtime/mgc0.c:922

goroutine 11 [syscall]:
created by addtimer
        /home/rounin/go/src/pkg/runtime/ztime_linux_arm.c:69

real    235m2.002s
user    52m9.280s
sys     15m18.940s
rounin@LKG80B859:~/go/src$ 
rounin@LKG80B859:~/go/src$ ^MESC[Krounin@LKG80B859:~/go/src$ exit
exit

Script done on Sat 19 May 2012 07:50:27 BST


rounin@LKG80B859:~$ gdb ./hello
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>;...
Reading symbols from /home/rounin/hello...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/rounin/hello

Program received signal SIGILL, Illegal instruction.
0x0001d744 in runtime.check ()
(gdb) x/i 0x0001d744
0x1d744 <runtime.check+184>:    vldr    d0, [sp, #36]   ; 0x24
(gdb) info registers 
r0             0x0      0
r1             0xbe859278       3196424824
r2             0xffffffff       4294967295
r3             0x4      4
r4             0x35     53
r5             0x0      0
r6             0x0      0
r7             0xae     174
r8             0x0      0
r9             0x36314  221972
r10            0x36100  221440
r11            0x35ff0  221168
r12            0xcafebabe       3405691582
sp             0xbe859254       0xbe859254
lr             0x23c14  146452
pc             0x1d744  0x1d744 <runtime.check+184>
fps            0x1001000        16781312
cpsr           0x60000010       1610612752
(gdb) x/10i $pc 
0x1d744 <runtime.check+184>:    vldr    d0, [sp, #36]   ; 0x24
0x1d748 <runtime.check+188>:    vldr    d1, [sp, #36]   ; 0x24
0x1d74c <runtime.check+192>:    vcmpe.f64       d0, d1
0x1d750 <runtime.check+196>:    vmrs    APSR_nzcv, fpscr
0x1d754 <runtime.check+200>:    ldreq   r1, [pc, #264]  ; 0x1d864
<runtime.check+472>
0x1d758 <runtime.check+204>:    streq   r1, [sp, #4]
0x1d75c <runtime.check+208>:    bleq    0x1cee0 <runtime.throw>
0x1d760 <runtime.check+212>:    vldr    d0, [sp, #36]   ; 0x24
0x1d764 <runtime.check+216>:    vldr    d1, [sp, #36]   ; 0x24
0x1d768 <runtime.check+220>:    vcmpe.f64       d0, d1
(gdb) bt
#0  0x0001d744 in runtime.check ()
#1  0x00023c14 in runtime.cas ()
#2  0x0002326c in _rt0_arm ()
#3  0x0002326c in _rt0_arm ()
#4  0x0002326c in _rt0_arm ()
#5  0x0002326c in _rt0_arm ()
#6  0x0002326c in _rt0_arm ()
#7  0x0002326c in _rt0_arm ()
#8  0x0002326c in _rt0_arm ()
#9  0x0002326c in _rt0_arm ()
#10 0x0002326c in _rt0_arm ()
#11 0x0002326c in _rt0_arm ()
#12 0x0002326c in _rt0_arm ()
#13 0x0002326c in _rt0_arm ()
#14 0x0002326c in _rt0_arm ()
#15 0x0002326c in _rt0_arm ()
#16 0x0002326c in _rt0_arm ()
#17 0x0002326c in _rt0_arm ()
#18 0x0002326c in _rt0_arm ()
#19 0x0002326c in _rt0_arm ()
#20 0x0002326c in _rt0_arm ()
#21 0x0002326c in _rt0_arm ()
#22 0x0002326c in _rt0_arm ()
#23 0x0002326c in _rt0_arm ()
#24 0x0002326c in _rt0_arm ()
#25 0x0002326c in _rt0_arm ()
#26 0x0002326c in _rt0_arm ()
#27 0x0002326c in _rt0_arm ()
#28 0x0002326c in _rt0_arm ()
#29 0x0002326c in _rt0_arm ()
---Type <return> to continue, or q <return> to quit---
Quit
(gdb) x/10i $pc
0x1d744 <runtime.check+184>:    vldr    d0, [sp, #36]   ; 0x24
0x1d748 <runtime.check+188>:    vldr    d1, [sp, #36]   ; 0x24
0x1d74c <runtime.check+192>:    vcmpe.f64       d0, d1
0x1d750 <runtime.check+196>:    vmrs    APSR_nzcv, fpscr
0x1d754 <runtime.check+200>:    ldreq   r1, [pc, #264]  ; 0x1d864
<runtime.check+472>
0x1d758 <runtime.check+204>:    streq   r1, [sp, #4]
0x1d75c <runtime.check+208>:    bleq    0x1cee0 <runtime.throw>
0x1d760 <runtime.check+212>:    vldr    d0, [sp, #36]   ; 0x24
0x1d764 <runtime.check+216>:    vldr    d1, [sp, #36]   ; 0x24
0x1d768 <runtime.check+220>:    vcmpe.f64       d0, d1
(gdb) quit
A debugging session is active.

        Inferior 1 [process 10356] will be killed.

Quit anyway? (y or n) y

rounin@LKG80B859:~$ cd go
rounin@LKG80B859:~/go$ hg identify
820ffde8c396 tip
rounin@LKG80B859:~$ cd -
rounin@LKG80B859:~$ lt hello*
-rw-r--r-- 1 rounin rounin     64 May 18 19:26 hello.go
-rwxr-xr-x 1 rounin rounin 226212 May 18 21:20 hello.old
-rwxr-xr-x 1 rounin rounin 226212 May 18 22:33 hello.old.1
-rwxr-xr-x 1 rounin rounin 171430 May 19 14:55 hello

rounin@LKG80B859:~$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
rounin@LKG80B859:~$ file hello.old
hello.old: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not
stripped

rounin@LKG80B859:~$ ./hello.old
This program can only be run on EABI kernels

hello.old executable was created by compiling with the original release of
go1.0.1/release

rounin@LKG80B859:~$ cd go.Fri18May2012_2247
rounin@LKG80B859:~/go.Fri18May2012_2247$ hg identify
2ccfd4b451d3 (release-branch.go1) go1.0.1/release

Please note on this ARM CPU based Cisco Linksys NSLU2 NAS it takes about 235 minutes
to compile after starting ./all.bash

So the debug cycles to debug this going forward will be long - your patience and guidance
will be greatly appreciated.
real    235m2.002s
@gopherbot
Copy link
Author

Comment 1 by rounin.urashima:

A Go program with the correct syntax does not give the message:
Hello,
There was a problem with the Go program I was using, once corrected it works:
rounin@LKG80B859:~$ cat -n hello.go
     1  package main
     2  
     3  import "fmt"
     4  
     5  func main() {
     6          fmt.Println("hello, world\n")
     7  }
     8  
rounin@LKG80B859:~$ time go run hello.go
hello, world
real    0m56.242s
user    0m14.750s
sys     0m3.580s
rounin@LKG80B859:~$ time go build hello.go
real    0m42.696s
user    0m11.090s
sys     0m3.730s
rounin@LKG80B859:~$ lt hello
-rwxr-xr-x 1 rounin rounin 914790 May 19 15:41 hello
rounin@LKG80B859:~$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
rounin@LKG80B859:~$ ./hello
hello, world
rounin@LKG80B859:~$ 
The remaining/outstanding issue is now:
testing/quick
# Testing packages.
sfloat2 0x71924 0x159fb010
Unsupported floating point instruction
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x7624c]
goroutine 3 [running]:
created by main.(*builder).do
        /home/rounin/go/src/cmd/go/build.go:608 +0x53c
goroutine 1 [chan receive]:
main.(*builder).do(0x109a33c0, 0x10e838c0, 0x10963b40)
        /home/rounin/go/src/cmd/go/build.go:611 +0x568
main.runTest(0x456fd8, 0x109513d0, 0x3)
        /home/rounin/go/src/cmd/go/test.go:367 +0x24b8
main.main()
        /home/rounin/go/src/cmd/go/main.go:141 +0x5c8
goroutine 2 [syscall]:
created by runtime.main
        /home/rounin/go/src/pkg/runtime/proc.c:221
goroutine 9 [finalizer wait]:
created by runtime.gc
        /home/rounin/go/src/pkg/runtime/mgc0.c:922
goroutine 11 [syscall]:
created by addtimer
        /home/rounin/go/src/pkg/runtime/ztime_linux_arm.c:69
real    235m2.002s
user    52m9.280s
sys     15m18.940s

@minux
Copy link
Member

minux commented May 19, 2012

Comment 2:

Thanks for reporting.
There are three problems here.
0. "This program can only be run on EABI kernels" is a fixed bug, but the patch
isn't included in the go1.0.1 release.
1. "invalid instruction" is due to not using GOARM=5 to compile your executable.
the invalid instruction during test phase of all.bash is issue #3331, and should be
fixed by CL 6210071.
2. sfloat2 0x71924 0x159fb010 is a known issue, issue #3638, introduced in
rev 4073e93209fb (that commit itself is not buggy, but it enables the c compiler
to use new instructions that the software floating point emulator doesn't support)
Thus, a easy workaround for you now is to use an earlier revision in the default
branch with CL 6210071 applied. sorry for the inconvenience.

Status changed to Duplicate.

@minux
Copy link
Member

minux commented May 19, 2012

Comment 3:

An alterative: apply both CL 6213057 and CL 6210071.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants