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