diff options
author | Ayke van Laethem <[email protected]> | 2024-08-21 16:30:29 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-08-22 07:59:37 +0200 |
commit | 83c98a23cea4d3d59d228ffa60f69303fd57dbb0 (patch) | |
tree | a8912120571ede279b95ce4914597a5bfb7ceacf /compiler | |
parent | 336b9b33ab9dc51235519d0a7ce2116fe44fbe4e (diff) | |
download | tinygo-83c98a23cea4d3d59d228ffa60f69303fd57dbb0.tar.gz tinygo-83c98a23cea4d3d59d228ffa60f69303fd57dbb0.zip |
mips: fix crash with GOMIPS=softfloat
`defer` and `GOMIPS=softfloat` together would result in a crash. This
patch fixes this issue.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/defer.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/defer.go b/compiler/defer.go index df8686957..677df8f2a 100644 --- a/compiler/defer.go +++ b/compiler/defer.go @@ -16,6 +16,7 @@ package compiler import ( "go/types" "strconv" + "strings" "github.com/tinygo-org/tinygo/compiler/llvmutil" "golang.org/x/tools/go/ssa" @@ -198,7 +199,13 @@ jal 1f addiu $$ra, 8 sw $$ra, 4($$5) .set at` - constraints = "={$4},{$5},~{$1},~{$2},~{$3},~{$5},~{$6},~{$7},~{$8},~{$9},~{$10},~{$11},~{$12},~{$13},~{$14},~{$15},~{$16},~{$17},~{$18},~{$19},~{$20},~{$21},~{$22},~{$23},~{$24},~{$25},~{$26},~{$27},~{$28},~{$29},~{$30},~{$31},~{$f0},~{$f1},~{$f2},~{$f3},~{$f4},~{$f5},~{$f6},~{$f7},~{$f8},~{$f9},~{$f10},~{$f11},~{$f12},~{$f13},~{$f14},~{$f15},~{$f16},~{$f17},~{$f18},~{$f19},~{$f20},~{$f21},~{$f22},~{$f23},~{$f24},~{$f25},~{$f26},~{$f27},~{$f28},~{$f29},~{$f30},~{$f31},~{memory}" + constraints = "={$4},{$5},~{$1},~{$2},~{$3},~{$5},~{$6},~{$7},~{$8},~{$9},~{$10},~{$11},~{$12},~{$13},~{$14},~{$15},~{$16},~{$17},~{$18},~{$19},~{$20},~{$21},~{$22},~{$23},~{$24},~{$25},~{$26},~{$27},~{$28},~{$29},~{$30},~{$31},~{memory}" + if !strings.Contains(b.Features, "+soft-float") { + // Using floating point registers together with GOMIPS=softfloat + // results in a crash: "This value type is not natively supported!" + // So only add them when using hardfloat. + constraints += ",~{$f0},~{$f1},~{$f2},~{$f3},~{$f4},~{$f5},~{$f6},~{$f7},~{$f8},~{$f9},~{$f10},~{$f11},~{$f12},~{$f13},~{$f14},~{$f15},~{$f16},~{$f17},~{$f18},~{$f19},~{$f20},~{$f21},~{$f22},~{$f23},~{$f24},~{$f25},~{$f26},~{$f27},~{$f28},~{$f29},~{$f30},~{$f31}" + } case "riscv32": asmString = ` la a2, 1f |