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.129.124]) by sourceware.org (Postfix) with ESMTPS id 2DC713856B5E for ; Wed, 14 Dec 2022 21:53:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2DC713856B5E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671054795; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aBym567UkpAqX7eKjHsjzCUBnZhNv43f3+ph5P03AuU=; b=eaH57/gURJBaqTzMOmwTeC7mM0eNEDHWrGVhGb92jscuH9GLYwK8sDAXVeBrkv24tRRQc7 3AprAguPX7ax1N/N64A54Da+H+YzJHNXfBmjNt1xqwBlShZ5jh5Z7aAh+rZ7zqXugiH3CL 6uKAxbmCnkY3HW3qX/HCX/FaMEojxsE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-139-9rrm11KxN96JSZ0fv4KUrA-1; Wed, 14 Dec 2022 16:53:12 -0500 X-MC-Unique: 9rrm11KxN96JSZ0fv4KUrA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C70D13C02548; Wed, 14 Dec 2022 21:53:11 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B124C15BA0; Wed, 14 Dec 2022 21:53:11 +0000 (UTC) From: Florian Weimer To: "H.J. Lu" Cc: binutils@sourceware.org Subject: Re: Named local symbols in the ELF dynamic symbol table References: <87y1rke9ub.fsf@oldenburg.str.redhat.com> Date: Wed, 14 Dec 2022 22:53:09 +0100 In-Reply-To: (H. J. Lu's message of "Wed, 14 Dec 2022 13:44:57 -0800") Message-ID: <877cytlkje.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * H. J. Lu: > On Tue, Dec 6, 2022 at 9:11 AM Florian Weimer via Binutils > wrote: >> >> The symbol table of /lib/ld-linux-ia64.so.2 starts like this: >> >> Symbol table [ 3] '.dynsym' contains 65 entries: >> 33 local symbols String table: [ 4] '.dynstr' >> Num: Value Size Type Bind Vis Ndx Name >> 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UNDEF >> 1: 00000000000318c0 160 FUNC LOCAL DEFAULT 10 _dl_error_free >> 2: 00000000000234c0 16 FUNC LOCAL DEFAULT 10 __GI__dl_debug_state >> 3: 0000000000029f80 368 FUNC LOCAL DEFAULT 10 _dl_tls_get_addr_soft >> 4: 000000000002be00 1728 FUNC LOCAL DEFAULT 10 _dl_open >> 5: 0000000000001550 64 FUNC LOCAL DEFAULT 10 _start >> 6: 0000000000031540 784 FUNC LOCAL DEFAULT 10 _dl_runtime_profile >> 7: 0000000000031440 208 FUNC LOCAL DEFAULT 10 _dl_runtime_resolve >> 8: 00000000000312c0 384 FUNC LOCAL DEFAULT 10 _dl_close >> 9: 0000000000018240 10720 FUNC LOCAL DEFAULT 10 _dl_lookup_symbol_x >> 10: 000000000003ab40 80 FUNC LOCAL DEFAULT 10 _rtld_catch_error >> >> The interesting aspect is that these symbols are named, but are not >> covered by the GNU_HASH table (because they are local). >> >> Is there a way to get the same effect on other targets? I want to >> preserve the names of the functions that IFUNC resolvers return, >> eventually improving diagnostics around IFUNC resolution. It would best >> if I wouldn't have to bloat the entire symbol table for that. >> > > Are you interested in R_X86_64_IRELATIVE symbols or something > else? Not particularly. For ld.so --list-diagnostics, I want to iterate through .dynsym, call all IFUNC resolvers, and report the results (for libc, libm, libmvec at least). To make the IFUNC resolver *result* more meaningful, I want to map back the addresses to symbols like __memmove_avx_unaligned_erms, but at the same time, I do not want to make the symbol name __memmove_avx_unaligned_erms available for symbol binding. A local symbol in .dynsym would be a good fit here. We can do this for IRELATIVE relocations, too, but it might be less beneficial. Thanks, Florian