From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id F2D3C3856DE0 for ; Tue, 23 Aug 2022 12:29:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F2D3C3856DE0 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-524-bLZZUSa6N1Sx_ze87NA5dA-1; Tue, 23 Aug 2022 08:29:02 -0400 X-MC-Unique: bLZZUSa6N1Sx_ze87NA5dA-1 Received: by mail-wm1-f70.google.com with SMTP id f18-20020a05600c4e9200b003a5f81299caso7897904wmq.7 for ; Tue, 23 Aug 2022 05:29:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=bnUL+Xuc6jmMYe+OyTIdwwzPEin0sj6DuhDyTVT3KK8=; b=sDLgEBm7KtH86+tcl768BxonkQur9JqKvrJJyFJrSR9t+RhYgfHxFVeBnL/BYVpsfm 2KI0XFB2Y76xApbZwTRW29S135rCs7MjiohUlSgKaNBYEPngLHnfqik3BilXjQJRp6UC Nc1yCzTYmVNqlX4V+QuYQ0zgNVp//PwWe7gZ57c8NW5bbRg1lU47xWIl8zeDZPL2Of+l NlP59WmmHL7V2HX3DgLq9vAJQ44kPqrKUBoLgotOQKMhDVki/Xstzyy36FhEHwx5mgpI 6wgEqDpoZhuWeh92tt5eO2gHY+54usgAQlFs/iqe1DJlAgkUNBtuGvj1QKQxYHSm3S5u lwGg== X-Gm-Message-State: ACgBeo2kYIq1NFWvdIB4OJWn1NglB8rRYqVJtgMedJyWAk3qQm29Nrcb X+gm/feoG4nQlOiGRL0m52aWFS/0ldYIeMhLsr8JnI6X5olAgO2u3y8rVygn2/i22nUC68/wnDx 16/7E1AQ= X-Received: by 2002:a05:600c:a02:b0:39d:bdf8:a4f4 with SMTP id z2-20020a05600c0a0200b0039dbdf8a4f4mr2048618wmp.201.1661257741425; Tue, 23 Aug 2022 05:29:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR6OaBPja3Sv9fRbjg4s6p//6X5biEv915LB0sPuiADxiUFwDizMOTIsxNYXyAPahzlGc82nFg== X-Received: by 2002:a05:600c:a02:b0:39d:bdf8:a4f4 with SMTP id z2-20020a05600c0a0200b0039dbdf8a4f4mr2048599wmp.201.1661257741211; Tue, 23 Aug 2022 05:29:01 -0700 (PDT) Received: from [192.168.1.6] (adsl-2-solo-236-177.claranet.co.uk. [80.168.236.177]) by smtp.gmail.com with ESMTPSA id v2-20020a5d6b02000000b0021e30e9e44asm13803178wrw.53.2022.08.23.05.29.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Aug 2022 05:29:00 -0700 (PDT) Message-ID: <9e531668-7cc7-ef01-a74a-07cd19c289c5@redhat.com> Date: Tue, 23 Aug 2022 13:28:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 To: Florian Weimer , binutils@sourceware.org Cc: gcc@gcc.gnu.org, libc-alpha@sourceware.org References: <87fshn2mu1.fsf@oldenburg.str.redhat.com> From: Nick Clifton Subject: Re: Counting static __cxa_atexit calls In-Reply-To: <87fshn2mu1.fsf@oldenburg.str.redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-GB Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2022 12:29:07 -0000 Hi Florian, > What would be the most ELF-flavored way to implement this? After the > final link, I expect that the count (or counts, we need a separate > counter for thread-local storage) would show up under a new dynamic tag > in the dynamic segment. This is actually a very good fit because older > loaders will just ignore it. But the question remains what GCC should > emit into assembler & object files, so that the link editor can compute > the total count from that. (It would worthwhile asking this question of the LLVM community too, since ideally we would like to use the same method in both compilers). This sounds like an opportunity to add a couple of new GNU object attributes: .gnu_attribute Tag_gnu_destructor_count, .gnu_attribute Tag_gnu_tld_count, Which would then translate into a GNU object attribute notes in the object file. Cheers Nick