From 6b724427aa1ec9b690e40f5206572f57e1adeda8 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 21 Jun 2023 17:27:39 -0700 Subject: compiler, libgo: support bootstrapping gc compiler In the Go 1.21 release the package internal/profile imports internal/lazyregexp. That works when bootstrapping with Go 1.17, because that compiler has internal/lazyregep and permits importing it. We also have internal/lazyregexp in libgo, but since it is not installed it is not available for importing. This CL adds internal/lazyregexp to the list of internal packages that are installed for bootstrapping. The Go 1.21, and earlier, releases have a couple of functions in the internal/abi package that are always fully intrinsified. The gofrontend recognizes and intrinsifies those functions as well. However, the gofrontend was also building function descriptors for references to the functions without calling them, which failed because there was nothing to refer to. That is OK for the gc compiler, which guarantees that the functions are only called, not referenced. This CL arranges to not generate function descriptors for these functions. For golang/go#60913 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/504798 --- libgo/Makefile.am | 1 + libgo/Makefile.in | 1 + libgo/go/internal/abi/abi.go | 10 ++-------- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'libgo') diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 920f8cc..c95dc21 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -417,6 +417,7 @@ toolexeclibgounicode_DATA = \ # Some internal packages are needed to bootstrap the gc toolchain. toolexeclibgointernaldir = $(toolexeclibgodir)/internal toolexeclibgointernal_DATA = \ + internal/lazyregexp.gox \ internal/reflectlite.gox \ internal/unsafeheader.gox diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 6176eb5..40340bf 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -885,6 +885,7 @@ toolexeclibgounicode_DATA = \ # Some internal packages are needed to bootstrap the gc toolchain. toolexeclibgointernaldir = $(toolexeclibgodir)/internal toolexeclibgointernal_DATA = \ + internal/lazyregexp.gox \ internal/reflectlite.gox \ internal/unsafeheader.gox diff --git a/libgo/go/internal/abi/abi.go b/libgo/go/internal/abi/abi.go index c4a1088..6625127 100644 --- a/libgo/go/internal/abi/abi.go +++ b/libgo/go/internal/abi/abi.go @@ -17,10 +17,7 @@ package abi // compile-time error. // // Implemented as a compile intrinsic. -func FuncPCABI0(f any) uintptr { - // The compiler should remove all calls. - panic("FuncPCABI0") -} +func FuncPCABI0(f any) uintptr // FuncPCABIInternal returns the entry PC of the function f. If f is a // direct reference of a function, it must be defined as ABIInternal. @@ -29,7 +26,4 @@ func FuncPCABI0(f any) uintptr { // the behavior is undefined. // // Implemented as a compile intrinsic. -func FuncPCABIInternal(f any) uintptr { - // The compiler should remove all calls. - panic("FuncPCABIInternal") -} +func FuncPCABIInternal(f any) uintptr -- cgit v1.1