diff options
author | Ayke van Laethem <[email protected]> | 2021-11-05 13:23:08 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-11-16 11:08:30 +0100 |
commit | 869e917dc6959445fac6ee4d93cd10c98ab445e5 (patch) | |
tree | 451d6c4b9a07b60a58f9db5d865720bf95498904 /builder/tools-builtin.go | |
parent | 41bcad9c194d92ba90f6f42f680087efa4f0e998 (diff) | |
download | tinygo-869e917dc6959445fac6ee4d93cd10c98ab445e5.tar.gz tinygo-869e917dc6959445fac6ee4d93cd10c98ab445e5.zip |
all: add support for windows/amd64
This uses Mingw-w64, which seems to be the de facto standard for porting
Unixy programs to Windows.
Diffstat (limited to 'builder/tools-builtin.go')
-rw-r--r-- | builder/tools-builtin.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/builder/tools-builtin.go b/builder/tools-builtin.go index 61e7a325b..29dfa8613 100644 --- a/builder/tools-builtin.go +++ b/builder/tools-builtin.go @@ -13,6 +13,7 @@ import ( #include <stdlib.h> bool tinygo_clang_driver(int argc, char **argv); bool tinygo_link_elf(int argc, char **argv); +bool tinygo_link_mingw(int argc, char **argv); bool tinygo_link_wasm(int argc, char **argv); */ import "C" @@ -24,6 +25,10 @@ const hasBuiltinTools = true // This version actually runs the tools because TinyGo was compiled while // linking statically with LLVM (with the byollvm build tag). func RunTool(tool string, args ...string) error { + linker := "elf" + if tool == "ld.lld" && len(args) >= 2 && args[0] == "-m" && args[1] == "i386pep" { + linker = "mingw" + } args = append([]string{"tinygo:" + tool}, args...) var cflag *C.char @@ -41,7 +46,14 @@ func RunTool(tool string, args ...string) error { case "clang": ok = C.tinygo_clang_driver(C.int(len(args)), (**C.char)(buf)) case "ld.lld": - ok = C.tinygo_link_elf(C.int(len(args)), (**C.char)(buf)) + switch linker { + case "elf": + ok = C.tinygo_link_elf(C.int(len(args)), (**C.char)(buf)) + case "mingw": + ok = C.tinygo_link_mingw(C.int(len(args)), (**C.char)(buf)) + default: + return errors.New("unknown linker: " + linker) + } case "wasm-ld": ok = C.tinygo_link_wasm(C.int(len(args)), (**C.char)(buf)) default: |