Skip to content

Commit b6ead09

Browse files
committed
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 <iain@sandoe.co.uk> (cherry picked from commit 9b5c0be)
1 parent 2bb5a67 commit b6ead09

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gcc/objc/objc-next-runtime-abi-02.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ along with GCC; see the file COPYING3. If not see
7272
#define TAG_MSGSENDSUPER_STRET "objc_msgSendSuper2_stret"
7373

7474
#define USE_FIXUP_BEFORE 100600
75+
#define WEAK_PROTOCOLS_AFTER 100700
7576
#define TAG_FIXUP "_fixup"
7677

7778

@@ -1025,7 +1026,7 @@ next_runtime_abi_02_protocol_decl (tree p)
10251026
/* static struct _objc_protocol _OBJC_Protocol_<mumble>; */
10261027
snprintf (buf, BUFSIZE, "_OBJC_Protocol_%s",
10271028
IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
1028-
if (flag_next_runtime >= USE_FIXUP_BEFORE)
1029+
if (flag_next_runtime >= WEAK_PROTOCOLS_AFTER)
10291030
{
10301031
decl = create_hidden_decl (objc_v2_protocol_template, buf);
10311032
DECL_WEAK (decl) = true;
@@ -2312,7 +2313,7 @@ build_v2_protocol_list_address_table (void)
23122313
gcc_assert (ref->id && TREE_CODE (ref->id) == PROTOCOL_INTERFACE_TYPE);
23132314
snprintf (buf, BUFSIZE, "_OBJC_LabelProtocol_%s",
23142315
IDENTIFIER_POINTER (PROTOCOL_NAME (ref->id)));
2315-
if (flag_next_runtime >= USE_FIXUP_BEFORE)
2316+
if (flag_next_runtime >= WEAK_PROTOCOLS_AFTER)
23162317
{
23172318
decl = create_hidden_decl (objc_protocol_type, buf, /*is def=*/true);
23182319
DECL_WEAK (decl) = true;

0 commit comments

Comments
 (0)