diff options
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 3 | ||||
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 31 | ||||
-rw-r--r-- | libgo/Makefile.am | 1 | ||||
-rw-r--r-- | libgo/Makefile.in | 1 | ||||
-rw-r--r-- | libgo/go/internal/abi/abi.go | 10 |
6 files changed, 37 insertions, 11 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index a028350..ff07b1a 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -195060166e6045408a2cb95e6aa88c6f0b98f20b +68a756b6aadc901534cfddddad2b1e73fae9e34f The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 2112de6..d276bd8 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -12272,7 +12272,8 @@ Call_expression::intrinsify(Gogo* gogo, return Runtime::make_call(code, loc, 3, a1, a2, a3); } } - else if (package == "internal/abi") + else if (package == "internal/abi" + || package == "bootstrap/internal/abi") // for bootstrapping gc { if (is_method) return NULL; diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 9197eef..980db1e 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -3296,6 +3296,9 @@ class Create_function_descriptors : public Traverse int expression(Expression**); + static bool + skip_descriptor(Gogo* gogo, const Named_object*); + private: Gogo* gogo_; }; @@ -3306,6 +3309,9 @@ class Create_function_descriptors : public Traverse int Create_function_descriptors::function(Named_object* no) { + if (Create_function_descriptors::skip_descriptor(this->gogo_, no)) + return TRAVERSE_CONTINUE; + if (no->is_function() && no->func_value()->enclosing() == NULL && !no->func_value()->is_method() @@ -3393,6 +3399,28 @@ Create_function_descriptors::expression(Expression** pexpr) return TRAVERSE_CONTINUE; } +// The gc compiler has some special cases that it always compiles as +// intrinsics. For those we don't want to generate a function +// descriptor, as there will be no code for it to refer to. + +bool +Create_function_descriptors::skip_descriptor(Gogo* gogo, + const Named_object* no) +{ + const std::string& pkgpath(no->package() == NULL + ? gogo->pkgpath() + : no->package()->pkgpath()); + + // internal/abi is the standard library package, + // bootstrap/internal/abi is the name used when bootstrapping the gc + // compiler. + + return ((pkgpath == "internal/abi" + || pkgpath == "bootstrap/internal/abi") + && (no->name() == "FuncPCABI0" + || no->name() == "FuncPCABIInternal")); +} + // Create function descriptors as needed. We need a function // descriptor for all exported functions and for all functions that // are referenced without being called. @@ -3414,7 +3442,8 @@ Gogo::create_function_descriptors() if (no->is_function_declaration() && !no->func_declaration_value()->type()->is_method() && !Linemap::is_predeclared_location(no->location()) - && !Gogo::is_hidden_name(no->name())) + && !Gogo::is_hidden_name(no->name()) + && !Create_function_descriptors::skip_descriptor(this, no)) fndecls.push_back(no); } for (std::vector<Named_object*>::const_iterator p = fndecls.begin(); 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 |