lang/go coredumps on RPI4

Ronald Klop ronald-lists at klop.ws
Thu Apr 29 19:31:17 UTC 2021


On 4/29/21 5:03 PM, Ronald Klop wrote:
> Hi maintainer of lang/go and ports ML,
> 
> Latest go gives an Illegal Instruction on arm64.
> I'm running FreeBSD-14/arm64 on RPI4. Compilation of lang/go goes well. But follow-up ports like grafana7 and mongodb42-tools coredump during compilation.
> 
> [00:01:12] ===>  Building mongodump from ./mongodump/main
> [00:01:12] go tool compile: signal: illegal instruction (core dumped)
> [00:01:12] *** Error code 1
> [00:01:12]
> [00:01:12] Stop.
> [00:01:12] make: stopped in /usr/ports/databases/mongodb42-tools
> 
> I tried to get some debug info. I don't know if I got useful information here. I don't use gdb/lldb and go that often.
> 
> root at rpi4:/ # /usr/bin/lldb -c var/tmp/65534.compile.0.63376.core /usr/local/go/pkg/tool/freebsd_arm64/compile
> (lldb) target create "/usr/local/go/pkg/tool/freebsd_arm64/compile" --core "var/tmp/65534.compile.0.63376.core"
> Core file '/var/tmp/65534.compile.0.63376.core' (aarch64) was loaded.
> 
> Cannot read termcap database;
> using dumb terminal settings.
> (lldb) bt
> This version of LLDB has no plugin for the go language. Inspection of frame variables will be limited.
> * thread #1, name = 'compile', stop reason = signal SIGILL
>    * frame #0: 0x0000000000074880 compile`_rt0_arm64_freebsd at rt0_freebsd_arm64.s:9
>      frame #1: 0x0000000000074880 compile`runtime.asyncPreempt at preempt_arm64.s:148
> (lldb) quit
> 
> 
> NB: This compiles fine on the FreeBSD pkg builders. So it might have something todo with ARMv8.1 vs ARMv8.2 instruction set. I'm not familiar with this.
> NB2: It also compiles fine in a FreeBSD-12 jail which uses an older clang version.
> 
> Regards,
> 
> Ronald.
> 
> _______________________________________________
> freebsd-ports at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe at freebsd.org"


Gdb gives about the same output and I learned the "disass" command.
UDF instruction seems to be UNDefined so it might get into a codepath which it should not get into.


[root at rpi4 /var/tmp]# gdb /usr/local/go/pkg/tool/freebsd_arm64/compile ./0.compile.0.84815.core
GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]
Copyright (C) 2020 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 "aarch64-portbld-freebsd14.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
     <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/go/pkg/tool/freebsd_arm64/compile...
[New LWP 298311]
Core was generated by `/usr/local/go/pkg/tool/freebsd_arm64/compile -V=full'.
Program terminated with signal SIGILL, Illegal instruction.
#0  _rt0_arm64_freebsd () at /usr/local/go/src/runtime/rt0_freebsd_arm64.s:9
9		ADD	$8, R0, R1	// argv
warning: File "/usr/local/go/src/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
	add-auto-load-safe-path /usr/local/go/src/runtime/runtime-gdb.py
line to your configuration file "/root/.gdbinit".
--Type <RET> for more, q to quit, c to continue without paging--
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/root/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
(gdb) bt
#0  _rt0_arm64_freebsd () at /usr/local/go/src/runtime/rt0_freebsd_arm64.s:9
(gdb) disass
Dump of assembler code for function _rt0_arm64_freebsd:
=> 0x0000000000074880 <+0>:	udf	#0
    0x0000000000074884 <+4>:	udf	#0
    0x0000000000074888 <+8>:	udf	#0
    0x000000000007488c <+12>:	udf	#0
End of assembler dump.


I can reproduce it by running a simple "go run helloworld.go".

Any thoughts?

Regards,
Ronald.


More information about the freebsd-ports mailing list