mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
25cd982263
When building statically against LLVM, LLD is also included now. When included, the built in wasm-ld will automatically be used instead of the external command. There is also support for linking ELF files but because lld does not fully support armv6m this is not yet enabled (it produces a warning).
23 lines
515 B
Go
23 lines
515 B
Go
// +build !byollvm
|
|
|
|
package main
|
|
|
|
// 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"
|
|
)
|
|
|
|
// Link invokes a linker with the given name and arguments.
|
|
//
|
|
// This version always runs the linker as an external command.
|
|
func Link(dir, linker string, flags ...string) error {
|
|
cmd := exec.Command(linker, flags...)
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
cmd.Dir = dir
|
|
return cmd.Run()
|
|
}
|