Skip to content

Commit 512b3c6

Browse files
Ionicianlancetaylor
authored andcommitted
cmd/dist: add BOOT_GO_LDFLAGS - counterpart of BOOT_GO_GCFLAGS
This allows passing custom LDFLAGS while building the bootstrapping tool. Afterwards, GO_LDFLAGS will be used as usual. Change-Id: I1e224e3ce8bf7b2ce1ef8fec1894720338f04396 GitHub-Last-Rev: 17d40dc GitHub-Pull-Request: #31298 Reviewed-on: https://go-review.googlesource.com/c/go/+/171037 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent c349505 commit 512b3c6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cmd/dist/build.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ func xinit() {
198198
}
199199

200200
gogcflags = os.Getenv("BOOT_GO_GCFLAGS")
201+
goldflags = os.Getenv("BOOT_GO_LDFLAGS")
201202

202203
cc, cxx := "gcc", "g++"
203204
if defaultclang {
@@ -661,6 +662,9 @@ func runInstall(dir string, ch chan struct{}) {
661662
if goos == "android" {
662663
link = append(link, "-buildmode=pie")
663664
}
665+
if goldflags != "" {
666+
link = append(link, goldflags)
667+
}
664668
link = append(link, "-o", pathf("%s/%s%s", tooldir, elem, exe))
665669
targ = len(link) - 1
666670
}
@@ -1265,7 +1269,7 @@ func cmdbootstrap() {
12651269
}
12661270

12671271
gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
1268-
goldflags = os.Getenv("GO_LDFLAGS")
1272+
goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
12691273
goBootstrap := pathf("%s/go_bootstrap", tooldir)
12701274
cmdGo := pathf("%s/go", gobin)
12711275
if debug {

0 commit comments

Comments
 (0)