build: patch packages supports cgo

This commit is contained in:
Li Jie
2025-01-10 18:17:40 +08:00
parent 623b5a511a
commit b07116f302
2 changed files with 10 additions and 1 deletions

View File

@@ -587,6 +587,13 @@ func buildPkg(ctx *context, aPkg *aPackage, verbose bool) (cgoLdflags []string,
check(err) check(err)
aPkg.LPkg = ret aPkg.LPkg = ret
cgoLdflags, err = buildCgo(ctx, aPkg, aPkg.Package.Syntax, externs, verbose) cgoLdflags, err = buildCgo(ctx, aPkg, aPkg.Package.Syntax, externs, verbose)
if aPkg.AltPkg != nil {
altLdflags, e := buildCgo(ctx, aPkg, aPkg.AltPkg.Syntax, externs, verbose)
if e != nil {
return nil, e
}
cgoLdflags = append(cgoLdflags, altLdflags...)
}
if ctx.output { if ctx.output {
pkg.ExportFile += ".ll" pkg.ExportFile += ".ll"
os.WriteFile(pkg.ExportFile, []byte(ret.String()), 0644) os.WriteFile(pkg.ExportFile, []byte(ret.String()), 0644)

View File

@@ -16,11 +16,13 @@
package runtime package runtime
// llgo:skipall
import ( import (
_ "unsafe" _ "unsafe"
) )
// llgo:skipall
type _runtime struct{}
// GOROOT returns the root of the Go tree. It uses the // GOROOT returns the root of the Go tree. It uses the
// GOROOT environment variable, if set at process start, // GOROOT environment variable, if set at process start,
// or else the root used during the Go build. // or else the root used during the Go build.