main.c 847 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2015 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. #include <stdint.h>
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include "p.h"
  8. #include "libgo.h"
  9. extern int install_handler();
  10. extern int check_handler();
  11. int main(void) {
  12. int32_t res;
  13. int r1 = install_handler();
  14. if (r1!=0) {
  15. return r1;
  16. }
  17. if (!DidInitRun()) {
  18. fprintf(stderr, "ERROR: buildmode=c-archive init should run\n");
  19. return 2;
  20. }
  21. if (DidMainRun()) {
  22. fprintf(stderr, "ERROR: buildmode=c-archive should not run main\n");
  23. return 2;
  24. }
  25. int r2 = check_handler();
  26. if (r2!=0) {
  27. return r2;
  28. }
  29. res = FromPkg();
  30. if (res != 1024) {
  31. fprintf(stderr, "ERROR: FromPkg()=%d, want 1024\n", res);
  32. return 2;
  33. }
  34. CheckArgs();
  35. fprintf(stderr, "PASS\n");
  36. return 0;
  37. }