]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: document that -X overwrites initialized variables
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 16 Sep 2014 01:16:45 +0000 (18:16 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 16 Sep 2014 01:16:45 +0000 (18:16 -0700)
Fixes #7626.

LGTM=iant
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/144870045

src/cmd/ld/doc.go
test/linkx.go

index 8135bd549c3ec21a5080e6a59e0a9bd533434204..5b5833db5dce4910af085f3b3011a680ed93cc38 100644 (file)
@@ -63,9 +63,9 @@ Options new in this version:
        -w
                Omit the DWARF symbol table.
        -X symbol value
-               Set the value of an otherwise uninitialized string variable.
-               The symbol name should be of the form importpath.name,
-               as displayed in the symbol table printed by "go tool nm".
+               Set the value of a string variable. The symbol name
+               should be of the form importpath.name, as displayed
+               in the symbol table printed by "go tool nm".
        -race
                Link with race detection libraries.
        -B value
index 12d446ffc13b99c8e434d5a9720ac4233439e98d..36d16aec9bcdc067a9a891ccb5b31acaf01a9a74 100644 (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.
 // To run this test you must use the ./run shell script.
 package main
 
 var tbd string
+var overwrite string = "dibs"
 
 func main() {
        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)
        }
 }