From patchwork Tue Aug 18 00:20:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1346566 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=d6OsdNCV; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BVs593tY2z9sPC for ; Tue, 18 Aug 2020 10:20:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 28DED3870924; Tue, 18 Aug 2020 00:20:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28DED3870924 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597710041; bh=wNaLoWrmoQM1jMHVjOP3f96r7Ec3RECJ+/EdA7xWDac=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=d6OsdNCVCZMr6GZ2VU6Mv3HCv0nK+FOMTkJIz8WZXxdimZZkTTxOXaTB2CRfjVTVT k4z5NZQMzRbs/KMFoWbxYiUNj5fbBVZ62yRlb1MvrFPXX8Ye5CP8YQIno6gUinENNy ZJl02Y2HbRTYjqarEdAAv1/dc9TNcgmQ8KLna0Rc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id 0C7F43870924 for ; Tue, 18 Aug 2020 00:20:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0C7F43870924 Received: by mail-ej1-x62d.google.com with SMTP id c16so19941111ejx.12 for ; Mon, 17 Aug 2020 17:20:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wNaLoWrmoQM1jMHVjOP3f96r7Ec3RECJ+/EdA7xWDac=; b=RGNmWSGJXteH+J7gcXo10zIFqI0GvbQntmbo9BG5azsG4dyYhMvcohlZbc38rLUtn5 PPJz5oH1KTw2/TycFljtbR+AfD2laYfmLCYa0qNAysvh51NmfMKM1Op9h4wOem1ut+MM 66VurzVKxmYSNSmmacldOO7xGpUZAzY1MdhBL8iKecp9m6wcmfrAQZaUH4JMIE3iANaA COsLtTXDYqkM04oaor231ZHt4n7t0AA9KE3nXKPoHrUuR2Cmv5IhRIlIHNwdpcmhkAu7 mWo/f6UkS3T7LI+7Xf1phYZNsd//Q3ClkJHPP70tHVrvmwNLi8GDPPfKpQShwGj+t4Af s7VQ== X-Gm-Message-State: AOAM533kx4exZA/8nt4NibDv3n9rnRqbrfkj+HMF2NrlR8sIxAXYUtyu CjYKMlTfTlJHB7BlavxMwOLvqp2FYukPrn/N1u+vS1L/tQRm/g== X-Google-Smtp-Source: ABdhPJxCeO1y/L6a6JZfnYpDTXSj7tR6GddMUxDpanMao53FYaARS8Hlz612XC2NXJu/NEGUGC55wvtCgqG5hc5e4Wo= X-Received: by 2002:a17:906:ce43:: with SMTP id se3mr17224833ejb.403.1597710035924; Mon, 17 Aug 2020 17:20:35 -0700 (PDT) MIME-Version: 1.0 Date: Mon, 17 Aug 2020 17:20:24 -0700 Message-ID: Subject: Go patch committed: Export thunks referenced by inline functions To: gcc-patches , gofrontend-dev X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ian Lance Taylor via Gcc-patches From: Ian Lance Taylor Reply-To: Ian Lance Taylor Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This patch to the Go fronted exports thunks referenced by inline functions. Otherwise we get a link time error. The test case is https://golang.org/cl/248637. This fixes https://golang.org/issue/40252. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline and GCC 10 branch. Ian 5903b4561331e2a8907937baad8040e58b92aea3 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index e443282d0e8..e425f15285e 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -fe5d94c5792f7f990004c3dee0ea501835512200 +823c91088bc6ac606362fc34b2880ce0de1624ad 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 d295fd10136..8bbc557c65f 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -1635,16 +1635,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); diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 13de74bc870..82d4c1fd54d 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -3370,7 +3370,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) @@ -3378,8 +3379,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;