1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:27:58 -07:00

cmd/ld: document that -X overwrites initialized variables

Fixes #7626.

LGTM=iant
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/144870045
This commit is contained in:
Josh Bleecher Snyder 2014-09-15 18:16:45 -07:00
parent 2bb0a5e085
commit c3dbf56a14
2 changed files with 9 additions and 5 deletions

View File

@ -63,9 +63,9 @@ Options new in this version:
-w -w
Omit the DWARF symbol table. Omit the DWARF symbol table.
-X symbol value -X symbol value
Set the value of an otherwise uninitialized string variable. Set the value of a string variable. The symbol name
The symbol name should be of the form importpath.name, should be of the form importpath.name, as displayed
as displayed in the symbol table printed by "go tool nm". in the symbol table printed by "go tool nm".
-race -race
Link with race detection libraries. Link with race detection libraries.
-B value -B value

View File

@ -1,4 +1,4 @@
// $G $D/$F.go && $L -X main.tbd hello $F.$A && ./$A.out // $G $D/$F.go && $L -X main.tbd hello -X main.overwrite trumped $F.$A && ./$A.out
// NOTE: This test is not run by 'run.go' and so not run by all.bash. // NOTE: This test is not run by 'run.go' and so not run by all.bash.
// To run this test you must use the ./run shell script. // To run this test you must use the ./run shell script.
@ -12,9 +12,13 @@
package main package main
var tbd string var tbd string
var overwrite string = "dibs"
func main() { func main() {
if tbd != "hello" { if tbd != "hello" {
println("BUG: test/linkx", len(tbd), tbd) println("BUG: test/linkx tbd", len(tbd), tbd)
}
if overwrite != "trumped" {
println("BUG: test/linkx overwrite", len(overwrite), overwrite)
} }
} }