all: use compiler-rt for builtins

This commit is contained in:
Ayke van Laethem
2018-10-07 17:37:27 +02:00
parent e8f211935e
commit 22da104530
11 changed files with 350 additions and 13 deletions
+16 -11
View File
@@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"os"
"os/user"
"path/filepath"
"runtime"
"strings"
@@ -17,6 +18,7 @@ type TargetSpec struct {
Triple string `json:"llvm-target"`
BuildTags []string `json:"build-tags"`
Linker string `json:"linker"`
CompilerRT bool `json:"compiler-rt"`
PreLinkArgs []string `json:"pre-link-args"`
Objcopy string `json:"objcopy"`
Flasher string `json:"flash"`
@@ -72,16 +74,19 @@ func getGopath() string {
}
// fallback
var home string
if runtime.GOOS == "windows" {
home = os.Getenv("USERPROFILE")
} else {
home = os.Getenv("HOME")
}
if home == "" {
// This is very unlikely, so panic here.
// Not the nicest solution, however.
panic("no $HOME or %USERPROFILE% found")
}
home := getHomeDir()
return filepath.Join(home, "go")
}
func getHomeDir() string {
u, err := user.Current()
if err != nil {
panic("cannot get current user: " + err.Error())
}
if u.HomeDir == "" {
// This is very unlikely, so panic here.
// Not the nicest solution, however.
panic("could not find home directory")
}
return u.HomeDir
}