From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by sourceware.org (Postfix) with ESMTPS id 5E48B385DC3E for ; Tue, 7 Apr 2020 23:16:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5E48B385DC3E Received: by mail-io1-xd41.google.com with SMTP id u2so5215015iop.10 for ; Tue, 07 Apr 2020 16:16:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5NTqvUypzuEmzgOtRp5SGnJW9Y2irzvYyQc5nhG5mbo=; b=oovJStzZLyxW0uvzrRc+E6leYoqxKlkqhy/pTo96egk3K8vCR5JSFiOm6OzAXOHA7t yMNWS7no1KWajW25N7/w3T2BijORx17cvrxiEG+XCMzn9kJDMnkGYVoTF17s9msplosH 2bEV+tnA5oz09HXmg2yMCGW7n1A7XAFl5auYvmE2x1GhUDL1gq8X2HwsXEkUNrYkaffP yBHP/N+Lz1YtBAXEqMQkWY5r5Ra6BNk7r2S2eQVYtVZP9E0DAnIS+diSVyxzOVAtUjXE 7gjyCimpVczN7NOyiDVlaKFAq8JqHyYghHWcYhSyzWaJpMCC4fdy/CSyZB9NW4crdFIj W9bg== X-Gm-Message-State: AGi0PuYdgjXtXJY3rxwU53G0quFmCRYi9F2eGPDqXe5ZKX4xoRzrDM8f oSt2To+nJ6vpG26kumEb9Bfwdi09/zDgDDXWN//zLg== X-Google-Smtp-Source: APiQypK8fObajCawTnS4PyWbXyKiUp+HWc+4hQkai1Qqw9V2dzAHQZcrnyj4gzX6rIpL+eKmHgwcrkz+O1EEhgmjksM= X-Received: by 2002:a6b:f912:: with SMTP id j18mr1785191iog.37.1586301370841; Tue, 07 Apr 2020 16:16:10 -0700 (PDT) MIME-Version: 1.0 References: <20200407121048.265065-1-hjl.tools@gmail.com> <87zhbnxybk.fsf@igel.home> <87v9mbxxoy.fsf@igel.home> <20200407212221.d5y4qghn3tnczmsf@gmail.com> In-Reply-To: <20200407212221.d5y4qghn3tnczmsf@gmail.com> From: "H.J. Lu" Date: Tue, 7 Apr 2020 16:15:35 -0700 Message-ID: Subject: Re: V2 [PATCH] gas: Extend .symver directive To: Fangrui Song Cc: "H.J. Lu via Binutils" , Andreas Schwab Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 23:16:12 -0000 On Tue, Apr 7, 2020 at 2:23 PM Fangrui Song wrote: > > On 2020-04-07, H.J. Lu via Binutils wrote: > >On Tue, Apr 7, 2020 at 5:55 AM Andreas Schwab wrote: > >> > >> On Apr 07 2020, H.J. Lu wrote: > >> > >> > The optional argument VISIBILITY updates the visibility of > >> > the original symbol. The valid visibilities are 'local', 'hidden', and > >> > 'remove'. The 'local' visibility makes the original symbol a local > >> > symbol (*note Local::). The 'hidden' visibility sets the visibility of > >> > the original symbol to 'hidden' (*note Hidden::). The 'remove' > >> > visibility removes the original symbol from the symbol table. If > >> > visibility isn't specified, the original symbol is unchanged. > >> > >> Looks good. > > > >Here is the updated patch. > > > >-- > >H.J. > > Let me summarize the current status: > > @@@ has the renaming semantics. (invented in 2000) > @ and @@ has the copying semantics. The original symbol remains which is usually cumbersome. > > We have received some requests: > > * Have a way to not retain the original symbol > * Have a way to define multiple versions `.symver something,foo@v1; .symver something,foo@v2. symver something,foo@@v3` > > > We have many choices. > > A. make @ @@ similar to @@@ > For @@, because of the linking rule (a @@ definition can satisfy a > referenced without a version), there should be no difference. > > For @, this will be a semantic break. Personally I don't think this > matters. I believe 99% projects don't need the original symbol and > will not notice anything. I also checked with FreeBSD developers. The original symbol name is used in glibc to bypass PLT within libc.so. > However, given the general conservative attitude of the binutils > community, I think there might be some objection. > > Reusing the same stem name is very likely a mistake. > > .globl foo_v1 > .symver foo_v1,foo@v1 > foo_v1: > > A non-default version can be used to reject static archive linking > while keep shared object compatibility. An undefined reference foo > without a version cannot be satisfied by the definition. > > Keeping `foo` + .symver foo,foo@v1 will nullify the use case. > > B. Add an optional argument to change binding/visibility or remove the > original symbol (this patch). > I am mostly worried that this makes the .symver semantics even harder > to understand / explain in the documentation. > > There seems to make @@@ even more inconsistent with @/@@. > > BTW, have you checked .localentry (which can set the non-visibility > bits of st_other) That is a PPC specific directive. > I ask for clarification from GCC developers why some special > attributes (local/hidden) are needed, not other general attribute > flags. .symver was designed to be used in assembly codes for glibc. Only recently GCC is trying to use it. That is one reason why it is the way it is. -- H.J.