compiler: if hidden function referenced by inline, don't hide descriptor
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 21 Aug 2019 14:11:24 +0000 (14:11 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 21 Aug 2019 14:11:24 +0000 (14:11 +0000)
    Fixes golang/go#33739

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191037

From-SVN: r274800

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/gogo.h

index 2776fb8..29f5ec0 100644 (file)
@@ -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.
index aa0fda0..0cf1710 100644 (file)
@@ -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,
index 0abd4b4..4521763 100644 (file)
@@ -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()