Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp162631imu; Mon, 26 Nov 2018 09:14:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/VsVvBPvBEal6sRmkNDy6Zhlz10QN8FOrF3E+zcjjul203uOsWjT+bRbhY3Zf/ZHq56IM5e X-Received: by 2002:a17:902:103:: with SMTP id 3-v6mr27254889plb.87.1543252466053; Mon, 26 Nov 2018 09:14:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543252466; cv=none; d=google.com; s=arc-20160816; b=nzEotrKMkt6PjJGAxvHZUEjhorhAFXO9IU6dn09hKTNeGhIR8K/3DU4ATcQfmnf6Ow B6wh8L25Vc/+uAPTNMupw9P3H9rpTjfD2RJYkvdNf3Z0S9QxqWlhP/J20NCDLwaWGlLT 1n2EsJq/42vRaFS+Y4mvEgkIkaW1m6m4ALH4ImqkC73jInYiJ86nvIeQF1TBBXdDw/PH gCEle5qDNISB83rou5ZiSCzrrWymYxRtHnTOFcBm/rV9DNqaBokhmubLa+OpnAGYCxNk 7f02bv5C/osBbx+Vjn+zR+NRiLhyCcJUY1JTCzpmvsuK6ORr0DK3eCVnIW2hWOR1xUH/ cWOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=sOLV0lU/RQ0CV8ZQ7DreumZ1QHdkxYAzwFKjk/R123I=; b=l/xMvisLDGABoePJmDAA6noa81uw/eOzDH4k3N/EDRTBmhvpnKXTDNejfIqVW+FPsZ LHZTDUgkRJ4D1Jcvq4moguvu5gedYGMClkm8wG0P7tCCPBHUD6QtpyuxyYarI+nnIUb4 v8zMFypJoxsg3gkw6sgDyhBqponVUG6qHRjbyzr7r12WvrxQlnQFFj6bUwTkMzAXRp3c bNTQKrSGan5+pI94hw8WvdacznGwuk9tl8wKy8hlFUjS9+3gi4a8HoNUgAHHHbTLnypQ cNvvk4qvDgUpRjLSZktMTSt61Dh6o1bexnpRWwtchHwRO5sd5dtMS6FRC8FEHVbD8mu0 XOiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si838009plt.44.2018.11.26.09.13.07; Mon, 26 Nov 2018 09:14:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727068AbeK0ED0 (ORCPT + 99 others); Mon, 26 Nov 2018 23:03:26 -0500 Received: from 216-12-86-13.cv.mvl.ntelos.net ([216.12.86.13]:58592 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbeK0ED0 (ORCPT ); Mon, 26 Nov 2018 23:03:26 -0500 Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1gRKMY-0006Gt-00; Mon, 26 Nov 2018 17:07:58 +0000 Date: Mon, 26 Nov 2018 12:07:58 -0500 From: Rich Felker To: Mathieu Desnoyers Cc: Florian Weimer , carlos , Joseph Myers , Szabolcs Nagy , libc-alpha , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Will Deacon , Dave Watson , Paul Turner , linux-kernel , linux-api Subject: Re: [RFC PATCH v4 1/5] glibc: Perform rseq(2) registration at nptl init and thread creation Message-ID: <20181126170758.GP23599@brightrain.aerifal.cx> References: <20181121183936.8176-1-mathieu.desnoyers@efficios.com> <1150466925.11664.1542992720871.JavaMail.zimbra@efficios.com> <20181123173019.GK23599@brightrain.aerifal.cx> <865273158.11687.1542995541389.JavaMail.zimbra@efficios.com> <20181123183558.GM23599@brightrain.aerifal.cx> <1758017676.12041.1543007347347.JavaMail.zimbra@efficios.com> <87bm6cqm31.fsf@oldenburg.str.redhat.com> <688718071.12798.1543247469553.JavaMail.zimbra@efficios.com> <1284855405.12857.1543249851299.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1284855405.12857.1543249851299.JavaMail.zimbra@efficios.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 26, 2018 at 11:30:51AM -0500, Mathieu Desnoyers wrote: > ----- On Nov 26, 2018, at 10:51 AM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote: > > > ----- On Nov 26, 2018, at 3:28 AM, Florian Weimer fweimer@redhat.com wrote: > > > >> * Mathieu Desnoyers: > >> > >>> Using a "weak" symbol in early adopter libraries is important, so they > >>> can be loaded together into the same process without causing loader > >>> errors due to many definitions of the same strong symbol. > >> > >> This is not how ELF dynamic linking works. If the symbol name is the > >> same, one definition interposes the others. > >> > >> You need to ensure that the symbol has the same size everywhere, though. > >> There are some tricky interactions with symbol versions, too. (The > >> interposing libraries must not use symbol versioning.) > > > > I was under the impression that loading the same strong symbol into an > > application multiple times would cause some kind of warning if non-weak. I did > > some testing to figure out which case I remembered would cause this. > > > > When compiling with "-fno-common", dynamic and static linking work fine, but > > trying to add multiple instances of a given symbol into a single object fails > > with: > > > > /tmp/ccSakXZV.o:(.bss+0x0): multiple definition of `a' > > /tmp/ccQBJBOo.o:(.bss+0x0): first defined here > > > > Even if the symbol has the same size. > > > > So considering that we don't care about compiling into a single object here, > > and only care about static and dynamic linking of libraries, indeed the "weak" > > symbol is not useful. > > > > So let's make __rseq_abi and __rseq_refcount strong symbols then ? > > Actually, looking into ld(1) --warn-common, it looks like "weak" would be cleaner > after all, especially for __rseq_abi which we needs to be initialized to a specific > value, which is therefore not a common symbol. > > " --warn-common > Warn when a common symbol is combined with another common symbol or with a symbol definition. Unix > linkers allow this somewhat sloppy practice, but linkers on some other operating systems do not. > This option allows you to find potential problems from combining global symbols. Unfortunately, > some C libraries use this practice, so you may get some warnings about symbols in the libraries as > well as in your programs." > > Thoughts ? AFAIK this has nothing to do with dynamic linking. Rich