From patchwork Mon Oct 18 17:21:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 68211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 4FD92B70EF for ; Tue, 19 Oct 2010 04:21:36 +1100 (EST) Received: (qmail 823 invoked by alias); 18 Oct 2010 17:21:32 -0000 Received: (qmail 813 invoked by uid 22791); 18 Oct 2010 17:21:31 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Oct 2010 17:21:26 +0000 Received: (qmail 7807 invoked from network); 18 Oct 2010 17:21:24 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 18 Oct 2010 17:21:24 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1P7tOl-0004Wk-Cz for gcc-patches@gcc.gnu.org; Mon, 18 Oct 2010 17:21:23 +0000 Date: Mon, 18 Oct 2010 17:21:23 +0000 (UTC) From: "Joseph S. Myers" To: gcc-patches@gcc.gnu.org Subject: Restore -fno-omit-frame-pointer default for x86 Solaris 2.10 Message-ID: MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch fixes a problem where my patch unintentionally changed the behavior of the compiler for i?86-solaris2.10 targets. On such targets, SUBTARGET_OVERRIDE_OPTIONS set flag_omit_frame_pointer to 0, which previously caused code checking for a value of 2 not to apply the OS-independent defaults. Now that both places check global_options_set.x_flag_omit_frame_pointer instead of checking for a magic value of 2, this no longer works. There is already a macro USE_IX86_FRAME_POINTER to allow OS-dependent defaults for this variable in the 32-bit case, and the simplest fix seems to be to add such a macro for the 64-bit case and use those macros in sol2-10.h instead of SUBTARGET_OVERRIDE_OPTIONS, so reducing the number of places involved in setting the default value of this variable. This patch does so. Tested building cc1 for cross to i386-pc-solaris2.10 (where the patch restores the expected ICE described in PR 46018, the disappearance of which was the indication that something was wrong with my original patch - without the present patch, the ICE could still be reproduced if you used -fno-omit-frame-pointer), and bootstrapped with no regressions on x86_64-unknown-linux-gnu. OK to commit? (I have no idea whether the default to frame pointers for Solaris 2.10 is still desired, or what tools on Solaris it might be relevant to, but it was what Sun wanted in 2004 and was the intention of the code.) 2010-10-18 Joseph Myers * config/i386/i386.c (ix86_option_override_internal): Define and use USE_X86_64_FRAME_POINTER for 64-bit flag_omit_frame_pointer default. * config/i386/sol2-10.h (SUBTARGET_OVERRIDE_OPTIONS): Remove. (USE_IX86_FRAME_POINTER, USE_X86_64_FRAME_POINTER): Define. Index: gcc/config/i386/sol2-10.h =================================================================== --- gcc/config/i386/sol2-10.h (revision 165630) +++ gcc/config/i386/sol2-10.h (working copy) @@ -81,13 +81,8 @@ along with GCC; see the file COPYING3. #undef WINT_TYPE_SIZE #define WINT_TYPE_SIZE 32 -#define SUBTARGET_OVERRIDE_OPTIONS \ - do \ - { \ - if (!global_options_set.x_flag_omit_frame_pointer) \ - flag_omit_frame_pointer = 0; \ - } \ - while (0) +#define USE_IX86_FRAME_POINTER 1 +#define USE_X86_64_FRAME_POINTER 1 /* Override i386/sol2.h version: return 8-byte vectors in MMX registers if possible, matching Sun Studio 12 Update 1+ compilers and other x86 Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (revision 165630) +++ gcc/config/i386/i386.c (working copy) @@ -3272,6 +3272,10 @@ ix86_option_override_internal (bool main #define USE_IX86_FRAME_POINTER 0 #endif +#ifndef USE_X86_64_FRAME_POINTER +#define USE_X86_64_FRAME_POINTER 0 +#endif + /* Set the default values for switches whose default depends on TARGET_64BIT in case they weren't overwritten by command line options. */ if (TARGET_64BIT) @@ -3279,7 +3283,7 @@ ix86_option_override_internal (bool main if (optimize > 1 && !global_options_set.x_flag_zee) flag_zee = 1; if (optimize >= 1 && !global_options_set.x_flag_omit_frame_pointer) - flag_omit_frame_pointer = 1; + flag_omit_frame_pointer = !USE_X86_64_FRAME_POINTER; if (flag_asynchronous_unwind_tables == 2) flag_asynchronous_unwind_tables = 1; if (flag_pcc_struct_return == 2)