From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92065 invoked by alias); 2 Mar 2020 18:03:04 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 92056 invoked by uid 89); 2 Mar 2020 18:03:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL,BAYES_00,KAM_INFOUSMEBIZ,MSGID_FROM_MTA_HEADER,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.1 spammy=HX-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg:sk:0000000 X-HELO: NAM04-BN3-obe.outbound.protection.outlook.com Received: from mail-oln040092009044.outbound.protection.outlook.com (HELO NAM04-BN3-obe.outbound.protection.outlook.com) (40.92.9.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Mar 2020 18:03:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WojW4LVXo6KH4Kly7Mdd2XAZ+2w3Wtw6m7V+j3oB8yF+SfoJWoo98svZ1W07pVRH13Ne9TA2IVlpTjoPFyLTcupSQZonxeRB93RVJEcpPh6YAcTREKffkNDTeqouA9EcOvlRt0Ed2sxMaXHQjnVz9lCAKMybylEDpjRvLEI7RFb5s5t1a9XRUyAS8W5dG/4u+AN7LR94AhpJM3EcKKrM6Uic4/cSXof7uNqKzKGi5DhtdPzQQg5K1YFCaK2zm0zbU2McVNn6BdfEvRWZn8cQIDcfBrWXoaGpLSe97I6Q48YJ8yY+TmaEkgHucr1stZSRSL2VhVFER7mtmw7Uv0edOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JLniHuGrrFeKywry+N6wkEeTSFNdMsOWH6kmkqC6s84=; b=e+2FISyszSoAiAx++IMrqJ1cQqY0PavD30Vi1z6cJ8nNHXGWJ+IodOGBzbhFKL5VNrQqLJyPu4kGT2dHQkY6euI+H8QXwOpNJCZVT9AGa2wMQmrfxJispymYBlR+TIjeA9ORZQ3IMdtATRJinThk01wUqX2hPLWsi37oekP4cwUflxJb/T2t9PHUkiLPL+AoToQ+D4YwmRUcUqRWKUizWWEU1iOumWQP3VOMUp4SUM73/osO+XbUwGSCO0a7BV7ytXwGaqScgCKsiqmV7C9WB871F2xbJKIVQ44um+WvvhpMBjgVsuWnhGFEqjv4BmToBi/6JEnMPClt/dzgaz/cvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=maskray.me; dmarc=pass action=none header.from=maskray.me; dkim=pass header.d=maskray.me; arc=none Received: from CO1NAM04FT044.eop-NAM04.prod.protection.outlook.com (10.152.90.51) by CO1NAM04HT061.eop-NAM04.prod.protection.outlook.com (10.152.91.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.15; Mon, 2 Mar 2020 18:03:00 +0000 Received: from BY5PR07MB7316.namprd07.prod.outlook.com (10.152.90.60) by CO1NAM04FT044.mail.protection.outlook.com (10.152.91.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14 via Frontend Transport; Mon, 2 Mar 2020 18:03:00 +0000 Received: from BY5PR07MB7316.namprd07.prod.outlook.com ([fe80::9dce:8d96:403c:b724]) by BY5PR07MB7316.namprd07.prod.outlook.com ([fe80::9dce:8d96:403c:b724%6]) with mapi id 15.20.2772.019; Mon, 2 Mar 2020 18:03:00 +0000 References: <20200302065602.jtyhq5wkhmz5kqh2@gmail.com> <20200302105939.GI5384@bubble.grove.modra.org> In-Reply-To: <20200302105939.GI5384@bubble.grove.modra.org> From: Fangrui Song Date: Mon, 02 Mar 2020 18:03:00 -0000 Message-ID: Subject: Re: [PowerPC] Garbage collecting .toc entries in a non-adhoc way (section group) To: Alan Modra Cc: binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Return-Path: i@maskray.me X-Microsoft-Original-Message-ID: MIME-Version: 1.0 Received: from mail-qk1-f179.google.com (209.85.222.179) by MN2PR15CA0040.namprd15.prod.outlook.com (2603:10b6:208:237::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.15 via Frontend Transport; Mon, 2 Mar 2020 18:02:56 +0000 Received: by mail-qk1-f179.google.com with SMTP id b5so549257qkh.8 for ; Mon, 02 Mar 2020 10:02:56 -0800 (PST) X-Microsoft-Original-Message-ID: X-MS-Exchange-AntiSpam-MessageData: kDIq/bVwxJbreYfJ9vyk+f6ZmnycecrNY4FBxl0UHZhhjcBKNd0N9s+qNq3kwA/9YwilDIY/LgO1Snl94a9eDMDK9B+SmSPK3CESS05QPH1rqMksb5kn4z7PxhABxu9iBW1yBAE28IXRct5Y7s/t6g== X-SW-Source: 2020-03/txt/msg00026.txt On Mon, Mar 2, 2020 at 2:59 AM Alan Modra wrote: > > On Sun, Mar 01, 2020 at 10:56:02PM -0800, Fangrui Song wrote: > > Now I am thinking about whether we can produce .toc in section groups to obtain garbage collection ability for free. > > > > .text (not in a section group) references `foo` defined in .data.rel.ro.foo (in a section group) via .toc . > > ``` > > .text > > addis 3,2,.LC0@toc@ha > > > > .section .data.rel.ro.foo,"aGw",foo,comdat > > .globl foo > > foo: > > > > .section .toc,"aGw",@progbits,foo,comdat > > .LC0: > > .tc foo[TC],foo > > ``` > > > > When `.data.rel.ro.foo` and the `.toc` are discarded due to the section > > group rule, the relocation from `.text` to the `.toc` becomes dangling. > > Yes, that breaks the ELF gABI which says: "A symbol table entry with > STB_LOCAL binding that is defined relative to one of a group's > sections, and that is contained in a symbol table section that is not > part of the group, must be discarded if the group members are > discarded. References to this symbol table entry from outside the > group are not allowed." > > I think what you're trying to do is reinvent the GOT. There isn't any > reason why powerpc64 can't use a GOT and GOT relocations. Yes, there is inventing the GOT. But neither GCC nor clang produces foo@got@ha and foo@got@l pairs. Is there some hidden wisdom I am missing?