From: Iain Sandoe Date: Tue, 30 Apr 2024 14:11:56 +0000 (+0100) Subject: Objective-C, NeXT, v2: Correct a regression in code-gen. X-Git-Tag: releases/gcc-13.3.0~95 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b6ead0978b0513c0efa040b8bda21a67a454dd27;p=thirdparty%2Fgcc.git Objective-C, NeXT, v2: Correct a regression in code-gen. There have been several changes in the ABI of Objective-C which depend on the OS version targetted. In this case Protocols and LabelProtocols should be made weak/hidden/extern from macOS 10.7 however there was a mistake in the code causing this to occur from macOS 10.6. Fixed thus. gcc/objc/ChangeLog: * objc-next-runtime-abi-02.cc (WEAK_PROTOCOLS_AFTER): New. (next_runtime_abi_02_protocol_decl): Use WEAK_PROTOCOLS_AFTER to determine this ABI change. (build_v2_protocol_list_address_table): Likewise. Signed-off-by: Iain Sandoe (cherry picked from commit 9b5c0be59d0f94df0517820f00b4520b5abddd8c) --- diff --git a/gcc/objc/objc-next-runtime-abi-02.cc b/gcc/objc/objc-next-runtime-abi-02.cc index 7a674a0e45eb..012f7538fc95 100644 --- a/gcc/objc/objc-next-runtime-abi-02.cc +++ b/gcc/objc/objc-next-runtime-abi-02.cc @@ -72,6 +72,7 @@ along with GCC; see the file COPYING3. If not see #define TAG_MSGSENDSUPER_STRET "objc_msgSendSuper2_stret" #define USE_FIXUP_BEFORE 100600 +#define WEAK_PROTOCOLS_AFTER 100700 #define TAG_FIXUP "_fixup" @@ -1025,7 +1026,7 @@ next_runtime_abi_02_protocol_decl (tree p) /* static struct _objc_protocol _OBJC_Protocol_; */ snprintf (buf, BUFSIZE, "_OBJC_Protocol_%s", IDENTIFIER_POINTER (PROTOCOL_NAME (p))); - if (flag_next_runtime >= USE_FIXUP_BEFORE) + if (flag_next_runtime >= WEAK_PROTOCOLS_AFTER) { decl = create_hidden_decl (objc_v2_protocol_template, buf); DECL_WEAK (decl) = true; @@ -2312,7 +2313,7 @@ build_v2_protocol_list_address_table (void) gcc_assert (ref->id && TREE_CODE (ref->id) == PROTOCOL_INTERFACE_TYPE); snprintf (buf, BUFSIZE, "_OBJC_LabelProtocol_%s", IDENTIFIER_POINTER (PROTOCOL_NAME (ref->id))); - if (flag_next_runtime >= USE_FIXUP_BEFORE) + if (flag_next_runtime >= WEAK_PROTOCOLS_AFTER) { decl = create_hidden_decl (objc_protocol_type, buf, /*is def=*/true); DECL_WEAK (decl) = true;