aboutsummaryrefslogtreecommitdiffhomepage
path: root/compileopts
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-08-06 01:37:41 +0200
committerRon Evans <[email protected]>2021-08-10 20:08:27 +0200
commitca7c849da36ff6bc614a1d3a4520b74fcbc2b5cf (patch)
tree4c5e0b7742d60758f1978047ef989df443503476 /compileopts
parent6c1301688b9b16d2b9d3aa23534592ed87640b01 (diff)
downloadtinygo-ca7c849da36ff6bc614a1d3a4520b74fcbc2b5cf.tar.gz
tinygo-ca7c849da36ff6bc614a1d3a4520b74fcbc2b5cf.zip
386: bump minimum requirement to the Pentium 4
Previously we used the i386 target, probably with all optional features disabled. However, the Pentium 4 has been released a _long_ time ago and it seems reasonable to me to take that as a minimum requirement. Upstream Go now also seems to move in this direction: https://github.com/golang/go/issues/40255 The main motivation for this is that there were floating point issues when running the tests for the math package: GOARCH=386 tinygo test math I haven't investigated what's the issue, but I strongly suspect it's caused by the weird x87 80-bit floating point format. This could perhaps be fixed in a different way (by setting the FPU precision to 64 bits) but I figured that just setting the minimum requirement to the Pentium 4 would probably be fine. If needed, we can respect the GO386 environment variable to support these very old CPUs. To support this newer CPU, I had to make sure that the stack is aligned to 16 bytes everywhere. This was not yet always the case.
Diffstat (limited to 'compileopts')
-rw-r--r--compileopts/target.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/compileopts/target.go b/compileopts/target.go
index ba5f73826..19951426b 100644
--- a/compileopts/target.go
+++ b/compileopts/target.go
@@ -253,6 +253,9 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) {
GDB: []string{"gdb"},
PortReset: "false",
}
+ if goarch == "386" {
+ spec.CPU = "pentium4"
+ }
if goos == "darwin" {
spec.CFlags = append(spec.CFlags, "-isysroot", "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk")
spec.LDFlags = append(spec.LDFlags, "-Wl,-dead_strip")