From patchwork Tue May 3 18:40:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 53428 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C3174395A444 for ; Tue, 3 May 2022 18:41:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3174395A444 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1651603285; bh=cgWR6nvDeUwJgT2lbRPGtzV8zs8TLkx3aH9X7+dWu4U=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=xo3+mq40S6Sfx5I4k0Jt9Yybm7/KBjsuEOInWmc1w+AtF17+0gsFaffGRVz7DvnXF rSp7Qgaqz+NblsnyXdj4BcKmY2rAr/VXE5yhMzP5tHeAdv0yf5EoS4soMZJcLSqYJv zj0di8vBsu6q/szmOuLHbOEbnQYnH0BvTFP/1jn4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 79F56395A070 for ; Tue, 3 May 2022 18:40:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 79F56395A070 Received: by mail-wr1-x433.google.com with SMTP id x18so24576798wrc.0 for ; Tue, 03 May 2022 11:40:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:reply-to :mime-version:content-transfer-encoding; bh=cgWR6nvDeUwJgT2lbRPGtzV8zs8TLkx3aH9X7+dWu4U=; b=x6jQnsIB7edDnHA35S1+Gr4/blErw0FwaEwi9zivnl5WRKM4I/eU58Q7qamw1jYcM+ c/+QdaQoGeL60daZMDNnsktO2wdnQHCnaJ9bqXF0KXdwlj4ZLEjUKA8bOE3blto06rb8 d/i8zRPNo8zcMUoc+T8D/KjMsHgO+c1EhdPsqoRagEP7BXZ2LVUGRpjLjuyGER3C+l13 ErUIYU5vxTMynhGHK1A0W0hb3xKqq+bSO/dylyKiyScsNK4D341bBhR3iukbpOQ0W1YB /ythuXavXxgitV8ofCjCy3oS2qehKgDL13cT7csQ5YI3AmwjKpfI+DJHS+gdzxTWqMpQ lnNg== X-Gm-Message-State: AOAM531hV5uFlAHvDXZLrWnTYBSxE82aaPpY7fOeHny2+39z3qAYu7jU oRNB0mvxolIHfKfj3+aJ0AotUl9WTng= X-Google-Smtp-Source: ABdhPJxV32txZaXOXmZ0Cbh6VLhsrWYsMa0s79GCm4a0N/OtPll3iydUtqdBW0tV35py1FVd2K05PQ== X-Received: by 2002:a5d:59a5:0:b0:20c:5603:c0c3 with SMTP id p5-20020a5d59a5000000b0020c5603c0c3mr12658386wrr.521.1651603255080; Tue, 03 May 2022 11:40:55 -0700 (PDT) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id r11-20020adfa14b000000b0020c5253d8bbsm9646742wrr.7.2022.05.03.11.40.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 May 2022 11:40:54 -0700 (PDT) X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [pushed] Objective-C, NeXT: Adjust symbol marking to match host tools. Date: Tue, 3 May 2022 19:40:48 +0100 Message-Id: <20220503184048.61614-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Sandoe via Gcc-patches From: Iain Sandoe Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. Tested on i686, x86_64 and a cross to aarch64 Darwin. pushed to master, thanks, Iain Signed-off-by: Iain Sandoe gcc/ChangeLog: * config/darwin.cc (darwin_label_is_anonymous_local_objc_name): Make protocol class methods linker-visible. gcc/objc/ChangeLog: * objc-next-runtime-abi-02.cc (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. --- gcc/config/darwin.cc | 2 ++ gcc/objc/objc-next-runtime-abi-02.cc | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc index f065a13d73d..1b3de338926 100644 --- a/gcc/config/darwin.cc +++ b/gcc/config/darwin.cc @@ -1936,6 +1936,8 @@ darwin_label_is_anonymous_local_objc_name (const char *name) } else if (startswith ((const char *)p, "ClassMethods")) return false; + else if (startswith ((const char *)p, "ClassProtocols")) + return false; else if (startswith ((const char *)p, "Instance")) { if (p[8] == 'I' || p[8] == 'M') diff --git a/gcc/objc/objc-next-runtime-abi-02.cc b/gcc/objc/objc-next-runtime-abi-02.cc index e50ca6e89f5..9ea63b189c7 100644 --- a/gcc/objc/objc-next-runtime-abi-02.cc +++ b/gcc/objc/objc-next-runtime-abi-02.cc @@ -1033,6 +1033,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; } @@ -2115,8 +2116,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); } } @@ -2318,6 +2319,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. */