
In particular, while LLVM lld supports -L for linker scripts imported with the `INCLUDE` command, GNU ld does not seem to support this. This is a prerequisite for supporting the HiFive1 board in the TinyGo Playground.
25 строки
605 Б
Go
25 строки
605 Б
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 {
|
|
if cmdNames, ok := commands[linker]; ok {
|
|
return execCommand(cmdNames, flags...)
|
|
}
|
|
cmd := exec.Command(linker, flags...)
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
cmd.Dir = sourceDir()
|
|
return cmd.Run()
|
|
}
|