mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: attempt to rationalize linkmode init
This CL gives Linkmode a type, switches it to the standard flag handling mechanism, and deduplicates some logic. There is a semantic change in this CL. Previously if a link was invoked explicitly with -linkmode=internal, any condition that forced external linking would silently override this and use external linking. Instead it now fails with a reason why. I believe this is an improvement, but will change it back if there's disagreement. Fixes #12848 Change-Id: Ic80e341fff65ecfdd2b6fdd6079674cc7210fc5f Reviewed-on: https://go-review.googlesource.com/28971 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
1df438f79c
commit
6007c8c76b
13 changed files with 250 additions and 338 deletions
|
|
@ -48,6 +48,7 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
flag.Var(&Linkmode, "linkmode", "set link `mode`")
|
||||
flag.Var(&Buildmode, "buildmode", "set build `mode`")
|
||||
flag.Var(&Headtype, "H", "set header `type`")
|
||||
flag.Var(&rpath, "r", "set the ELF dynamic linker search `path` to dir1:dir2:...")
|
||||
|
|
@ -59,7 +60,6 @@ var (
|
|||
|
||||
flagOutfile = flag.String("o", "", "write output to `file`")
|
||||
FlagLinkshared = flag.Bool("linkshared", false, "link against installed Go shared libraries")
|
||||
Buildmode BuildMode
|
||||
|
||||
flagInstallSuffix = flag.String("installsuffix", "", "set package directory `suffix`")
|
||||
flagDumpDep = flag.Bool("dumpdep", false, "dump symbol dependency graph")
|
||||
|
|
@ -120,7 +120,6 @@ func Main() {
|
|||
obj.Flagfn0("V", "print version and exit", doversion)
|
||||
obj.Flagfn1("X", "add string value `definition` of the form importpath.name=value", func(s string) { addstrdata1(ctxt, s) })
|
||||
obj.Flagcount("v", "print link trace", &ctxt.Debugvlog)
|
||||
obj.Flagfn1("linkmode", "set link `mode` (internal, external, auto)", setlinkmode)
|
||||
|
||||
obj.Flagparse(usage)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue