Commit 24bf8f62 authored by Ian Lance Taylor's avatar Ian Lance Taylor

cmd/go: gc never permits C files; gccgo always does

Change-Id: I513665626ec0866f32036c26207dc234c17acea1
Reviewed-on: https://go-review.googlesource.com/1540Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarMinux Ma <minux@golang.org>
parent a034e478
...@@ -629,9 +629,8 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package ...@@ -629,9 +629,8 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
} }
p.Target = p.target p.Target = p.target
// Check for C code compiled with Plan 9 C compiler. // The gc toolchain only permits C source files with cgo.
// No longer allowed except in runtime and runtime/cgo, for now. if len(p.CFiles) > 0 && !p.usesCgo() && buildContext.Compiler == "gc" {
if len(p.CFiles) > 0 && !p.usesCgo() && (!p.Standard || p.ImportPath != "runtime") {
p.Error = &PackageError{ p.Error = &PackageError{
ImportStack: stk.copy(), ImportStack: stk.copy(),
Err: fmt.Sprintf("C source files not allowed when not using cgo: %s", strings.Join(p.CFiles, " ")), Err: fmt.Sprintf("C source files not allowed when not using cgo: %s", strings.Join(p.CFiles, " ")),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment