diff --git a/.circleci/config.yml b/.circleci/config.yml index a0cc3bd9..be4d764d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,6 +66,7 @@ commands: - run: tinygo build -size short -o test.elf -target=pca10056 examples/blinky2 - run: tinygo build -size short -o test.elf -target=itsybitsy-m0 examples/blinky1 - run: tinygo build -size short -o test.elf -target=circuitplay-express examples/blinky1 + - run: tinygo build -o wasm.wasm -target=wasm examples/wasm test-linux: parameters: llvm: diff --git a/.travis.yml b/.travis.yml index bfcbcf8d..d2f92377 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,3 +38,4 @@ script: - tinygo build -size short -o blinky1.pca10056.elf -target=pca10056 examples/blinky1 - tinygo build -size short -o blinky2.pca10056.elf -target=pca10056 examples/blinky2 - tinygo build -size short -o blinky1.samd21.elf -target=itsybitsy-m0 examples/blinky1 + - tinygo build -o wasm.wasm -target=wasm examples/wasm diff --git a/commands_macos.go b/commands_macos.go index bd14aa7b..24f16314 100644 --- a/commands_macos.go +++ b/commands_macos.go @@ -7,5 +7,5 @@ var commands = map[string]string{ "ar": "llvm-ar", "clang": "clang-8", "ld.lld": "ld.lld-8", - "wasm-ld": "wasm-ld-8", + "wasm-ld": "wasm-ld", } diff --git a/main.go b/main.go index b9cb3d03..1ac46f4d 100644 --- a/main.go +++ b/main.go @@ -228,7 +228,11 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act } // Link the object files together. - err = Link(sourceDir(), spec.Linker, ldflags...) + if linker, ok := commands[spec.Linker]; ok { + err = Link(sourceDir(), linker, ldflags...) + } else { + err = Link(sourceDir(), spec.Linker, ldflags...) + } if err != nil { return &commandError{"failed to link", executable, err} } diff --git a/targets/wasm.json b/targets/wasm.json index 08d33420..06988a53 100644 --- a/targets/wasm.json +++ b/targets/wasm.json @@ -4,7 +4,7 @@ "goos": "js", "goarch": "wasm", "compiler": "clang-8", - "linker": "wasm-ld-8", + "linker": "wasm-ld", "cflags": [ "--target=wasm32", "-Oz"