Commit a2c50ece authored by Russ Cox's avatar Russ Cox

cmd/link: add -h flag, for debugging, same as cmd/compile

Change-Id: I3c9b05879fe0b6e94b63e9b65e4411ba2a917134
Reviewed-on: https://go-review.googlesource.com/10705Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 7e27625e
...@@ -1949,8 +1949,10 @@ func Diag(format string, args ...interface{}) { ...@@ -1949,8 +1949,10 @@ func Diag(format string, args ...interface{}) {
sep = ": " sep = ": "
} }
fmt.Printf("%s%s%s\n", tn, sep, fmt.Sprintf(format, args...)) fmt.Printf("%s%s%s\n", tn, sep, fmt.Sprintf(format, args...))
nerrors++ nerrors++
if Debug['h'] != 0 {
panic("error")
}
if nerrors > 20 { if nerrors > 20 {
Exitf("too many errors") Exitf("too many errors")
} }
......
...@@ -111,6 +111,7 @@ func Ldmain() { ...@@ -111,6 +111,7 @@ func Ldmain() {
obj.Flagstr("extldflags", "pass `flags` to external linker", &extldflags) obj.Flagstr("extldflags", "pass `flags` to external linker", &extldflags)
obj.Flagcount("f", "ignore version mismatch", &Debug['f']) obj.Flagcount("f", "ignore version mismatch", &Debug['f'])
obj.Flagcount("g", "disable go package data checks", &Debug['g']) obj.Flagcount("g", "disable go package data checks", &Debug['g'])
obj.Flagcount("h", "halt on error", &Debug['h'])
obj.Flagstr("installsuffix", "set package directory `suffix`", &flag_installsuffix) obj.Flagstr("installsuffix", "set package directory `suffix`", &flag_installsuffix)
obj.Flagstr("k", "set field tracking `symbol`", &tracksym) obj.Flagstr("k", "set field tracking `symbol`", &tracksym)
obj.Flagfn1("linkmode", "set link `mode` (internal, external, auto)", setlinkmode) obj.Flagfn1("linkmode", "set link `mode` (internal, external, auto)", setlinkmode)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment