ethashc.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2015 The go-ethereum Authors
  2. // This file is part of the go-ethereum library.
  3. //
  4. // The go-ethereum library is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Lesser General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // The go-ethereum library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
  16. package ethash
  17. /*
  18. -mno-stack-arg-probe disables stack probing which avoids the function
  19. __chkstk_ms being linked. this avoids a clash of this symbol as we also
  20. separately link the secp256k1 lib which ends up defining this symbol
  21. 1. https://gcc.gnu.org/onlinedocs/gccint/Stack-Checking.html
  22. 2. https://groups.google.com/forum/#!msg/golang-dev/v1bziURSQ4k/88fXuJ24e-gJ
  23. 3. https://groups.google.com/forum/#!topic/golang-nuts/VNP6Mwz_B6o
  24. */
  25. /*
  26. #cgo CFLAGS: -std=gnu99 -Wall
  27. #cgo windows CFLAGS: -mno-stack-arg-probe
  28. #cgo LDFLAGS: -lm
  29. #include "src/libethash/internal.c"
  30. #include "src/libethash/sha3.c"
  31. #include "src/libethash/io.c"
  32. #ifdef _WIN32
  33. # include "src/libethash/io_win32.c"
  34. # include "src/libethash/mmap_win32.c"
  35. #else
  36. # include "src/libethash/io_posix.c"
  37. #endif
  38. // 'gateway function' for calling back into go.
  39. extern int ethashGoCallback(unsigned);
  40. int ethashGoCallback_cgo(unsigned percent) { return ethashGoCallback(percent); }
  41. */
  42. import "C"