public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: IainS <developer@sandoe-acoustics.co.uk>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Mike Stump <mrs@gcc.gnu.org>,
	       Nicola Pero <nicola.pero@meta-innovation.com>
Subject: [Patch ObjC] fix objc.dg/exceptions2.m linkage error.
Date: Fri, 17 Dec 2010 15:52:00 -0000	[thread overview]
Message-ID: <CDE2122D-3A5B-4DE6-84E2-AE152A68F42C@sandoe-acoustics.co.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

The NeXT runtime library names its m64 personality routine  
"___objc_personality_v0"

So, in addition to the change to switch off sjlj exceptions (which  
causes linkage errors for the absent sjlj routines),
we also need to generate the right name for the eh personality...

OK?
Iain

objc:

	* objc/objc-act.c (objc_eh_personality): Select personality name on  
runtime.
	(objc_init_exceptions): New.
	(objc_begin_try_stmt): Use objc_init_exceptions.
	(objc_build_throw_stmt): Likewise.


[-- Attachment #2: 167976-objc-m64-except.txt --]
[-- Type: text/plain, Size: 2635 bytes --]

Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c	(revision 167976)
+++ gcc/objc/objc-act.c	(working copy)
@@ -5028,11 +5028,41 @@ tree
 objc_eh_personality (void)
 {
   if (!flag_objc_sjlj_exceptions && !objc_eh_personality_decl)
-    objc_eh_personality_decl = build_personality_function ("gnu_objc");
+    objc_eh_personality_decl = build_personality_function 
+				(flag_next_runtime
+						? "objc"
+						: "gnu_objc");
   return objc_eh_personality_decl;
 }
 #endif
 
+static void
+objc_init_exceptions (location_t loc)
+{
+  static bool done = false;
+
+  /* -fobjc-exceptions is required to enable Objective-C exceptions.
+     For example, on Darwin, ObjC exceptions require a sufficiently
+     recent version of the runtime, so the user must ask for them
+     explicitly.  On other platforms, at the moment -fobjc-exceptions
+     triggers -fexceptions which again is required for exceptions to
+     work.
+  */
+  if (!flag_objc_exceptions)
+    {
+      error_at (loc, "%<-fobjc-exceptions%> is required to enable Objective-C exception syntax");
+    }
+
+  /* We could arrange for only one warning - by moving this before the check.  */
+  if (done)
+    return;
+  done = true;
+
+#ifndef OBJCPLUS
+  using_eh_for_cleanups ();
+#endif
+}
+
 /* Build __builtin_eh_pointer, or the moral equivalent.  In the case
    of Darwin, we'll arrange for it to be initialized (and associated
    with a binding) later.  */
@@ -5334,17 +5364,7 @@ objc_begin_try_stmt (location_t try_locus, tree bo
   c->end_try_locus = input_location;
   cur_try_context = c;
 
-  /* -fobjc-exceptions is required to enable Objective-C exceptions.
-     For example, on Darwin, ObjC exceptions require a sufficiently
-     recent version of the runtime, so the user must ask for them
-     explicitly.  On other platforms, at the moment -fobjc-exceptions
-     triggers -fexceptions which again is required for exceptions to
-     work.
-  */
-  if (!flag_objc_exceptions)
-    {
-      error_at (try_locus, "%<-fobjc-exceptions%> is required to enable Objective-C exception syntax");
-    }
+  objc_init_exceptions (try_locus);
 
   /* Collect the list of local variables.  We'll mark them as volatile
      at the end of compilation of this function to prevent them being
@@ -5552,10 +5572,7 @@ objc_build_throw_stmt (location_t loc, tree throw_
 {
   tree args;
 
-  if (!flag_objc_exceptions)
-    {
-      error_at (loc, "%<-fobjc-exceptions%> is required to enable Objective-C exception syntax");
-    }
+  objc_init_exceptions (loc);
 
   if (throw_expr == NULL)
     {

[-- Attachment #3: Type: text/plain, Size: 3 bytes --]





             reply	other threads:[~2010-12-17 14:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17 15:52 IainS [this message]
2010-12-17 19:03 ` Nicola Pero
2010-12-17 21:09 ` Mike Stump
2010-12-18 11:57   ` IainS
2010-12-18 14:27     ` Nicola Pero
2010-12-18 18:58       ` Mike Stump

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CDE2122D-3A5B-4DE6-84E2-AE152A68F42C@sandoe-acoustics.co.uk \
    --to=developer@sandoe-acoustics.co.uk \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mrs@gcc.gnu.org \
    --cc=nicola.pero@meta-innovation.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).