From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11959 invoked by alias); 6 Nov 2014 17:45:26 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 11933 invoked by uid 89); 6 Nov 2014 17:45:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f171.google.com Received: from mail-yk0-f171.google.com (HELO mail-yk0-f171.google.com) (209.85.160.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 06 Nov 2014 17:45:25 +0000 Received: by mail-yk0-f171.google.com with SMTP id 200so1517491ykr.16 for ; Thu, 06 Nov 2014 09:45:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=de4kKzhwF1U7cv0wOx/6+K+HQQh3pxCoUfUAkTZOJQg=; b=CCOlx1K+wb3v4BoRLJo5ofxs/JdKzpJ0quAD1YbBLt72Q1XE/HvrA1YO19IaemOy4P OZA7AlGtT/7bHpigMYvL/VZb3Frtth5apt+/xnSXfEiDuNPIMbAUMesN5Jm0234Uz10B rgG7bVan3piuMJAUT1iPi3XHSKjUS2xROhpCfzGxQkVAJm/3UcFJBw8uvos5U4s8Wyh3 PVeOmvFbCvKlq0I20DUOASb2pIT2iyiKeEapRE6UrCGQxZ83VjLcNDIkcu+3ckISNFQ6 hHEgaOG754qpOrN/aTCwlzebfPoflMYw+EYHGV6LY6kOfl5Zf3Velr6ITV508XaGXXfk fQcQ== X-Gm-Message-State: ALoCoQk4/KIaSvp0OHDGKqr0tzjMi70xhBmcVGmLPh9VyC4HDZ7HJCGp+6Zyv8Dw58TPRzrBKhJE MIME-Version: 1.0 X-Received: by 10.236.231.98 with SMTP id k92mr5384607yhq.161.1415295923072; Thu, 06 Nov 2014 09:45:23 -0800 (PST) Received: by 10.170.229.84 with HTTP; Thu, 6 Nov 2014 09:45:22 -0800 (PST) In-Reply-To: <545B71D1.1090406@redhat.com> References: <1412973773-3942-1-git-send-email-rth@redhat.com> <545A97BA.3030507@linux.vnet.ibm.com> <545B1C44.3000306@redhat.com> <20141106124838.GJ30857@bubble.grove.modra.org> <545B71D1.1090406@redhat.com> Date: Thu, 06 Nov 2014 17:45:00 -0000 Message-ID: Subject: Re: [gofrontend-dev] Re: [PATCH 00/13] Go closures, libffi, and the static chain From: Ian Taylor To: Richard Henderson Cc: "Lynn A. Boger" , gcc-patches , libffi-discuss@sourceware.org, "gofrontend-dev@googlegroups.com" , ian@airs.com Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2014/txt/msg00186.txt.bz2 On Thu, Nov 6, 2014 at 5:04 AM, Richard Henderson wrote: > > That said, this *may* not actually be a problem. It's not the direct (possibly > lazy bound) call into libffi that needs a static chain, it's the indirect call > that libffi produces. And the indirect calls that Go produces. > > I'm pretty sure that there are no dynamically linked Go calls that require the > static chain. They're used for closures, which are either fully indirect from > a different translation unit, or locally bound closures through which the > optimizer has seen the construction, and optimized to a direct call. > > Ian, have I missed a case where a closure could wind up with a direct call to a > lazy bound function? I think you've covered all the cases. The closure value is only required when calling a nested function. There is no way to refer directly to a nested function defined in a different shared library. The only way you can get such a reference is if some function in that shared library returns it. So we are OK assuming that when returning a nested function, which is always known to be locally defined, we never return a reference to the PLT, but always return a fully resolved function address. That seems like a plausible assumption, particularly since we should never need to set up a PLT for a nested function, since it can never be called directly from a different shared library. Ian