From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id 1E8BD3858D35; Mon, 22 Apr 2024 13:13:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E8BD3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713791612; bh=sLdsetTtxwiGbEC2bVGcR66WAfNr4zfTmIlw9VESJ84=; h=From:To:Subject:Date:From; b=kpecRIaWGNc7CzH0E99Y+JTudX1aySBIZLuYET+SVM2nB51mtGBgIWPhnnB0icdQv 2lMTjavnSxW+3e8PWjzHCFBR3HiI/+HXVEjZujx5/qDj4LShlhLnyY9NPwPwKDPnqv RooRRjS7wovqJZI2FF8FbYNdxhVkfRbl4LVIfab8= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-11337] Objective-C, NeXT: Adjust symbol marking to match host tools. X-Act-Checkin: gcc X-Git-Author: Iain Sandoe X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: d79d1073c444ceb85b3cd2f55be7b4dfe598d287 X-Git-Newrev: 49c3c423218ea5f02dbbc6b847e15c06174f81ba Message-Id: <20240422131332.1E8BD3858D35@sourceware.org> Date: Mon, 22 Apr 2024 13:13:31 +0000 (GMT) List-Id: https://gcc.gnu.org/g:49c3c423218ea5f02dbbc6b847e15c06174f81ba commit r11-11337-g49c3c423218ea5f02dbbc6b847e15c06174f81ba Author: Iain Sandoe Date: Mon May 2 19:42:49 2022 +0100 Objective-C, NeXT: Adjust symbol marking to match host tools. Current host tools mark some additional symbols as 'no dead strip' and also expose one additional group to the linker. This does not affect older Darwin versions or x86_64, but omitting these changes results in link errors for aarch64. Signed-off-by: Iain Sandoe gcc/ChangeLog: * config/darwin.c (darwin_label_is_anonymous_local_objc_name): Make protocol class methods linker-visible. gcc/objc/ChangeLog: * objc-next-runtime-abi-02.c (next_runtime_abi_02_protocol_decl): Do not dead-strip the runtime meta-data symbols. (build_v2_classrefs_table): Likewise. (build_v2_protocol_list_address_table): Likewise. (cherry picked from commit ecd5727c0a662a8fea6b5f8eac6f3f15bf5ef851) Diff: --- gcc/config/darwin.c | 2 ++ gcc/objc/objc-next-runtime-abi-02.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index b79c0d1d2b4..dedf84d6247 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1933,6 +1933,8 @@ darwin_label_is_anonymous_local_objc_name (const char *name) } else if (!strncmp ((const char *)p, "ClassMethods", 12)) return false; + else if (!strncmp ((const char *)p, "ClassProtocols", 14)) + return false; else if (!strncmp ((const char *)p, "Instance", 8)) { if (p[8] == 'I' || p[8] == 'M') diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c index 19f137c632e..f1c858b2cd7 100644 --- a/gcc/objc/objc-next-runtime-abi-02.c +++ b/gcc/objc/objc-next-runtime-abi-02.c @@ -1035,6 +1035,7 @@ next_runtime_abi_02_protocol_decl (tree p) else decl = start_var_decl (objc_v2_protocol_template, buf); OBJCMETA (decl, objc_meta, meta_protocol); + DECL_PRESERVE_P (decl) = 1; return decl; } @@ -2124,8 +2125,8 @@ build_v2_classrefs_table (void) expr = convert (objc_class_type, build_fold_addr_expr (expr)); } /* The runtime wants this, even if it appears unused, so we must force the - output. - DECL_PRESERVE_P (decl) = 1; */ + output. */ + DECL_PRESERVE_P (decl) = 1; finish_var_decl (decl, expr); } } @@ -2327,6 +2328,7 @@ build_v2_protocol_list_address_table (void) expr = convert (objc_protocol_type, build_fold_addr_expr (ref->refdecl)); OBJCMETA (decl, objc_meta, meta_label_protocollist); finish_var_decl (decl, expr); + DECL_PRESERVE_P (decl) = 1; } /* TODO: delete the vec. */