build: patch packages supports cgo
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user