i386 Go programs crash on amd64

Peter Jeremy peter at rulingia.com
Mon May 26 11:36:52 UTC 2014


On 2014-May-24 10:41:01 +0300, Konstantin Belousov <kostikbel at gmail.com> wrote:
>> >Provide the minimal test case.
>> 
>> The following go program, compiled on i386 and run on amd64 will die
>> with a segmentation violation or bus error:
>> -------
>> package main
>> 
>> import "fmt"
>> 
>> func main() {
>>         fmt.Println("Hello World")
>> }
>> -------
>No, this is not consumable.
>
>I need a self-contained minimal example written in C/asm.

Actually, I've found that
--------
package main
import "syscall"
func main() { syscall.Write(1, []byte("Hello World\n")) }
--------
also crashes ~66 syscalls after the first sysarch(2) call.  That
reduces the binary to 520K (go reports this is 50K lines of assembler).

>If this is too hard to produce, give the the self-contained
>binary, again as small as possible (small by comparing the
>number of syscalls before the issue manifests itself).

I've uploaded the source, binary and disassembly to
freefall:~peterj/write{.go,,.S} (and verified it crashes).

If I get time, I'll see if I can strip some of the support code out of
Go to shrink it further.

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 964 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-amd64/attachments/20140526/eda51361/attachment.sig>


More information about the freebsd-amd64 mailing list