From 43175bb642b5294dad27adfd1238ff51bc5bec8e Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sat, 8 Feb 2025 20:58:09 +0800 Subject: [PATCH] build: supports LLGoFiles in patches --- compiler/internal/build/build.go | 4 ++++ compiler/internal/packages/load.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/compiler/internal/build/build.go b/compiler/internal/build/build.go index e03f535a..b66d5beb 100644 --- a/compiler/internal/build/build.go +++ b/compiler/internal/build/build.go @@ -359,6 +359,10 @@ func buildAllPkgs(ctx *context, initial []*packages.Package, verbose bool) (pkgs panic(err) } aPkg.LinkArgs = append(cgoLdflags, pkg.ExportFile) + aPkg.LinkArgs = append(aPkg.LinkArgs, concatPkgLinkFiles(ctx, pkg, verbose)...) + if aPkg.AltPkg != nil { + aPkg.LinkArgs = append(aPkg.LinkArgs, concatPkgLinkFiles(ctx, aPkg.AltPkg.Package, verbose)...) + } setNeedRuntimeOrPyInit(ctx, pkg, prog.NeedRuntime, prog.NeedPyInit) } } diff --git a/compiler/internal/packages/load.go b/compiler/internal/packages/load.go index 66f4c29c..beeb6bdf 100644 --- a/compiler/internal/packages/load.go +++ b/compiler/internal/packages/load.go @@ -106,6 +106,7 @@ type loader struct { } type Cached struct { + *packages.Package Types *types.Package TypesInfo *types.Info Syntax []*ast.File @@ -189,6 +190,7 @@ func loadPackageEx(dedup Deduper, ld *loader, lpkg *loaderPackage) { defer func() { if !lpkg.IllTyped && lpkg.needtypes && lpkg.needsrc { dedup.set(lpkg.PkgPath, &Cached{ + Package: lpkg.Package, Types: lpkg.Types, TypesInfo: lpkg.TypesInfo, Syntax: lpkg.Syntax,