From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40BFCC43441 for ; Mon, 26 Nov 2018 16:30:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3A7020663 for ; Mon, 26 Nov 2018 16:30:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="lk2cCn1k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3A7020663 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbeK0DZ3 (ORCPT ); Mon, 26 Nov 2018 22:25:29 -0500 Received: from mail.efficios.com ([167.114.142.138]:59298 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbeK0DZ3 (ORCPT ); Mon, 26 Nov 2018 22:25:29 -0500 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 2E1849BFA5; Mon, 26 Nov 2018 11:30:52 -0500 (EST) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id Oex9yWyNh_5F; Mon, 26 Nov 2018 11:30:51 -0500 (EST) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 8721E9BF8F; Mon, 26 Nov 2018 11:30:51 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 8721E9BF8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1543249851; bh=ovo+zDFqLfyap0iw506QV+RX5ucBbbeQ2CcRjUqfiIs=; h=Date:From:To:Message-ID:MIME-Version; b=lk2cCn1knCaTkTMzN6i29Sd9DIuxUihERHYjf4OOuTJsHLf/i2hn6NPaP1+xaFOAl 4ZT7CrZTR5XCUWy7+OA5M+z76IglSfV1xcYxRNuB+UFL9ACkoLpEW9c8l4NOlEKgaR qW7saAlaZJ+memw4BqAJQZo8bjO1ljxVvQ821XUpnXTGEyUecQwkn96CqeHOIh+ZjO bmyNvLtG5ndqRfNQyUAms5zSh5Cx+VUz0JgLOSLw6eCWHGGP6+5nGbL+4sFC2m1Sqq zfxFIz//de/VfYshoOO0YqCHOprYCiBSBfernnEwYJ27aTZ/4ZbFpr348HcbnZ8Nd9 0BlywXkF3yxRQ== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id WO3odgPlIenj; Mon, 26 Nov 2018 11:30:51 -0500 (EST) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 697909BF86; Mon, 26 Nov 2018 11:30:51 -0500 (EST) Date: Mon, 26 Nov 2018 11:30:51 -0500 (EST) From: Mathieu Desnoyers To: Florian Weimer Cc: Rich Felker , 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 Message-ID: <1284855405.12857.1543249851299.JavaMail.zimbra@efficios.com> In-Reply-To: <688718071.12798.1543247469553.JavaMail.zimbra@efficios.com> 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> Subject: Re: [RFC PATCH v4 1/5] glibc: Perform rseq(2) registration at nptl init and thread creation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.10_GA_3047 (ZimbraWebClient - FF52 (Linux)/8.8.10_GA_3041) Thread-Topic: glibc: Perform rseq(2) registration at nptl init and thread creation Thread-Index: PUX+I3v3zwDvk8MSf4HO3/oABovOyKt8H8mP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- 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 ? Thanks, Mathieu > > Thanks, > > Mathieu > > -- > Mathieu Desnoyers > EfficiOS Inc. > http://www.efficios.com -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com