From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108110 invoked by alias); 9 Jun 2017 18:22:15 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 108078 invoked by uid 89); 9 Jun 2017 18:22:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Hx-languages-length:2303, you! X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Jun 2017 18:22:11 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 7D766548067; Fri, 9 Jun 2017 20:22:13 +0200 (CEST) Date: Fri, 09 Jun 2017 18:22:00 -0000 From: Jan Hubicka To: Ian Lance Taylor Cc: gcc-patches , "gofrontend-dev@googlegroups.com" Subject: Re: Patch RFC: disable block partitioning with split stack Message-ID: <20170609182213.GC67908@kam.mff.cuni.cz> References: <20170609101637.GC30427@atrey.karlin.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2017-06/txt/msg00672.txt.bz2 > On Fri, Jun 9, 2017 at 3:16 AM, Jan Hubicka wrote: > > > >> code compiled with -fsplit-stack, if the cold partition calls a > >> function that is not compiled with -fsplit-stack (such as a C library > >> function). The problem is that when the linker sees a split-stack > >> function call a non-split-stack function, it adjusts the function > >> header to request more stack space. This doesn't work if the call is > >> in the cold partition, as the linker doesn't know how to find the > >> header to adjust. You can see this by trying to build the Go library > >> using the gold linker with this patch. > > > > If code does not work, I wonder why we let user to overwrite the default > > by hand? In other cases we drop the flag with inform message. > > My thinking here is that there is no fundamental reason that the code > does not work, and the actual problem does not lie in GCC but rather > in the linker (specifically, gold). It's possible in principle to fix > gold to make this work, and someone who is using a fixed gold could > then direct GCC to take advantage of this optimization (and later > after that version of gold is wide-spread enough we can change GCC to > drop this patch). Thanks for explanation. Perhaps we could have this documented, because otherwise people will think the option is simply broken. I guess even better we could have configure autodetection for the broken linker. > > > > Also bb-reorder knows how to prevent landing pads to go to different sections, > > so perhaps same machinery can be used to prevent splitting blocks having > > calls that needs linker adjustments? > > Unfortunately I don't see how that is possible in general, as the code > that needs adjustment is cases where code compiled with -fsplit-stack > calls functions compiled without -fsplit-stack. By definition those > calls are to functions defined in other compilation units, and the > compiler simply doesn't know whether they will be compiled with > -fsplit-stack or not. Only the linker knows. I see. We could stil block offlining all blocks that contains calls to functions that does not bind to current defs, but I guess that would prevent most of useful code plitting anyway. Thank you! Honza > > Ian