From 8e2d901935ab864f8524550e4cdfb0514818bd3b Mon Sep 17 00:00:00 2001 From: visualfc Date: Fri, 21 Jun 2024 07:51:05 +0800 Subject: [PATCH] x/build: fix build math on amd64 --- internal/build/build.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/build/build.go b/internal/build/build.go index 07257c8c3..124b0adc1 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -111,6 +111,10 @@ const ( loadSyntax = loadTypes | packages.NeedSyntax | packages.NeedTypesInfo ) +var skipPkgFiles = map[string]string{ + "math/exp_amd64.go": "math", +} + func Do(args []string, conf *Config) { flags, patterns, verbose := ParseArgs(args, buildFlags) cfg := &packages.Config{ @@ -119,6 +123,13 @@ func Do(args []string, conf *Config) { Fset: token.NewFileSet(), } + if len(skipPkgFiles) > 0 { + cfg.Overlay = make(map[string][]byte) + for file, pkg := range skipPkgFiles { + cfg.Overlay[filepath.Join(runtime.GOROOT(), "src", file)] = []byte("package " + pkg) + } + } + llssa.Initialize(llssa.InitAll) if verbose { llssa.SetDebug(llssa.DbgFlagAll)