Patchwork [Darwin/m32/ObjC] Fix m32 ObjC exceptions model breakage.

login
register
mail settings
Submitter Iain Sandoe
Date June 25, 2012, 7:52 a.m.
Message ID <639FC20E-1448-4685-B54D-D6F10783B324@codesourcery.com>
Download mbox | patch
Permalink /patch/166988/
State New
Headers show

Comments

Iain Sandoe - June 25, 2012, 7:52 a.m.
Hello H.J.

i686-Darwin, m32, ObjC is still broken from the patch to "Add OPTION_MASK_ISA_X86_64 and support TARGET_BI_ARCH	== 2"

As I pointed out in [1], in the case of the NeXT runtime, the ABI and exceptions model depend on the multi-lib.

Currently, the exceptions model is set from C_COMMON_OVERRIDE_OPTIONS, which is called before SUBTARGET_OVERRIDE_OPTIONS.  

However, following your change, the User's multi-lib choice is no longer valid when C_COMMON_OVERRIDE_OPTIONS is called, therefore I propose to move the tests to SUBSUBTARGET_OVERRIDE_OPTIONS (darwin_override_options).

OK for trunk?
Iain

[1]
http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00393.html

gcc:

	* config/darwin.h (SUBTARGET_C_COMMON_OVERRIDE_OPTIONS): Move NeXT runtime
	exceptions model setting from here ...
	* config/darwin.c (darwin_override_options): ... to here.
Mike Stump - June 25, 2012, 8:54 a.m.
On Jun 25, 2012, at 12:52 AM, Iain Sandoe wrote:
> OK for trunk?

Ok.

> 	* config/darwin.h (SUBTARGET_C_COMMON_OVERRIDE_OPTIONS): Move NeXT runtime
> 	exceptions model setting from here ...
> 	* config/darwin.c (darwin_override_options): ... to here.

Kinda nasty how delicate things are.  :-(

Patch

Index: gcc/config/darwin.c
===================================================================
--- gcc/config/darwin.c	(revision 188918)
+++ gcc/config/darwin.c	(working copy)
@@ -3007,6 +3007,18 @@  darwin_override_options (void)
       flag_reorder_blocks = 1;
     }
 
+    /* FIXME: flag_objc_sjlj_exceptions is no longer needed since there is only
+       one valid choice of exception scheme for each runtime.  */
+    if (!global_options_set.x_flag_objc_sjlj_exceptions)
+      global_options.x_flag_objc_sjlj_exceptions = 
+				flag_next_runtime && !TARGET_64BIT;
+
+    /* FIXME: and this could be eliminated then too.  */
+    if (!global_options_set.x_flag_exceptions
+	&& flag_objc_exceptions
+	&& TARGET_64BIT)
+      flag_exceptions = 1;
+
   if (flag_mkernel || flag_apple_kext)
     {
       /* -mkernel implies -fapple-kext for C++ */
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 188918)
+++ gcc/config/darwin.h	(working copy)
@@ -140,9 +140,6 @@  extern GTY(()) int darwin_ms_struct;
   } while (0)
 
 #define SUBTARGET_C_COMMON_OVERRIDE_OPTIONS do {                        \
-    if (!global_options_set.x_flag_objc_sjlj_exceptions)		\
-      global_options.x_flag_objc_sjlj_exceptions = 			\
-				flag_next_runtime && !TARGET_64BIT;	\
     if (flag_mkernel || flag_apple_kext)				\
       {									\
 	if (flag_use_cxa_atexit == 2)					\