Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp55684imu; Mon, 26 Nov 2018 07:54:31 -0800 (PST) X-Google-Smtp-Source: AJdET5eop2b54jUVbcm3uO522YOkpP96e4z6R+YhfrZXXcXCmyNQ8rC3fFvG1uN3+hoKxoUvkESZ X-Received: by 2002:a63:4566:: with SMTP id u38mr25411590pgk.4.1543247671848; Mon, 26 Nov 2018 07:54:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543247671; cv=none; d=google.com; s=arc-20160816; b=AnJU0/wTLZLs+ZgU65AMuW4M7L1206UCn1Z0fEPleNPMLjOh6xfJcPtMhGAiHD28Ad ymOgtZlU2+ZDspWn5F/uSglsdCbHwoij8/O2sxXMZe5rX17hxL/p2J63U+B1Sx15SuoG qc1erDzQfZaTCPqqXSOEOY7Un2Ze+g+NecbO8b+A3UHngqucIzOCFYM/CzzTschw4Y4z P7ZfnKKufzj8LB5dZuuARp6p1zfJHWXi91C4si8ib3chblxy+SPvwtUymA0/FqMFKwCX /ajGdliGBliVLzMxA/aBYbj0YX8ytsBhlyCQ774rek9DFymcYr2icA+2kcAKvnT93MiS LMyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=wOuNBBkexG3iXddtSPKLM3ni0N9RkO67OZVIGh4Jz/w=; b=SeAyJk+AKtC+39ac+OlPMeRD2ft4SY3CWgXf+jmRLODdKqyt2drv2Xf33ZZ8wVicX4 E5ioc5XtZRx3S+UYbA/0MvI/6QVmF9BfxTY8wjZoth/K34DmaskFfNbTaUf80eJt6132 u9/5ZDFrJ9h7surPgzUlCbbo65up7jTzIOhVwv2n70KK74MUCiZUxfKWSq36dZdimUtw gnGKxdoKpWfmAPhlruTWLNrZP0g/PGQiskW8GfH3xFiaMzK60tYfdgDRB0uhQxl0eBg+ DINyL3ZL5y/8jAdyD5tK4xokaJVSjVL3DmyDx8wxRWu/eunxQfP66bgHQlqeZB7uXWJN 2gyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=nFDPLzxD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j5si654544pfg.254.2018.11.26.07.54.05; Mon, 26 Nov 2018 07:54:31 -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; dkim=pass header.i=@efficios.com header.s=default header.b=nFDPLzxD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727131AbeK0Cpl (ORCPT + 99 others); Mon, 26 Nov 2018 21:45:41 -0500 Received: from mail.efficios.com ([167.114.142.138]:60236 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbeK0Cpl (ORCPT ); Mon, 26 Nov 2018 21:45:41 -0500 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 374009B70F; Mon, 26 Nov 2018 10:51:10 -0500 (EST) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id udde6FZuYZUr; Mon, 26 Nov 2018 10:51:09 -0500 (EST) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id BD4979B706; Mon, 26 Nov 2018 10:51:09 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com BD4979B706 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1543247469; bh=wOuNBBkexG3iXddtSPKLM3ni0N9RkO67OZVIGh4Jz/w=; h=Date:From:To:Message-ID:MIME-Version; b=nFDPLzxDX2pRPVLYEgnKqRri51HxaVTsE4s0rXLWMWXXs8WGd2k2zT5AJy5kTV9pi hRq7TJEklBibM+QmedW4O8Av6ixFbE6zPBNyQGl5iY49MtNBuWgbYOzyxsdeMczjwR afMBxvjJXHcNL9jDweowLuuzzKFYBGgeDBLIF7XB8WkZ7bYcXk0hgjYhs95MWfm8ZU 09F74IpriZTHBEq02RyOKzQr1+AKdGYX8ezp6tZim6P3iEjo+SV3hpmXgPfcCFoSm+ DfwUcXzv2xa7NjW1D3hpdk0XVNE2O+uYPMSxaA1eVYxQZN+CXCDkKUWQmXIuoIRRn0 B2uKO1w+QXxXQ== 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 18mJS-2HiVH5; Mon, 26 Nov 2018 10:51:09 -0500 (EST) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 9F2C89B6FF; Mon, 26 Nov 2018 10:51:09 -0500 (EST) Date: Mon, 26 Nov 2018 10:51:09 -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: <688718071.12798.1543247469553.JavaMail.zimbra@efficios.com> In-Reply-To: <87bm6cqm31.fsf@oldenburg.str.redhat.com> References: <20181121183936.8176-1-mathieu.desnoyers@efficios.com> <20181123142843.GJ23599@brightrain.aerifal.cx> <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> 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/oABovOyA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- 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 ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com