diff options
author | Ayke van Laethem <[email protected]> | 2024-06-24 20:22:16 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-07-22 16:21:26 +0200 |
commit | 725518f007663d6742f1e92ebc2d6d88418ccf61 (patch) | |
tree | 01489f64270419ddb28520cd040b24babddab475 /compileopts/target.go | |
parent | 04d1261f8a48b18a4404c52f858c35c0668316cd (diff) | |
download | tinygo-725518f007663d6742f1e92ebc2d6d88418ccf61.tar.gz tinygo-725518f007663d6742f1e92ebc2d6d88418ccf61.zip |
all: add linux/mipsle support
This adds linux/mipsle (little endian Mips) support to TinyGo.
It also adds experimental linux/mips (big-endian) support. It doesn't
quite work yet, some parts of the standard library (like the reflect
package) currently seem to assume a little-endian system.
Diffstat (limited to 'compileopts/target.go')
-rw-r--r-- | compileopts/target.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/compileopts/target.go b/compileopts/target.go index 646029e44..fdb29e210 100644 --- a/compileopts/target.go +++ b/compileopts/target.go @@ -193,6 +193,10 @@ func LoadTarget(options *Options) (*TargetSpec, error) { default: return nil, fmt.Errorf("invalid GOARM=%s, must be 5, 6, or 7", options.GOARM) } + case "mips": + llvmarch = "mips" + case "mipsle": + llvmarch = "mipsel" case "wasm": llvmarch = "wasm32" default: @@ -327,6 +331,10 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { } else { // linux spec.Features = "+fp-armv8,+neon,-fmv,-outline-atomics" } + case "mips", "mipsle": + spec.CPU = "mips32r2" + spec.Features = "+fpxx,+mips32r2,+nooddspreg,-noabicalls" + spec.CFlags = append(spec.CFlags, "-fno-pic") case "wasm": spec.CPU = "generic" spec.Features = "+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" @@ -419,8 +427,12 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { // operating systems so we need separate assembly files. suffix = "_windows" } - spec.ExtraFiles = append(spec.ExtraFiles, "src/runtime/asm_"+goarch+suffix+".S") - spec.ExtraFiles = append(spec.ExtraFiles, "src/internal/task/task_stack_"+goarch+suffix+".S") + asmGoarch := goarch + if goarch == "mips" || goarch == "mipsle" { + asmGoarch = "mipsx" + } + spec.ExtraFiles = append(spec.ExtraFiles, "src/runtime/asm_"+asmGoarch+suffix+".S") + spec.ExtraFiles = append(spec.ExtraFiles, "src/internal/task/task_stack_"+asmGoarch+suffix+".S") } if goarch != runtime.GOARCH { // Some educated guesses as to how to invoke helper programs. @@ -438,6 +450,10 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { spec.Emulator = "qemu-arm {}" case "arm64": spec.Emulator = "qemu-aarch64 {}" + case "mips": + spec.Emulator = "qemu-mips {}" + case "mipsle": + spec.Emulator = "qemu-mipsel {}" } } } |