mirror of
https://github.com/golang/go
synced 2024-11-12 06:20:22 -07:00
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.
This commit is contained in:
parent
4166ff42c0
commit
17d40dc2dd
6
src/cmd/dist/build.go
vendored
6
src/cmd/dist/build.go
vendored
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user