Source file src/runtime/cgo/windows.go

     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"
    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
    23  
    24  // No pthreads on Windows, these are always zero.
    25  
    26  //go:linkname _cgo_init _cgo_init
    27  var _cgo_init unsafe.Pointer
    28  
    29  //go:linkname _cgo_thread_start _cgo_thread_start
    30  var _cgo_thread_start unsafe.Pointer
    31  
    32  //go:linkname _cgo_sys_thread_create _cgo_sys_thread_create
    33  var _cgo_sys_thread_create unsafe.Pointer
    34  
    35  //go:linkname _cgo_bindm _cgo_bindm
    36  var _cgo_bindm unsafe.Pointer
    37  
    38  //go:linkname _cgo_getstackbound _cgo_getstackbound
    39  var _cgo_getstackbound unsafe.Pointer
    40  

View as plain text