Skip to content

Commit

Permalink
Merge pull request #383 from visualfc/skipfiles
Browse files Browse the repository at this point in the history
x/build: overlayFiles for fix math on amd64
  • Loading branch information
xushiwei authored Jun 21, 2024
2 parents 34fe3ca + 79e8921 commit b6e5980
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ const (
loadSyntax = loadTypes | packages.NeedSyntax | packages.NeedTypesInfo
)

var overlayFiles = map[string]string{
"math/exp_amd64.go": "package math;",
}

func Do(args []string, conf *Config) {
flags, patterns, verbose := ParseArgs(args, buildFlags)
cfg := &packages.Config{
Expand All @@ -119,6 +123,13 @@ func Do(args []string, conf *Config) {
Fset: token.NewFileSet(),
}

if len(overlayFiles) > 0 {
cfg.Overlay = make(map[string][]byte)
for file, src := range overlayFiles {
cfg.Overlay[filepath.Join(runtime.GOROOT(), "src", file)] = []byte(src)
}
}

llssa.Initialize(llssa.InitAll)
if verbose {
llssa.SetDebug(llssa.DbgFlagAll)
Expand Down

0 comments on commit b6e5980

Please sign in to comment.