github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/mergeCode/runc/libcontainer/nsenter/nsenter_gccgo.go (about)

     1  // +build linux,gccgo
     2  
     3  package nsenter
     4  
     5  /*
     6  #cgo CFLAGS: -Wall
     7  extern void nsexec();
     8  void __attribute__((constructor)) init(void) {
     9  	nsexec();
    10  }
    11  */
    12  import "C"
    13  
    14  // AlwaysFalse is here to stay false
    15  // (and be exported so the compiler doesn't optimize out its reference)
    16  var AlwaysFalse bool
    17  
    18  func init() {
    19  	if AlwaysFalse {
    20  		// by referencing this C init() in a noop test, it will ensure the compiler
    21  		// links in the C function.
    22  		// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65134
    23  		C.init()
    24  	}
    25  }