diff options
Diffstat (limited to 'src/cmd/cgo/main.go')
-rw-r--r-- | src/cmd/cgo/main.go | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/cmd/cgo/main.go b/src/cmd/cgo/main.go index 60165961a..7adc795de 100644 --- a/src/cmd/cgo/main.go +++ b/src/cmd/cgo/main.go @@ -31,6 +31,7 @@ type Package struct { PackageName string // name of package PackagePath string PtrSize int64 + IntSize int64 GccOptions []string CgoFlags map[string]string // #cgo flags (CFLAGS, LDFLAGS) Written map[string]bool @@ -129,12 +130,19 @@ var ptrSizeMap = map[string]int64{ "arm": 4, } +var intSizeMap = map[string]int64{ + "386": 4, + "amd64": 8, + "arm": 4, +} + var cPrefix string var fset = token.NewFileSet() var dynobj = flag.String("dynimport", "", "if non-empty, print dynamic import data for that file") var dynout = flag.String("dynout", "", "write -dynobj output to this file") +var dynlinker = flag.Bool("dynlinker", false, "record dynamic linker information in dynimport mode") // These flags are for bootstrapping a new Go implementation, // to generate Go and C headers that match the data layout and @@ -144,8 +152,10 @@ var cdefs = flag.Bool("cdefs", false, "for bootstrap: write C definitions for C var objDir = flag.String("objdir", "", "object directory") var gccgo = flag.Bool("gccgo", false, "generate files for use with gccgo") -var gccgoprefix = flag.String("gccgoprefix", "go", "prefix of symbols generated by gccgo") +var gccgoprefix = flag.String("gccgoprefix", "", "-fgo-prefix option used with gccgo") +var gccgopkgpath = flag.String("gccgopkgpath", "", "-fgo-pkgpath option used with gccgo") var importRuntimeCgo = flag.Bool("import_runtime_cgo", true, "import runtime/cgo in generated code") +var importSyscall = flag.Bool("import_syscall", true, "import syscall in generated code") var goarch, goos string func main() { @@ -287,7 +297,11 @@ func newPackage(args []string) *Package { } ptrSize := ptrSizeMap[goarch] if ptrSize == 0 { - fatalf("unknown $GOARCH %q", goarch) + fatalf("unknown ptrSize for $GOARCH %q", goarch) + } + intSize := intSizeMap[goarch] + if intSize == 0 { + fatalf("unknown intSize for $GOARCH %q", goarch) } // Reset locale variables so gcc emits English errors [sic]. @@ -296,6 +310,7 @@ func newPackage(args []string) *Package { p := &Package{ PtrSize: ptrSize, + IntSize: intSize, GccOptions: gccOptions, CgoFlags: make(map[string]string), Written: make(map[string]bool), |