Patchwork Restore -fno-omit-frame-pointer default for x86 Solaris 2.10

login
register
mail settings
Submitter Joseph S. Myers
Date Oct. 18, 2010, 5:21 p.m.
Message ID <Pine.LNX.4.64.1010181720470.13180@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/68211/
State New
Headers show

Comments

Joseph S. Myers - Oct. 18, 2010, 5:21 p.m.
This patch fixes a problem where my patch
<http://gcc.gnu.org/ml/gcc-patches/2010-10/msg01378.html>
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  <joseph@codesourcery.com>

	* 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.
Richard Henderson - Oct. 18, 2010, 6:10 p.m.
On 10/18/2010 10:21 AM, Joseph S. Myers wrote:
> 	* 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.

Ok.


r~

Patch

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)