From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40428 invoked by alias); 29 May 2015 17:12:58 -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 40415 invoked by uid 89); 29 May 2015 17:12:57 -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,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f171.google.com Received: from mail-ie0-f171.google.com (HELO mail-ie0-f171.google.com) (209.85.223.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 29 May 2015 17:12:56 +0000 Received: by iepj10 with SMTP id j10so67522786iep.3 for ; Fri, 29 May 2015 10:12:54 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.42.203.4 with SMTP id fg4mr15984875icb.52.1432919574630; Fri, 29 May 2015 10:12:54 -0700 (PDT) Received: by 10.36.108.21 with HTTP; Fri, 29 May 2015 10:12:54 -0700 (PDT) In-Reply-To: <20150529144736.GP14752@bubble.grove.modra.org> References: <20150518025234.GT6140@bubble.grove.modra.org> <20150518025451.GW6140@bubble.grove.modra.org> <20150520235440.GI6140@bubble.grove.modra.org> <20150529144736.GP14752@bubble.grove.modra.org> Date: Fri, 29 May 2015 17:25:00 -0000 Message-ID: Subject: Re: [PATCH 3/4] split-stack for powerpc64 From: David Edelsohn To: GCC Patches , Alan Modra Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-05/txt/msg02807.txt.bz2 On Fri, May 29, 2015 at 10:47 AM, Alan Modra wrote: > Two fixes for -fsplit-stack on powerpc64. I goofed on the block > scanned for uses of r12. ENTRY_BLOCK_PTR_FOR_FN is the fake one. The > next block is the first one having insns. > > The second change emits an error if people use a global register > variable r29 with -fsplit-stack. For example: > register struct important_stuff *quick_access __asm__ ("r29"); > > Such code does exist in the wild, but probably doesn't currently use > -fsplit-stack. > > The problem is that r29 is saved by morestack then used to pass the > old stack pointer to the normal function prologue. So on entry to a > function, r29 will be modified. It would be possible to restore r29 > from the morestack frame in order to let the function body see the > original r29, I wrote such a patch, but that trick isn't safe if > someone is using r29 in a signal handler. > > I suppose we could restore r29 and downgrade the error to a warning > that using a global register asm r29 isn't safe in signal handlers > with -fsplit-stack. What do you think, David? > > * config/rs6000/rs6000.c (split_stack_arg_pointer_used_p): Scan > correct block for use of r12. > (rs6000_expand_split_stack_prologue): Error on r29 asm global reg. Okay. I doubt that many developers explicitly use r29 as a global register. I agree with you that it probably is better to error out completely instead of likely generating buggy code for this particular combination of r29 asm and split stack. Thanks, David