]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: add BOOT_GO_LDFLAGS - counterpart of BOOT_GO_GCFLAGS
authorMihai Moldovan <ionic@ionic.de>
Tue, 9 Apr 2019 10:25:49 +0000 (10:25 +0000)
committerIan Lance Taylor <iant@golang.org>
Wed, 10 Apr 2019 21:23:18 +0000 (21:23 +0000)
This allows passing custom LDFLAGS while building the bootstrapping
tool.

Afterwards, GO_LDFLAGS will be used as usual.

Change-Id: I1e224e3ce8bf7b2ce1ef8fec1894720338f04396
GitHub-Last-Rev: 17d40dc2dd2f0815331cb2f8de3445f86687cc45
GitHub-Pull-Request: golang/go#31298
Reviewed-on: https://go-review.googlesource.com/c/go/+/171037
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/dist/build.go

index fec3b2cedc833b8fc4e8461d3edea13720835512..15ed4278ac02427eafa533b426924591208f0606 100644 (file)
@@ -198,6 +198,7 @@ func xinit() {
        }
 
        gogcflags = os.Getenv("BOOT_GO_GCFLAGS")
+       goldflags = os.Getenv("BOOT_GO_LDFLAGS")
 
        cc, cxx := "gcc", "g++"
        if defaultclang {
@@ -661,6 +662,9 @@ func runInstall(dir string, ch chan struct{}) {
                if goos == "android" {
                        link = append(link, "-buildmode=pie")
                }
+               if goldflags != "" {
+                       link = append(link, goldflags)
+               }
                link = append(link, "-o", pathf("%s/%s%s", tooldir, elem, exe))
                targ = len(link) - 1
        }
@@ -1265,7 +1269,7 @@ func cmdbootstrap() {
        }
 
        gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
-       goldflags = os.Getenv("GO_LDFLAGS")
+       goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
        goBootstrap := pathf("%s/go_bootstrap", tooldir)
        cmdGo := pathf("%s/go", gobin)
        if debug {