Bug 210612 - lang/go go-1.6.1,1 package requires SSE2
Summary: lang/go go-1.6.1,1 package requires SSE2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Only Me
Assignee: Julien Laffaye
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-27 07:45 UTC by Peter Jeremy
Modified: 2017-02-18 21:31 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (jlaffaye)


Attachments
Test without sse2 (344 bytes, patch)
2016-06-27 18:28 UTC, Julien Laffaye
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Jeremy freebsd_committer 2016-06-27 07:45:40 UTC
Attempting to run 'go' from the go-1.6.1,1 package results in an illegal instruction trap on my Pentium-3.

$ go help
Illegal instruction (core dumped)
$ gdb /usr/local/bin/go go.core
GNU gdb 6.1.1 [FreeBSD]
...
#0  0x080ef18d in runtime.check () at /usr/local/go/src/runtime/runtime1.go:153
153                     j, j1 float64
[New Thread 29003080 (LWP 100106/<unknown>)]
(gdb) info regi
eax            0x8704260        141574752
ecx            0x8703d00        141573376
edx            0x8703d00        141573376
ebx            0x8109880        135305344
esp            0xbfbfebe8       0xbfbfebe8
ebp            0x8703d00        0x8703d00
esi            0xbfbfecc8       -1077941048
edi            0x0      0
eip            0x80ef18d        0x80ef18d
eflags         0x210286 2163334
cs             0x33     51
ss             0x3b     59
ds             0x3b     59
es             0x3b     59
fs             0x3b     59
gs             0x3b     59
Current language:  auto; currently minimal
(gdb) disas $eip
Dump of assembler code for function runtime.check:
0x080ef160 <runtime.check+0>:   mov    %gs:0xfffffffc,%ecx
0x080ef167 <runtime.check+7>:   cmp    0x8(%ecx),%esp
0x080ef16a <runtime.check+10>:  jbe    0x80ef69a <runtime.check+1338>
0x080ef170 <runtime.check+16>:  sub    $0x44,%esp
0x080ef173 <runtime.check+19>:  movl   $0x0,0x28(%esp)
0x080ef17b <runtime.check+27>:  xorps  %xmm0,%xmm0
0x080ef17e <runtime.check+30>:  movss  %xmm0,0x24(%esp)
0x080ef184 <runtime.check+36>:  movss  %xmm0,0x20(%esp)
0x080ef18a <runtime.check+42>:  xorps  %xmm0,%xmm0
0x080ef18d <runtime.check+45>:  movsd  %xmm0,0x34(%esp)
0x080ef193 <runtime.check+51>:  movsd  %xmm0,0x2c(%esp)
...

"movsd" is a SSE2 instruction but my CPU only supports SSE:
CPU: Intel Pentium III (646.84-MHz 686-class CPU)
  Origin="GenuineIntel"  Id=0x681  Family=0x6  Model=0x8  Stepping=1
  Features=0x387f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,PN,MMX,FXSR,SSE>
Comment 1 Julien Laffaye freebsd_committer 2016-06-27 18:28:20 UTC
Created attachment 171879 [details]
Test without sse2

Can you test to build the port with this patch, then run the compiled binary ?
Comment 2 Peter Jeremy freebsd_committer 2016-08-02 06:30:25 UTC
Sorry, I lost the patch.  I'm happy that it solves my problem but I expect it's a performance regression on more recent i386.  I don't know if this should be an option, rather than hard-wired.
Comment 3 Julien Laffaye freebsd_committer 2016-08-02 06:37:16 UTC
Yes, the goal is to make an option.
I made the first patch only to test if it solves the issue at hand.

Thank you for testing ;)
Comment 4 commit-hook freebsd_committer 2017-02-18 21:30:46 UTC
A commit references this bug:

Author: jlaffaye
Date: Sat Feb 18 21:30:15 UTC 2017
New revision: 434383
URL: https://svnweb.freebsd.org/changeset/ports/434383

Log:
  - Update to 1.8
  - Add option to disable SSE2 [1]
  - Remove CC when calling make.bash [2]

  PR:		210612, 209465

Changes:
  head/lang/go/Makefile
  head/lang/go/distinfo
  head/lang/go/pkg-plist