]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
compiler: export thunks referenced by inline functions
authorIan Lance Taylor <iant@golang.org>
Fri, 14 Aug 2020 22:27:15 +0000 (15:27 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 18 Aug 2020 00:20:13 +0000 (17:20 -0700)
The test case is https://golang.org/cl/248637.

Fixes golang/go#40252

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

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

index 64b13f410e083bb46dfdd85b48d14d902506cb07..e425f15285eaa4a83786412270f51924d68ec582 100644 (file)
@@ -1,4 +1,4 @@
-2ad0970e9da95024110cd3244e9e21313af70a5f
+823c91088bc6ac606362fc34b2880ce0de1624ad
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index deac87448f33e42f7ddf7c9ae7ce890487839a14..8f59b18d47f69243d28e0cb4c06b80519b8c34d2 100644 (file)
@@ -1621,16 +1621,15 @@ 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_referenced_by_inline)
+                           && !is_exported_runtime)
                        || Gogo::is_thunk(no));
 
+      if (no->is_function() && no->func_value()->is_referenced_by_inline())
+       is_hidden = false;
+
       bvar = context->backend()->immutable_struct(var_name, asm_name,
                                                   is_hidden, false,
                                                  btype, bloc);
index 212ef45a29c2a976551322f7ad2421b5d080d8c9..9d3d95309b21d75e38c1ec928de4ea2be753a6ce 100644 (file)
@@ -3342,7 +3342,8 @@ class Create_function_descriptors : public Traverse
   Gogo* gogo_;
 };
 
-// Create a descriptor for every top-level exported function.
+// Create a descriptor for every top-level exported function and every
+// function referenced by an inline function.
 
 int
 Create_function_descriptors::function(Named_object* no)
@@ -3350,8 +3351,9 @@ Create_function_descriptors::function(Named_object* no)
   if (no->is_function()
       && no->func_value()->enclosing() == NULL
       && !no->func_value()->is_method()
-      && !Gogo::is_hidden_name(no->name())
-      && !Gogo::is_thunk(no))
+      && ((!Gogo::is_hidden_name(no->name())
+          && !Gogo::is_thunk(no))
+         || no->func_value()->is_referenced_by_inline()))
     no->func_value()->descriptor(this->gogo_, no);
 
   return TRAVERSE_CONTINUE;