summaryrefslogtreecommitdiffstats
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-09-21 11:44:26 -0700
committerIan Lance Taylor <iant@golang.org>2021-09-21 14:31:10 -0700
commit09e18d113b3c3dae896ac1a8ad1e0087adbb153b (patch)
tree66b099a6ebc2076ef353afa90d9703824d023812 /libgo
parentpath solver: Use ranger to solve unknowns. (diff)
downloadgcc-09e18d113b3c3dae896ac1a8ad1e0087adbb153b.tar.gz
gcc-09e18d113b3c3dae896ac1a8ad1e0087adbb153b.tar.bz2
gcc-09e18d113b3c3dae896ac1a8ad1e0087adbb153b.tar.xz
runtime: set runtime.GOROOT value at build time
In Go 1.17 the gc toolchain changed to set runtime.GOROOT in cmd/link (previously it was runtime/internal/sys.GOROOT). Do the same in libgo. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/351313 gotools/: * Makefile.am (check-runtime): Add goroot.go to --extrafiles. * Makefile.in: Regenerate.
Diffstat (limited to 'libgo')
-rw-r--r--libgo/Makefile.am11
-rw-r--r--libgo/Makefile.in12
-rw-r--r--libgo/go/runtime/extern.go2
3 files changed, 21 insertions, 4 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 92fedcf6eb8..5c377a30df9 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -545,6 +545,14 @@ s-gcpu: Makefile
545 $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go 545 $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go
546 $(STAMP) $@ 546 $(STAMP) $@
547 547
548goroot.go: s-goroot; @true
549s-goroot: Makefile
550 rm -f goroot.go.tmp
551 echo "package runtime" > goroot.go.tmp
552 echo 'var defaultGOROOT = `$(prefix)`' >> goroot.go.tmp
553 $(SHELL) $(srcdir)/mvifdiff.sh goroot.go.tmp goroot.go
554 $(STAMP) $@
555
548buildcfg.go: s-buildcfg; @true 556buildcfg.go: s-buildcfg; @true
549s-buildcfg: Makefile 557s-buildcfg: Makefile
550 rm -f buildcfg.go.tmp 558 rm -f buildcfg.go.tmp
@@ -1005,7 +1013,8 @@ math_lo_GOCFLAGS = $(MATH_FLAG)
1005math_check_GOCFLAGS = $(MATH_FLAG) 1013math_check_GOCFLAGS = $(MATH_FLAG)
1006 1014
1007# Add generated files to the runtime package. 1015# Add generated files to the runtime package.
1008extra_go_files_runtime = runtime_linknames.go runtime_sysinfo.go sigtab.go 1016extra_go_files_runtime = \
1017 runtime_linknames.go runtime_sysinfo.go sigtab.go goroot.go
1009runtime.lo.dep: $(extra_go_files_runtime) 1018runtime.lo.dep: $(extra_go_files_runtime)
1010 1019
1011# Add generated files to the syscall package. 1020# Add generated files to the syscall package.
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 3b2bdf99027..1240b16d443 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -1098,7 +1098,9 @@ math_lo_GOCFLAGS = $(MATH_FLAG)
1098math_check_GOCFLAGS = $(MATH_FLAG) 1098math_check_GOCFLAGS = $(MATH_FLAG)
1099 1099
1100# Add generated files to the runtime package. 1100# Add generated files to the runtime package.
1101extra_go_files_runtime = runtime_linknames.go runtime_sysinfo.go sigtab.go 1101extra_go_files_runtime = \
1102 runtime_linknames.go runtime_sysinfo.go sigtab.go goroot.go
1103
1102 1104
1103# Add generated files to the syscall package. 1105# Add generated files to the syscall package.
1104extra_go_files_syscall = \ 1106extra_go_files_syscall = \
@@ -2752,6 +2754,14 @@ s-gcpu: Makefile
2752 $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go 2754 $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go
2753 $(STAMP) $@ 2755 $(STAMP) $@
2754 2756
2757goroot.go: s-goroot; @true
2758s-goroot: Makefile
2759 rm -f goroot.go.tmp
2760 echo "package runtime" > goroot.go.tmp
2761 echo 'var defaultGOROOT = `$(prefix)`' >> goroot.go.tmp
2762 $(SHELL) $(srcdir)/mvifdiff.sh goroot.go.tmp goroot.go
2763 $(STAMP) $@
2764
2755buildcfg.go: s-buildcfg; @true 2765buildcfg.go: s-buildcfg; @true
2756s-buildcfg: Makefile 2766s-buildcfg: Makefile
2757 rm -f buildcfg.go.tmp 2767 rm -f buildcfg.go.tmp
diff --git a/libgo/go/runtime/extern.go b/libgo/go/runtime/extern.go
index 0d7f3577913..6bd612fcf32 100644
--- a/libgo/go/runtime/extern.go
+++ b/libgo/go/runtime/extern.go
@@ -211,8 +211,6 @@ func Caller(skip int) (pc uintptr, file string, line int, ok bool)
211// program counter adjustment. 211// program counter adjustment.
212func Callers(skip int, pc []uintptr) int 212func Callers(skip int, pc []uintptr) int
213 213
214var defaultGOROOT string // set by cmd/link
215
216// GOROOT returns the root of the Go tree. It uses the 214// GOROOT returns the root of the Go tree. It uses the
217// GOROOT environment variable, if set at process start, 215// GOROOT environment variable, if set at process start,
218// or else the root used during the Go build. 216// or else the root used during the Go build.