From 88ca80b32286eb337185151249606dec302fe1d9 Mon Sep 17 00:00:00 2001 From: Ayan George Date: Fri, 23 Aug 2019 11:38:12 -0400 Subject: [PATCH] plugin: add freebsd/amd64 plugin support Change-Id: I4e7b0e99fd0f6f7d6a8ef60e9d3cb5baeb80a2b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/191617 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/cmd/dist/test.go | 2 ++ src/cmd/go/internal/work/init.go | 1 + src/cmd/link/internal/ld/config.go | 2 +- src/plugin/plugin.go | 2 +- src/plugin/plugin_dlopen.go | 2 +- src/plugin/plugin_stubs.go | 2 +- 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index f63c94697c..3be9754e67 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -972,6 +972,8 @@ func (t *tester) supportedBuildmode(mode string) bool { return true case "darwin-amd64": return true + case "freebsd-amd64": + return true } return false case "pie": diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go index 35d3a505cc..c220d87123 100644 --- a/src/cmd/go/internal/work/init.go +++ b/src/cmd/go/internal/work/init.go @@ -197,6 +197,7 @@ func buildModeInit() { case "darwin/amd64": // Skip DWARF generation due to #21647 forcedLdflags = append(forcedLdflags, "-w") + case "freebsd/amd64": default: base.Fatalf("-buildmode=plugin not supported on %s\n", platform) } diff --git a/src/cmd/link/internal/ld/config.go b/src/cmd/link/internal/ld/config.go index 8525a033da..e119599317 100644 --- a/src/cmd/link/internal/ld/config.go +++ b/src/cmd/link/internal/ld/config.go @@ -95,7 +95,7 @@ func (mode *BuildMode) Set(s string) error { default: return badmode() } - case "darwin": + case "darwin", "freebsd": switch objabi.GOARCH { case "amd64": default: diff --git a/src/plugin/plugin.go b/src/plugin/plugin.go index 5506e95692..4a524bfa3f 100644 --- a/src/plugin/plugin.go +++ b/src/plugin/plugin.go @@ -13,7 +13,7 @@ // already part of the program are called. The main function is not run. // A plugin is only initialized once, and cannot be closed. // -// Currently plugins are only supported on Linux and macOS. +// Currently plugins are only supported on Linux, FreeBSD, and macOS. // Please report any issues. package plugin diff --git a/src/plugin/plugin_dlopen.go b/src/plugin/plugin_dlopen.go index 03d3f08717..9200fdc3cb 100644 --- a/src/plugin/plugin_dlopen.go +++ b/src/plugin/plugin_dlopen.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux,cgo darwin,cgo +// +build linux,cgo darwin,cgo freebsd,cgo package plugin diff --git a/src/plugin/plugin_stubs.go b/src/plugin/plugin_stubs.go index 40a41643b1..1893203017 100644 --- a/src/plugin/plugin_stubs.go +++ b/src/plugin/plugin_stubs.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !linux,!darwin !cgo +// +build !linux,!freebsd,!darwin !cgo package plugin -- 2.50.0