From patchwork Mon Oct 24 16:18:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 121377 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C6B78B6F6B for ; Tue, 25 Oct 2011 03:19:14 +1100 (EST) Received: from localhost ([::1]:57922 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RINEx-0002iC-QI for incoming@patchwork.ozlabs.org; Mon, 24 Oct 2011 12:19:07 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RINEo-0002hY-5t for qemu-devel@nongnu.org; Mon, 24 Oct 2011 12:19:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RINEm-0003xF-Ot for qemu-devel@nongnu.org; Mon, 24 Oct 2011 12:18:58 -0400 Received: from mail-vx0-f173.google.com ([209.85.220.173]:43662) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RINEm-0003wz-Ir for qemu-devel@nongnu.org; Mon, 24 Oct 2011 12:18:56 -0400 Received: by vcbfl17 with SMTP id fl17so5816548vcb.4 for ; Mon, 24 Oct 2011 09:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Tzm1bTiJ2R3YvWqyr4+ivSniNihxPzQMs9azLBlxrVs=; b=RO3+6J3NBbtQQNocdKWSDIOoU4nxbiYKP3rM+0sKKfDQXXnVPfYns3dAdQAxZq1CGg Azcw728EqGowo4PWyzW518xGxyWjK6O5SKb9h0UBgEd6L9/kY//azK9zkenbMvBbaZUd EP0haRAc8zii6zlSjVK2dY5NQQ3jwpDfFhi/Y= MIME-Version: 1.0 Received: by 10.220.147.200 with SMTP id m8mr1775284vcv.129.1319473135240; Mon, 24 Oct 2011 09:18:55 -0700 (PDT) Received: by 10.220.201.73 with HTTP; Mon, 24 Oct 2011 09:18:55 -0700 (PDT) In-Reply-To: <4EA57A26.1050806@mc.net> References: <4E9BB180.6080506@mc.net> <4E9C0497.2000605@siriusit.co.uk> <4E9C3703.3040109@mc.net> <4E9C645A.5060200@twiddle.net> <4E9C9C08.20001@mc.net> <4E9CAACE.4070804@mc.net> <4E9F3BB4.3050604@mc.net> <4EA57A26.1050806@mc.net> Date: Mon, 24 Oct 2011 18:18:55 +0200 Message-ID: From: Kai Tietz To: Bob Breuer X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.173 Cc: xunxun , Richard Henderson , qemu-devel , Mark Cave-Ayland , "gcc@gcc.gnu.org" Subject: Re: [Qemu-devel] gcc auto-omit-frame-pointer vs msvc longjmp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 2011/10/24 Bob Breuer : > Kai Tietz wrote: >> Hi, >> >> For trunk-version I have a tentative patch for this issue.  On 4.6.x >> and older branches this doesn't work, as here we can't differenciate >> that easy between ms- and sysv-abi. >> >> But could somebody give this patch a try? >> >> Regards, >> Kai >> >> ChangeLog >> >>         * config/i386/i386.c (ix86_frame_pointer_required): Enforce use of >>         frame-pointer for 32-bit ms-abi, if setjmp is used. >> >> Index: i386.c >> =================================================================== >> --- i386.c      (revision 180099) >> +++ i386.c      (working copy) >> @@ -8391,6 +8391,10 @@ >>    if (SUBTARGET_FRAME_POINTER_REQUIRED) >>      return true; >> >> +  /* For older 32-bit runtimes setjmp requires valid frame-pointer.  */ >> +  if (TARGET_32BIT_MS_ABI && cfun->calls_setjmp) >> +    return true; >> + >>    /* In ix86_option_override_internal, TARGET_OMIT_LEAF_FRAME_POINTER >>       turns off the frame pointer by default.  Turn it back on now if >>       we've not got a leaf function.  */ >> > > For a gcc 4.7 snapshot, this does fix the longjmp problem that I > encountered.  So aside from specifying -fno-omit-frame-pointer for > affected files, what can be done for 4.6? > > Bob Well, for 4.6.x (or older) we just can use the mingw32.h header in gcc/config/i386/ and define here a subtarget-macro to indicate that. The only incompatible point here might be for Wine using the linux-compiler to build Windows related code. A possible patch for 4.6 gcc versions I attached to this mail. Regards, Kai Index: mingw32.h =================================================================== --- mingw32.h (revision 180393) +++ mingw32.h (working copy) @@ -239,3 +239,8 @@ /* We should find a way to not have to update this manually. */ #define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-12.dll" +/* For 32-bit Windows we need valid frame-pointer for function using + setjmp. */ +#define SUBTARGET_SETJMP_NEED_FRAME_POINTER \ + (!TARGET_64BIT && cfun->calls_setjmp) + Index: i386.c =================================================================== --- i386.c (revision 180393) +++ i386.c (working copy) @@ -8741,6 +8741,12 @@ if (SUBTARGET_FRAME_POINTER_REQUIRED) return true; +#ifdef SUBTARGET_SETJMP_NEED_FRAME_POINTER + /* For older 32-bit runtimes setjmp requires valid frame-pointer. */ + if (SUBTARGET_SETJMP_NEED_FRAME_POINTER) + return true; +#endif + /* In ix86_option_override_internal, TARGET_OMIT_LEAF_FRAME_POINTER turns off the frame pointer by default. Turn it back on now if we've not got a leaf function. */