
This commit adds the TinyGo root directory (`TINYGOROOT`) to the linker script `-L` search path, so that linker scripts can be found when running `tinygo` outside of the TinyGo root. This was already working before when using an external linker by setting the working directory, but this is not possible when using the internal linker. However, by adding the root directory to the linker search path (`-L`), it can now find these linker scripts. fixes #265
21 строка
495 Б
Go
21 строка
495 Б
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(linker string, flags ...string) error {
|
|
cmd := exec.Command(linker, flags...)
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
return cmd.Run()
|
|
}
|