| 1 |
// Copyright 2025 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
//go:build windows |
| 6 |
|
| 7 |
package cgo |
| 8 |
|
| 9 |
import _ "unsafe" // for go:linkname |
| 10 |
|
| 11 |
// _cgo_stub_export is only used to ensure there's at least one symbol |
| 12 |
// in the .def file passed to the external linker. |
| 13 |
// If there are no exported symbols, the unfortunate behavior of |
| 14 |
// the binutils linker is to also strip the relocations table, |
| 15 |
// resulting in non-PIE binary. The other option is the |
| 16 |
// --export-all-symbols flag, but we don't need to export all symbols |
| 17 |
// and this may overflow the export table (#40795). |
| 18 |
// See https://sourceware.org/bugzilla/show_bug.cgi?id=19011 |
| 19 |
// |
| 20 |
//go:cgo_export_static _cgo_stub_export |
| 21 |
//go:linkname _cgo_stub_export _cgo_stub_export |
| 22 |
var _cgo_stub_export uintptr |