nsenter_gccgo.go 502 B

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