OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "container/heap" | 9 "container/heap" |
10 "errors" | 10 "errors" |
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 cgoLDFLAGS = cgoLDFLAGS[0 : len(cgoLDFLAGS)-1] | 1857 cgoLDFLAGS = cgoLDFLAGS[0 : len(cgoLDFLAGS)-1] |
1858 } | 1858 } |
1859 | 1859 |
1860 if _, ok := buildToolchain.(gccgoToolchain); ok { | 1860 if _, ok := buildToolchain.(gccgoToolchain); ok { |
1861 // we don't use dynimport when using gccgo. | 1861 // we don't use dynimport when using gccgo. |
1862 return outGo, outObj, nil | 1862 return outGo, outObj, nil |
1863 } | 1863 } |
1864 | 1864 |
1865 // cgo -dynimport | 1865 // cgo -dynimport |
1866 importC := obj + "_cgo_import.c" | 1866 importC := obj + "_cgo_import.c" |
1867 » if err := b.run(p.Dir, p.ImportPath, cgoExe, "-objdir", obj, "-dynimport
", dynobj, "-dynout", importC); err != nil { | 1867 » cgoflags = []string{} |
| 1868 » if p.Standard && p.ImportPath == "runtime/cgo" { |
| 1869 » » cgoflags = append(cgoflags, "-dynlinker") // record path to dyna
mic linker |
| 1870 » } |
| 1871 » if err := b.run(p.Dir, p.ImportPath, cgoExe, "-objdir", obj, "-dynimport
", dynobj, "-dynout", importC, cgoflags); err != nil { |
1868 return nil, nil, err | 1872 return nil, nil, err |
1869 } | 1873 } |
1870 | 1874 |
1871 // cc _cgo_import.ARCH | 1875 // cc _cgo_import.ARCH |
1872 importObj := obj + "_cgo_import." + objExt | 1876 importObj := obj + "_cgo_import." + objExt |
1873 if err := buildToolchain.cc(b, p, obj, importObj, importC); err != nil { | 1877 if err := buildToolchain.cc(b, p, obj, importObj, importC); err != nil { |
1874 return nil, nil, err | 1878 return nil, nil, err |
1875 } | 1879 } |
1876 | 1880 |
1877 ofile := obj + "_all.o" | 1881 ofile := obj + "_all.o" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 if goarch != "amd64" || goos != "linux" && goos != "darwin" && goos != "
windows" { | 2027 if goarch != "amd64" || goos != "linux" && goos != "darwin" && goos != "
windows" { |
2024 fmt.Fprintf(os.Stderr, "go %s: -race is only supported on linux/
amd64, darwin/amd64 and windows/amd64\n", flag.Args()[0]) | 2028 fmt.Fprintf(os.Stderr, "go %s: -race is only supported on linux/
amd64, darwin/amd64 and windows/amd64\n", flag.Args()[0]) |
2025 os.Exit(2) | 2029 os.Exit(2) |
2026 } | 2030 } |
2027 buildGcflags = append(buildGcflags, "-race") | 2031 buildGcflags = append(buildGcflags, "-race") |
2028 buildLdflags = append(buildLdflags, "-race") | 2032 buildLdflags = append(buildLdflags, "-race") |
2029 buildCcflags = append(buildCcflags, "-D", "RACE") | 2033 buildCcflags = append(buildCcflags, "-D", "RACE") |
2030 buildContext.InstallTag = "race" | 2034 buildContext.InstallTag = "race" |
2031 buildContext.BuildTags = append(buildContext.BuildTags, "race") | 2035 buildContext.BuildTags = append(buildContext.BuildTags, "race") |
2032 } | 2036 } |
OLD | NEW |