mirror of
https://github.com/golang/go.git
synced 2026-02-01 00:22:03 +03:00
cmd/link: add LIBRARY statement only with -buildmode=cshared
When creating a .def file for Windows linking, add a LIBRARY statement only when building a DLL with -buildmode=cshared. That statement is documented to instruct the linker to create a DLL, overriding any other flag that might indicate building an executable. Fixes #75734 Change-Id: I0231435df70b71a493a39deb639f6328a8e354f6 Reviewed-on: https://go-review.googlesource.com/c/go/+/708815 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Dominic Della Valle <ddvpublic@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
@@ -1758,7 +1758,9 @@ func peCreateExportFile(ctxt *Link, libName string) (fname string) {
|
||||
fname = filepath.Join(*flagTmpdir, "export_file.def")
|
||||
var buf bytes.Buffer
|
||||
|
||||
fmt.Fprintf(&buf, "LIBRARY %s\n", libName)
|
||||
if ctxt.BuildMode == BuildModeCShared {
|
||||
fmt.Fprintf(&buf, "LIBRARY %s\n", libName)
|
||||
}
|
||||
buf.WriteString("EXPORTS\n")
|
||||
|
||||
ldr := ctxt.loader
|
||||
|
||||
Reference in New Issue
Block a user