From: Matt Jacobson <mhjacobson@me.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Objective-C: don't require redundant -fno-objc-sjlj-exceptions for the NeXT v2 ABI
Date: Wed, 28 Jul 2021 23:35:56 -0400 [thread overview]
Message-ID: <7A5B0FDB-BE51-4801-96A1-6C83899F3D0C@me.com> (raw)
As is, an invocation of GCC with -fnext-runtime -fobjc-abi-version=2 crashes,
unless target-specific code adds an implicit -fno-objc-sjlj-exceptions (which
Darwin does).
This patch makes the general case not crash.
I don't have commit access, so if this patch is suitable, I'd need someone else
to commit it for me. Thanks.
gcc/objc/ChangeLog:
2021-07-28 Matt Jacobson <mhjacobson@me.com>
* objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Warn
about and reset flag_objc_sjlj_exceptions regardless of
flag_objc_exceptions.
gcc/c-family/ChangeLog:
2021-07-28 Matt Jacobson <mhjacobson@me.com>
* c-opts.c (c_common_post_options): Default to
flag_objc_sjlj_exceptions = 1 only when flag_objc_abi < 2.
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index c51d6d34726..2568df67972 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -840,9 +840,9 @@ c_common_post_options (const char **pfilename)
else if (!flag_gnu89_inline && !flag_isoc99)
error ("%<-fno-gnu89-inline%> is only supported in GNU99 or C99 mode");
- /* Default to ObjC sjlj exception handling if NeXT runtime. */
+ /* Default to ObjC sjlj exception handling if NeXT <v2 runtime. */
if (flag_objc_sjlj_exceptions < 0)
- flag_objc_sjlj_exceptions = flag_next_runtime;
+ flag_objc_sjlj_exceptions = (flag_next_runtime && flag_objc_abi < 2);
if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
flag_exceptions = 1;
diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c
index 66c13ad0db2..9a0868410a8 100644
--- a/gcc/objc/objc-next-runtime-abi-02.c
+++ b/gcc/objc/objc-next-runtime-abi-02.c
@@ -245,7 +245,7 @@ objc_next_runtime_abi_02_init (objc_runtime_hooks *rthooks)
{
extern_names = ggc_cleared_vec_alloc<hash> (SIZEHASHTABLE);
- if (flag_objc_exceptions && flag_objc_sjlj_exceptions)
+ if (flag_objc_sjlj_exceptions)
{
inform (UNKNOWN_LOCATION,
"%<-fobjc-sjlj-exceptions%> is ignored for "
next reply other threads:[~2021-07-29 3:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 3:35 Matt Jacobson [this message]
2021-08-02 21:09 ` Eric Gallager
2021-08-02 21:37 ` Matt Jacobson
2021-08-03 18:39 ` Iain Sandoe
2021-08-11 2:06 ` Matt Jacobson
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=7A5B0FDB-BE51-4801-96A1-6C83899F3D0C@me.com \
--to=mhjacobson@me.com \
--cc=gcc-patches@gcc.gnu.org \
/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).