mirror of https://github.com/tinygo-org/tinygo.git
wasmstm32webassemblymicrocontrollerarmavrspiwasiadafruitarduinocircuitplayground-expressgpioi2cllvmmicrobitnrf51nrf52nrf52840samd21tinygo
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
659 B
28 lines
659 B
6 years ago
|
// +build !byollvm
|
||
|
|
||
5 years ago
|
package builder
|
||
6 years ago
|
|
||
|
// This file provides a Link() function that always runs an external command. It
|
||
|
// is provided for when tinygo is built without linking to liblld.
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"os/exec"
|
||
5 years ago
|
|
||
|
"github.com/tinygo-org/tinygo/goenv"
|
||
6 years ago
|
)
|
||
|
|
||
5 years ago
|
// link invokes a linker with the given name and arguments.
|
||
6 years ago
|
//
|
||
|
// This version always runs the linker as an external command.
|
||
5 years ago
|
func link(linker string, flags ...string) error {
|
||
6 years ago
|
if cmdNames, ok := commands[linker]; ok {
|
||
|
return execCommand(cmdNames, flags...)
|
||
|
}
|
||
6 years ago
|
cmd := exec.Command(linker, flags...)
|
||
|
cmd.Stdout = os.Stdout
|
||
|
cmd.Stderr = os.Stderr
|
||
5 years ago
|
cmd.Dir = goenv.Get("TINYGOROOT")
|
||
6 years ago
|
return cmd.Run()
|
||
|
}
|