]> Cypherpunks repositories - gostls13.git/commitdiff
go/build: support building cgo packages on non intel platforms
authorDave Cheney <dave@cheney.net>
Thu, 16 Jun 2011 03:35:27 +0000 (13:35 +1000)
committerAndrew Gerrand <adg@golang.org>
Thu, 16 Jun 2011 03:35:27 +0000 (13:35 +1000)
See https://golang.org/cl/4572045/

R=adg, rsc
CC=golang-dev
https://golang.org/cl/4627041

src/pkg/go/build/build.go
src/pkg/go/build/build_test.go

index a83e8eefc166cdb65a5d19a1aa194c2ea9ee679a..206725f440a30054f18708f079272e442eef2e9f 100644 (file)
@@ -331,11 +331,14 @@ func (b *build) gccLink(ofile string, ofiles ...string) {
 
 func (b *build) gccArgs(args ...string) []string {
        // TODO(adg): HOST_CC
-       m := "-m32"
-       if b.arch == "6" {
-               m = "-m64"
+       a := []string{"gcc", "-I", b.path, "-g", "-fPIC", "-O2"}
+       switch b.arch {
+       case "8":
+               a = append(a, "-m32")
+       case "6":
+               a = append(a, "-m64")
        }
-       return append([]string{"gcc", m, "-I", b.path, "-g", "-fPIC", "-O2"}, args...)
+       return append(a, args...)
 }
 
 func (b *build) cgo(cgofiles []string) (outGo, outObj []string) {
index 4bd52868d3ce84e8ea17b38b6b5e61ff02bfb2ed..e59d87672ca6e43b1086441dc29739da2be0b21b 100644 (file)
@@ -7,8 +7,6 @@ package build
 import (
        "exec"
        "path/filepath"
-       "runtime"
-       "strings"
        "testing"
 )
 
@@ -22,11 +20,6 @@ const cmdtestOutput = "3"
 
 func TestBuild(t *testing.T) {
        for _, pkg := range buildPkgs {
-               if runtime.GOARCH == "arm" && strings.Contains(pkg, "/cgo") {
-                       // no cgo for arm, yet.
-                       continue
-               }
-
                tree := Path[0] // Goroot
                dir := filepath.Join(tree.SrcDir(), pkg)