From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by sourceware.org (Postfix) with ESMTPS id E4CE03857034 for ; Wed, 24 Aug 2022 01:41:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E4CE03857034 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x102c.google.com with SMTP id t11-20020a17090a510b00b001fac77e9d1fso59025pjh.5 for ; Tue, 23 Aug 2022 18:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=6TsX6VtPOr/+I+PFbCDz1iMazDSG5+RsGMXHaaK7rQo=; b=qVWmQgQySX2JnaGVvgLA//Q0ydw24NN49dt4sGDa/OuS+isfDYl7QTT06Syuj09NIr lmnsu2wqz/crvQl8zGFapT081bADs2LyxUFGBCeWJ77HjW1LXzp9GRRV/xc7Of8FF4jZ atOrGogeuR5o/pRIO/EdmwXL6+OKIXPzdUPY2ZvDqVSxBnCNvKkVbEgwo06DH+bhc09w BgCCnormomkJ0z7jPMkofnEDHT7RD5otJ2MPUk2oCY7NH0LL5EUAQfufB6qd5OETxEhW snmRGNL7QME02IrqGg3JnxWnt9ZnxFLxrbL4dhLNqCet/3w0IC5mnKDEijxL3tug+mMF SCsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=6TsX6VtPOr/+I+PFbCDz1iMazDSG5+RsGMXHaaK7rQo=; b=y4t2o0g17L4CfuxCWvp4KQlSFQf2oUujP1Bi03OYvZDJwUseTZF+H/HNR1fuAQSKvc 8vW3g+p1QJ4gem3J9AhS/8Gy5bYmB2H2hg7FIgGIXL3YRfMC/RrP/77vqU5qNPu4Vz1F QJQzPBsXSIBI3ISJgTN+jiXQkhB9wffYIJfTno6fkTRZKkhFkYfxvyXqiT2ZVo1dHTT9 /HEk6XAmDQBjL3G7LlliZa8utnziPpYmhf5sR+ZRuDLp8NwlypDGe9vdFfe/fXb0tajk c0QGjBNOe9nClwXG74/deLBfLIrtlujJWG1llFtVVLy9Qp4dLTOZjFBygxNAhakP4sR2 sscA== X-Gm-Message-State: ACgBeo1TZnM6fUOZ2Qr2Tl5jVlAGjPkUs7atwcaMJPKqbBFYkEqb7ky5 pisa8Ctj7A3EbXoNCLYYT1o= X-Google-Smtp-Source: AA6agR7iQGAj3QcgL3/ErDEKP/JvOz3sdNDzBbt0j5vFkzepk2xwdSYtwx4oJq416VuPV0coNhN7fw== X-Received: by 2002:a17:90a:17e6:b0:1fb:2936:83bd with SMTP id q93-20020a17090a17e600b001fb293683bdmr5960400pja.132.1661305259889; Tue, 23 Aug 2022 18:40:59 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id z17-20020a170902d55100b00172ea32fa9bsm5225770plf.287.2022.08.23.18.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 18:40:59 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id BDC421142EA6; Wed, 24 Aug 2022 11:10:56 +0930 (ACST) Date: Wed, 24 Aug 2022 11:10:56 +0930 From: Alan Modra To: "H.J. Lu" Cc: binutils@sourceware.org Subject: Re: [PATCH] x86: Ignore protected visibility in shared libraries on Solaris Message-ID: References: <20220823173432.36035-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3029.8 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,T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Aug 24, 2022 at 09:46:32AM +0930, Alan Modra wrote: > On Tue, Aug 23, 2022 at 10:34:32AM -0700, H.J. Lu via Binutils wrote: > > On x86, the PLT entry in executable may be used as function address for > > functions in shared libraries. If functions are protected, the function > > address used in executable can be different from the function address > > used in shared library. This will lead to incorrect run-time behavior > > if function pointer equality is needed. By default, x86 linker issues > > an error in this case. > > > > On Solaris, linker issued an error for > > > > struct tm *tb = (kind == CPP_time_kind::FIXED ? gmtime : localtime) (&tt); > > > > where gmtime is a protected function in libc.so. Use gmtime's PLT entry > > in executable as function address is safe since function pointer equality > > isn't needed. > > I'm curious as to how pointer_equality_needed came to be set for > gmtime. Hmm, I figure it was -fno-PIC code with a R_X86_64_32 or R_X86_64_64 referencing gmtime. And yes, -fno-PIC -mcmodel=medium will generate R_X86_64_32 in a testcase like extern int f1 (int); extern int f2 (int); int foo (int what, int val) { return (what ? f1 : f2) (val); } So why exclude R_X86_64_32 with an ABI_64_P test before setting func_pointer_ref in elf_x86_64_scan_relocs? -- Alan Modra Australia Development Lab, IBM