mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 18:53:29 +00:00
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.
This commit is contained in:
committed by
Ron Evans
parent
6efc6d2bb6
commit
f188eaf5f9
+11
-1
@@ -30,8 +30,11 @@ var Keys = []string{
|
||||
}
|
||||
|
||||
func init() {
|
||||
if Get("GOARCH") == "arm" {
|
||||
switch Get("GOARCH") {
|
||||
case "arm":
|
||||
Keys = append(Keys, "GOARM")
|
||||
case "mips", "mipsle":
|
||||
Keys = append(Keys, "GOMIPS")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +131,13 @@ func Get(name string) string {
|
||||
// difference between ARMv6 and ARMv7. ARMv6 binaries are much smaller,
|
||||
// especially when floating point instructions are involved.
|
||||
return "6"
|
||||
case "GOMIPS":
|
||||
gomips := os.Getenv("GOMIPS")
|
||||
if gomips == "" {
|
||||
// Default to hardfloat (this matches the Go toolchain).
|
||||
gomips = "hardfloat"
|
||||
}
|
||||
return gomips
|
||||
case "GOROOT":
|
||||
readGoEnvVars()
|
||||
return goEnvVars.GOROOT
|
||||
|
||||
Reference in New Issue
Block a user