}
 
        gogcflags = os.Getenv("BOOT_GO_GCFLAGS")
+       goldflags = os.Getenv("BOOT_GO_LDFLAGS")
 
        cc, cxx := "gcc", "g++"
        if defaultclang {
                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
        }
        }
 
        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 {