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 173083883F0A for ; Fri, 9 Dec 2022 17:34:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 173083883F0A 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=1670607293; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eceuABKtEz2doieYZpjQGhXIhZv0lgjSrAzPT9f2DJg=; b=P/iEiNKIr3OI9Rvu26+3QkOHKRr26uJu/ZGMqMoussKiZqxaxl/kyCx3Ji9VrmbAlfWwnS PscB2THSCLP5RynH4T6+HWpTywM+wNFkwIxgVQbXGZVNDb2IzmsBbIbN0wTsQeFrcSlTxg w+x7wGdQ4rW7vN0lpbvo38umv5hdSsI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-614-yOw0yOpsNwO_sl282_JgxQ-1; Fri, 09 Dec 2022 12:34:52 -0500 X-MC-Unique: yOw0yOpsNwO_sl282_JgxQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3795385A5A6 for ; Fri, 9 Dec 2022 17:34:52 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.168]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 96A121121339; Fri, 9 Dec 2022 17:34:51 +0000 (UTC) From: Florian Weimer To: Nick Clifton Cc: binutils@sourceware.org Subject: Re: Named local symbols in the ELF dynamic symbol table References: <87y1rke9ub.fsf@oldenburg.str.redhat.com> <15cc745d-b635-daab-4a02-918a5ea5d923@redhat.com> Date: Fri, 09 Dec 2022 18:34:47 +0100 In-Reply-To: <15cc745d-b635-daab-4a02-918a5ea5d923@redhat.com> (Nick Clifton's message of "Thu, 8 Dec 2022 13:19:41 +0000") Message-ID: <87edt8jxag.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.5 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: * Nick Clifton: > Hi Florian, > >> Is there a way to get the same effect on other targets? > > How are the loaders for other targets linked ? If they include the > -X or --discard-locals option on the command line, then removing that > option might achieve the result that you desire. I'm using: gcc -nostdlib -nostartfiles -shared -o =E2=80=A6/build/elf/ld.so.new \ -Wl,-z,relro -Wl,-z,defs \ =E2=80=A6/build/elf/librtld.os -Wl,--version-script=3D=E2=80=A6/b= uild/ld.map \ -Wl,-soname=3Dld-linux-x86-64.so.2 gcc -v tells me: /usr/libexec/gcc/x86_64-redhat-linux/11/collect2 \ -plugin /usr/libexec/gcc/x86_64-redhat-linux/11/liblto_plugin.so \ -plugin-opt=3D/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper \ -plugin-opt=3D-fresolution=3D/tmp/ccHaMg3U.res --build-id --no-add-needed= \ --eh-frame-hdr --hash-style=3Dgnu -m elf_x86_64 -shared \ -o =E2=80=A6/build/elf/ld.so.new -L/usr/lib/gcc/x86_64-redhat-linux/11 \ -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64 -L/lib/../lib64 \ -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/11/../../.. \ -z relro -z defs =E2=80=A6/build/elf/librtld.os --version-script=3D=E2=80= =A6/build/ld.map \ -soname=3Dld-linux-x86-64.so.2 So it seems that -X or --discard-locals is the default? How do I override that, preferably for specific symbols only? >> It would best >> if I wouldn't have to bloat the entire symbol table for that. > > I don't think that you have symbol names without having entries in > the symbol table. Although as you say, if they are local symbols > then they will not also take up room in the GNU_HASH table. Yeah, should have said symbol hash table. I really want them in .dynsym actually. Thanks, Florian