Merge pull request #1349 from goplus/xgopilot/claude/issue-1346-1760499310

fix: set build.Default.Compiler to gc in init function
This commit is contained in:
xushiwei
2025-10-27 07:16:15 +08:00
committed by GitHub
4 changed files with 171 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
// Copyright 2024 The GoPlus Authors (goplus.org). All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package build provides alternative implementations for go/build.
// We override build.Default.Compiler in an init function.
package build
import (
"go/build"
)
func init() {
// LLGO PATCH: Override build.Default.Compiler to be "gc" instead of "llgo"
// This prevents "unknown compiler" errors when user code uses go/build package
// Even though runtime.Compiler = "llgo", we set build.Default.Compiler = "gc"
build.Default.Compiler = "gc"
}

View File

@@ -140,6 +140,10 @@ type Func struct {
opaque struct{} // unexported field to disallow conversions
}
func (f *Func) Name() string {
panic("todo")
}
// moduledata records information about the layout of the executable
// image. It is written by the linker. Any changes here must be
// matched changes to the code in cmd/link/internal/ld/symtab.go:symtab.