Merge pull request #1204 from visualfc/checklink
internal/build: set CheckLinkArgs disable on default
This commit is contained in:
@@ -274,7 +274,8 @@ func Do(args []string, conf *Config) ([]Package, error) {
|
||||
needPyInit: make(map[*packages.Package]bool),
|
||||
buildConf: conf,
|
||||
crossCompile: export,
|
||||
isCheckEnable: IsCheckEnable(),
|
||||
isCheckEnabled: IsCheckEnabled(),
|
||||
isCheckLinkArgsEnabled: IsCheckLinkArgsEnabled(),
|
||||
}
|
||||
pkgs, err := buildAllPkgs(ctx, initial, verbose)
|
||||
check(err)
|
||||
@@ -364,7 +365,8 @@ type context struct {
|
||||
nLibdir int
|
||||
output bool
|
||||
|
||||
isCheckEnable bool
|
||||
isCheckEnabled bool
|
||||
isCheckLinkArgsEnabled bool
|
||||
|
||||
needRt map[*packages.Package]bool
|
||||
needPyInit map[*packages.Package]bool
|
||||
@@ -463,9 +465,11 @@ func buildAllPkgs(ctx *context, initial []*packages.Package, verbose bool) (pkgs
|
||||
ctx.nLibdir++
|
||||
}
|
||||
}
|
||||
if ctx.isCheckLinkArgsEnabled {
|
||||
if err := ctx.compiler().CheckLinkArgs(pkgLinkArgs, isWasmTarget(ctx.buildConf.Goos)); err != nil {
|
||||
panic(fmt.Sprintf("test link args '%s' failed\n\texpanded to: %v\n\tresolved to: %v\n\terror: %v", param, expdArgs, pkgLinkArgs, err))
|
||||
}
|
||||
}
|
||||
aPkg.LinkArgs = append(aPkg.LinkArgs, pkgLinkArgs...)
|
||||
}
|
||||
default:
|
||||
@@ -838,7 +842,7 @@ func exportObject(ctx *context, pkgPath string, exportFile string, data []byte)
|
||||
if err != nil {
|
||||
return exportFile, err
|
||||
}
|
||||
if ctx.isCheckEnable {
|
||||
if ctx.isCheckEnabled {
|
||||
if msg, err := llcCheck(ctx.env, f.Name()); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "==> lcc %v: %v\n%v\n", pkgPath, f.Name(), msg)
|
||||
}
|
||||
@@ -984,6 +988,7 @@ const llgoCheck = "LLGO_CHECK"
|
||||
const llgoWasmRuntime = "LLGO_WASM_RUNTIME"
|
||||
const llgoWasiThreads = "LLGO_WASI_THREADS"
|
||||
const llgoStdioNobuf = "LLGO_STDIO_NOBUF"
|
||||
const llgoCheckLinkArgs = "LLGO_CHECK_LINKARGS"
|
||||
|
||||
const defaultWasmRuntime = "wasmtime"
|
||||
|
||||
@@ -1023,7 +1028,7 @@ func IsOptimizeEnabled() bool {
|
||||
return isEnvOn(llgoOptimize, true)
|
||||
}
|
||||
|
||||
func IsCheckEnable() bool {
|
||||
func IsCheckEnabled() bool {
|
||||
return isEnvOn(llgoCheck, false)
|
||||
}
|
||||
|
||||
@@ -1031,6 +1036,10 @@ func IsWasiThreadsEnabled() bool {
|
||||
return isEnvOn(llgoWasiThreads, true)
|
||||
}
|
||||
|
||||
func IsCheckLinkArgsEnabled() bool {
|
||||
return isEnvOn(llgoCheckLinkArgs, false)
|
||||
}
|
||||
|
||||
func WasmRuntime() string {
|
||||
return defaultEnv(llgoWasmRuntime, defaultWasmRuntime)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user