mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 04:53:42 +00:00
all: add WebAssembly backend
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/aykevl/go-llvm"
|
||||
)
|
||||
|
||||
// Target specification for a given target. Used for bare metal targets.
|
||||
@@ -30,6 +32,10 @@ type TargetSpec struct {
|
||||
|
||||
// Load a target specification
|
||||
func LoadTarget(target string) (*TargetSpec, error) {
|
||||
if target == "" {
|
||||
target = llvm.DefaultTargetTriple()
|
||||
}
|
||||
|
||||
spec := &TargetSpec{
|
||||
Triple: target,
|
||||
BuildTags: []string{runtime.GOOS, runtime.GOARCH},
|
||||
@@ -54,7 +60,7 @@ func LoadTarget(target string) (*TargetSpec, error) {
|
||||
// Expected a 'file not found' error, got something else.
|
||||
return nil, err
|
||||
} else {
|
||||
// No target spec available. This is fine.
|
||||
// No target spec available. Use the default one.
|
||||
}
|
||||
|
||||
return spec, nil
|
||||
|
||||
Reference in New Issue
Block a user