aboutsummaryrefslogtreecommitdiffhomepage
path: root/builder/library.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-07-30 19:08:55 +0200
committerRon Evans <[email protected]>2024-08-12 13:23:32 +0200
commitf188eaf5f92618adc6422c2b55db8f822c6cc458 (patch)
tree835fb9b43034c92ff679d386500c7c9f66a98290 /builder/library.go
parent6efc6d2bb6489a9157c5bd964bdc072ed23f29d1 (diff)
downloadtinygo-f188eaf5f92618adc6422c2b55db8f822c6cc458.tar.gz
tinygo-f188eaf5f92618adc6422c2b55db8f822c6cc458.zip
mips: add GOMIPS=softfloat support
Previously, the compiler would default to hardfloat. This is not supported by some MIPS CPUs. This took me much longer than it should have because of a quirk in the LLVM Mips backend: if the target-features string is not set (like during LTO), the Mips backend picks the first function in the module and uses that. Unfortunately, in the case of TinyGo this first function is `llvm.dbg.value`, which is an LLVM intrinsic and doesn't have the target-features string. I fixed it by adding a `-mllvm -mattr=` flag to the linker.
Diffstat (limited to 'builder/library.go')
-rw-r--r--builder/library.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/builder/library.go b/builder/library.go
index 0ab7fa0e4..b8d183414 100644
--- a/builder/library.go
+++ b/builder/library.go
@@ -169,6 +169,11 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
case "mips":
args = append(args, "-fno-pic")
}
+ if config.Target.SoftFloat {
+ // Use softfloat instead of floating point instructions. This is
+ // supported on many architectures.
+ args = append(args, "-msoft-float")
+ }
var once sync.Once