From 7f8c0c0504d95c983aa138fd67aa2267f96853f9 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 21 Aug 2019 14:11:24 +0000 Subject: [PATCH] compiler: if hidden function referenced by inline, don't hide descriptor Fixes golang/go#33739 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191037 From-SVN: r274800 --- gcc/go/gofrontend/MERGE | 2 +- gcc/go/gofrontend/expressions.cc | 6 +++++- gcc/go/gofrontend/gogo.h | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 2776fb80224..29f5ec01637 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -1846b07fec2b91facc02ea269f7ab250b30f90b4 +7da359f4659fffff051c05ff442037cfa61febd5 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 aa0fda091bd..0cf1710d0c2 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -1560,10 +1560,14 @@ Func_descriptor_expression::do_get_backend(Translate_context* context) || no->name().find("equal") != std::string::npos)) is_exported_runtime = true; + bool is_referenced_by_inline = + no->is_function() && no->func_value()->is_referenced_by_inline(); + bool is_hidden = ((no->is_function() && no->func_value()->enclosing() != NULL) || (Gogo::is_hidden_name(no->name()) - && !is_exported_runtime) + && !is_exported_runtime + && !is_referenced_by_inline) || Gogo::is_thunk(no)); bvar = context->backend()->immutable_struct(var_name, asm_name, diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h index 0abd4b4cb2a..45217636116 100644 --- a/gcc/go/gofrontend/gogo.h +++ b/gcc/go/gofrontend/gogo.h @@ -1543,6 +1543,11 @@ class Function set_is_inline_only() { this->is_inline_only_ = true; } + // Report whether the function is referenced by an inline body. + bool + is_referenced_by_inline() const + { return this->is_referenced_by_inline_; } + // Mark the function as referenced by an inline body. void set_is_referenced_by_inline() -- 2.30.2