From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by sourceware.org (Postfix) with ESMTPS id 4863B3982413 for ; Wed, 16 Jun 2021 04:42:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4863B3982413 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=maskray.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f169.google.com with SMTP id g6so1202908pfq.1 for ; Tue, 15 Jun 2021 21:42:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eP9UbS4ldJJ9bNbfco2mk1RuJvfTS1hBVda93alAiJs=; b=U3YrbUyxpCsq3jr0IX874Do6AJ+B9wSg4FwKgJ/WDD2cog6PoirdEJVfCDimVZNz1q if/vQoyAg9PNBnqiJWqRm3efyETL2fmrwAKVabnLamIbmZ6jxDmpq5bHtgJEuNeemjpy /Guot0BNehpZYfyjllDkQeJ6IlcervxBxPe6NMBwKQMe+czcEVwRKGSgfI87flG8oy9Q DNmI9nc1ycT7EAMS2Gf89+K9nA10Glu/fBMiMtSTyHLZqyOCOLjH58nqp/M6r8VYaVF3 C7EFAWAZehIOo3c7vtPKNFirBsLsNDAhp9KUtgHPxpvD19rMTyX7WLy8YgQrjIseEIR8 Z1dw== X-Gm-Message-State: AOAM532vGeuNLU7qqwmTF2jqylkNrlccbwLTXfyg31Hf/04KSXtUwowX nb4xy6PjyMdhjHrcwET/sTY= X-Google-Smtp-Source: ABdhPJw5LurGohQDxGyHB8Qguf7ehyzvqmAB9HhCEZPltVGVvT5weeIWJ/2y/lhk8HzhTgpmL+SCDw== X-Received: by 2002:a05:6a00:1808:b029:2f0:53eb:6645 with SMTP id y8-20020a056a001808b02902f053eb6645mr6428691pfa.46.1623818538412; Tue, 15 Jun 2021 21:42:18 -0700 (PDT) Received: from localhost ([2601:647:4b01:ae80:7f29:92d6:45db:ac94]) by smtp.gmail.com with ESMTPSA id p11sm655557pfo.126.2021.06.15.21.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 21:42:18 -0700 (PDT) Date: Tue, 15 Jun 2021 21:42:17 -0700 From: Fangrui Song To: Alan Modra Cc: Cary Coutant , "H.J. Lu" , Michael Matz , Florian Weimer , Szabolcs Nagy , "binutils@sourceware.org" , Fangrui Song Subject: Re: [PATCH] Allow direct access relocations referencing a protected function symbol Message-ID: <20210616044217.6coujfcfpvz2de5h@gmail.com> References: <20210613215400.261932-1-maskray@google.com> <20210614174336.4g4gesqc6nxnmho4@gmail.com> <20210615031932.i4g36e4bmwplsgoi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Wed, 16 Jun 2021 04:42:21 -0000 On 2021-06-16, Alan Modra wrote: >On Mon, Jun 14, 2021 at 08:19:32PM -0700, Fangrui Song wrote: >> On 2021-06-15, Alan Modra wrote: >> > On Mon, Jun 14, 2021 at 10:43:36AM -0700, Fangrui Song wrote: >> > > I shall add a note that this patch will restore the behavior before late >> > > 2015 or early 2016. >> > >> > Also add a note that the patch you posted is incorrect. >> >> Only the description needs an update. The code is correct. > >How would you respond if I submitted a patch to lld that you could see >was wrong, but I kept arrogantly claiming was correct? > >-- >Alan Modra >Australia Development Lab, IBM If you have found a mistake, please point out the mistake. No euphemism or sarcasm is needed. I said "Treat protected function symbols local to the component like hidden/internal visibilities." That is certainly not my invention of the semantics of STV_PROTECTED. Multiple people agreed on this. https://groups.google.com/g/generic-abi/c/waK1dGiUGvM/m/7Uid2HH4IQAJ (which I have linked to previously) Solaris ld agrees with this (from the dump of the generic-abi discussion). gold agrees with this: https://sourceware.org/bugzilla/show_bug.cgi?id=19823#c1 I have heard multiple folks said "protected symbols are broken." Why? As-is, __attribute__((visibility("protected"))) void *foo () { return (void *)foo; } gcc -fpic -shared b.c -fuse-ld=bfd b.c is broken. The code generation does have inferior optimization in certain places but they are not correctness issues. My intention was to fix the ld problem. I have answered that there is no compatibility issue.