]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: document limitation of -X
authorLE Manh Cuong <cuong.manhle.vn@gmail.com>
Tue, 26 Jun 2018 06:48:05 +0000 (13:48 +0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 27 Jun 2018 04:29:51 +0000 (04:29 +0000)
Fixes #26042

Change-Id: Ica16f14a65c03659a19926852cca5e554c99baf1
Reviewed-on: https://go-review.googlesource.com/120935
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/link/doc.go
src/cmd/link/internal/ld/data.go

index d61b66a938918360abbc862742d634af95244839..963d86a35fa2876f4449480d00dcd326d27a6fa8 100644 (file)
@@ -39,8 +39,10 @@ Flags:
                Print linker version and exit.
        -X importpath.name=value
                Set the value of the string variable in importpath named name to value.
+               This is only effective if the variable is declared in the source code either uninitialized
+               or initialized to a constant string expression. -X will not work if the initializer makes
+               a function call or refers to other variables.
                Note that before Go 1.5 this option took two separate arguments.
-               Now it takes one argument split on the first = sign.
        -buildmode mode
                Set build mode (default exe).
        -cpuprofile file
index 93c77c006b58560f827a995acba7d81258688910..c337c5e7ed6a786119b1ce210ad60200913ae0ae 100644 (file)
@@ -828,6 +828,7 @@ func addstrdata1(ctxt *Link, arg string) {
        strdata[name] = value
 }
 
+// addstrdata sets the initial value of the string variable name to value.
 func addstrdata(ctxt *Link, name, value string) {
        s := ctxt.Syms.ROLookup(name, 0)
        if s == nil || s.Gotype == nil {