build: let llgo build without -o outputs executable
This commit is contained in:
@@ -206,7 +206,7 @@ func Do(args []string, conf *Config) ([]Package, error) {
|
|||||||
env := llvm.New("")
|
env := llvm.New("")
|
||||||
os.Setenv("PATH", env.BinDir()+":"+os.Getenv("PATH")) // TODO(xsw): check windows
|
os.Setenv("PATH", env.BinDir()+":"+os.Getenv("PATH")) // TODO(xsw): check windows
|
||||||
|
|
||||||
output := mode != ModeBuild || conf.OutFile != ""
|
output := conf.OutFile != ""
|
||||||
ctx := &context{env, cfg, progSSA, prog, dedup, patches, make(map[string]none), initial, mode, 0, output, make(map[*packages.Package]bool), make(map[*packages.Package]bool)}
|
ctx := &context{env, cfg, progSSA, prog, dedup, patches, make(map[string]none), initial, mode, 0, output, make(map[*packages.Package]bool), make(map[*packages.Package]bool)}
|
||||||
pkgs, err := buildAllPkgs(ctx, initial, verbose)
|
pkgs, err := buildAllPkgs(ctx, initial, verbose)
|
||||||
check(err)
|
check(err)
|
||||||
@@ -226,13 +226,12 @@ func Do(args []string, conf *Config) ([]Package, error) {
|
|||||||
linkArgs = append(linkArgs, pkg.LinkArgs...)
|
linkArgs = append(linkArgs, pkg.LinkArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.output {
|
|
||||||
for _, pkg := range initial {
|
for _, pkg := range initial {
|
||||||
if needLink(pkg, mode) {
|
if needLink(pkg, mode) {
|
||||||
linkMainPkg(ctx, pkg, pkgs, linkArgs, conf, mode, verbose)
|
linkMainPkg(ctx, pkg, pkgs, linkArgs, conf, mode, verbose)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return dpkg, nil
|
return dpkg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,7 +609,6 @@ func buildPkg(ctx *context, aPkg *aPackage, verbose bool) (cgoLdflags []string,
|
|||||||
}
|
}
|
||||||
cgoLdflags = append(cgoLdflags, altLdflags...)
|
cgoLdflags = append(cgoLdflags, altLdflags...)
|
||||||
}
|
}
|
||||||
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)
|
||||||
if debugBuild || verbose {
|
if debugBuild || verbose {
|
||||||
@@ -621,7 +619,6 @@ func buildPkg(ctx *context, aPkg *aPackage, verbose bool) (cgoLdflags []string,
|
|||||||
fmt.Fprintf(os.Stderr, "==> lcc %v: %v\n%v\n", pkg.PkgPath, pkg.ExportFile, msg)
|
fmt.Fprintf(os.Stderr, "==> lcc %v: %v\n%v\n", pkg.PkgPath, pkg.ExportFile, msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user