Этот коммит содержится в:
Dmitri Goutnik 2019-12-14 07:36:47 -05:00 коммит произвёл Ron Evans
родитель 3b2a4b64c5
коммит 71a380ce8c
8 изменённых файлов: 25 добавлений и 5 удалений

Просмотреть файл

@ -62,6 +62,11 @@ $(LIBCLANG_PATH): $(LIBCLANG_FILES)
else ifeq ($(shell uname -s),Darwin)
MD5SUM = md5
LIBCLANG_PATH = $(abspath $(LLVM_BUILDDIR))/lib/libclang.a
else ifeq ($(shell uname -s),FreeBSD)
MD5SUM = md5
LIBCLANG_PATH = $(abspath $(LLVM_BUILDDIR))/lib/libclang.a
START_GROUP = -Wl,--start-group
END_GROUP = -Wl,--end-group
else
LIBCLANG_PATH = $(abspath $(LLVM_BUILDDIR))/lib/libclang.a
START_GROUP = -Wl,--start-group

Просмотреть файл

@ -34,6 +34,12 @@ func init() {
commands["ld.lld"] = append(commands["ld.lld"], "lld", "C:\\Program Files\\LLVM\\bin\\lld.exe")
commands["wasm-ld"] = append(commands["wasm-ld"], "C:\\Program Files\\LLVM\\bin\\wasm-ld.exe")
}
// Add the path to the llvm90 installed from ports
if runtime.GOOS == "freebsd" {
commands["clang"] = append(commands["clang"], "/usr/local/llvm90/bin/clang-9")
commands["ld.lld"] = append(commands["ld.lld"], "/usr/local/llvm90/bin/ld.lld")
commands["wasm-ld"] = append(commands["wasm-ld"], "/usr/local/llvm90/bin/wasm-ld")
}
}
func execCommand(cmdNames []string, args ...string) error {

Просмотреть файл

@ -5,7 +5,9 @@ package cgo
/*
#cgo linux CFLAGS: -I/usr/lib/llvm-9/include
#cgo darwin CFLAGS: -I/usr/local/opt/llvm@9/include
#cgo freebsd CFLAGS: -I/usr/local/llvm90/include
#cgo linux LDFLAGS: -L/usr/lib/llvm-9/lib -lclang
#cgo darwin LDFLAGS: -L/usr/local/opt/llvm@9/lib -lclang -lffi
#cgo freebsd LDFLAGS: -L/usr/local/llvm90/lib -lclang
*/
import "C"

Просмотреть файл

@ -152,7 +152,7 @@ func (c *Compiler) emitSyscall(frame *Frame, call *ssa.CallCommon) (llvm.Value,
return llvm.Value{}, c.makeError(call.Pos(), "unknown GOOS/GOARCH for syscall: "+c.GOOS()+"/"+c.GOARCH())
}
switch c.GOOS() {
case "linux":
case "linux", "freebsd":
// Return values: r0, r1 uintptr, err Errno
// Pseudocode:
// var err uintptr

Просмотреть файл

@ -452,7 +452,7 @@ func flashUF2UsingMSD(volume, tmppath string) error {
// find standard UF2 info path
var infoPath string
switch runtime.GOOS {
case "linux":
case "linux", "freebsd":
infoPath = "/media/*/" + volume + "/INFO_UF2.TXT"
case "darwin":
infoPath = "/Volumes/" + volume + "/INFO_UF2.TXT"
@ -479,7 +479,7 @@ func flashHexUsingMSD(volume, tmppath string) error {
// find expected volume path
var destPath string
switch runtime.GOOS {
case "linux":
case "linux", "freebsd":
destPath = "/media/*/" + volume
case "darwin":
destPath = "/Volumes/" + volume
@ -558,6 +558,8 @@ func getDefaultPort() (port string, err error) {
portPath = "/dev/cu.usb*"
case "linux":
portPath = "/dev/ttyACM*"
case "freebsd":
portPath = "/dev/cuaU*"
case "windows":
cmd := exec.Command("wmic",
"PATH", "Win32_SerialPort", "WHERE", "Caption LIKE 'USB Serial%'", "GET", "DeviceID")

Просмотреть файл

@ -1,4 +1,4 @@
// +build darwin linux,!baremetal
// +build darwin linux,!baremetal freebsd,!baremetal
package os

5
src/runtime/os_freebsd.go Обычный файл
Просмотреть файл

@ -0,0 +1,5 @@
// +build freebsd
package runtime
const GOOS = "freebsd"

Просмотреть файл

@ -1,4 +1,4 @@
// +build darwin linux,!baremetal
// +build darwin linux,!baremetal freebsd,!baremetal
package runtime