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, URIBL_BLOCKED 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 EFFFBC43219 for ; Thu, 2 May 2019 16:55:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B85A72081C for ; Thu, 2 May 2019 16:55:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="gQ/dR/TB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726804AbfEBQzx (ORCPT ); Thu, 2 May 2019 12:55:53 -0400 Received: from dc8-smtprelay2.synopsys.com ([198.182.47.102]:38028 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726193AbfEBQzx (ORCPT ); Thu, 2 May 2019 12:55:53 -0400 Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 24CF0C0080; Thu, 2 May 2019 16:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1556816154; bh=ZM93GiDFUAFdIFH7iB5thYbvqXc9aub7/q04LLiBddw=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=gQ/dR/TByiAztZKu35AI0gd05lamMzft1fPg/m1s4IQe6pAR2cPLNrOsXizfJOqjO CGX/UEig/5CHiTTeAbyZ4/hQwGWXhacvhrkUjzGU01yJlor1U6ThZ3Rs1BA2WjwMB4 kkxe1YNQkZZuXyLcu0es1Tlk5BZOLr8Xjy9zxO2CIEekuxTCsphNZAZGv+zMntK0Vk qzX34AtPlSNAytwHIX0w/Oj8F24QuBShrLpFY/pVmUWML/3q5/cJ3YwElzp+9qQd6r gBa8GUp2/8bUrQOa4fTPO2OPhAtlxLrmTKyhc5IP0nZDQ+JMH43O1J/sQhkpGF1wn9 bsZZO/bWC2Wvg== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2.internal.synopsys.com [10.12.239.237]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 36839A005D; Thu, 2 May 2019 16:55:38 +0000 (UTC) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 2 May 2019 09:55:36 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 2 May 2019 22:25:45 +0530 Received: from [10.10.161.89] (10.10.161.89) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 2 May 2019 22:25:44 +0530 Subject: Re: Detecting libc in perf (was Re: perf tools build broken after v5.1-rc1) To: Rich Felker , Jin Yao CC: Arnaldo Carvalho de Melo , "devel@uclibc-ng.org" , "linux-perf-users@vger.kernel.org" , Arnaldo Carvalho de Melo , lkml , arcml , Arnd Bergmann , "Jiri Olsa" , Namhyung Kim Newsgroups: gmane.linux.kernel.perf.user,gmane.linux.kernel.arc References: <20190422152027.GB11750@kernel.org> <20190425214800.GC21829@kernel.org> <20190430011818.GE7857@kernel.org> <20190430170404.GX23599@brightrain.aerifal.cx> <17a86bc7-c1f9-8c3c-8f1d-711e95dac49d@synopsys.com> <20190501031215.GZ23599@brightrain.aerifal.cx> From: Vineet Gupta Openpgp: preference=signencrypt Autocrypt: addr=vgupta@synopsys.com; keydata= mQINBFEffBMBEADIXSn0fEQcM8GPYFZyvBrY8456hGplRnLLFimPi/BBGFA24IR+B/Vh/EFk B5LAyKuPEEbR3WSVB1x7TovwEErPWKmhHFbyugdCKDv7qWVj7pOB+vqycTG3i16eixB69row lDkZ2RQyy1i/wOtHt8Kr69V9aMOIVIlBNjx5vNOjxfOLux3C0SRl1veA8sdkoSACY3McOqJ8 zR8q1mZDRHCfz+aNxgmVIVFN2JY29zBNOeCzNL1b6ndjU73whH/1hd9YMx2Sp149T8MBpkuQ cFYUPYm8Mn0dQ5PHAide+D3iKCHMupX0ux1Y6g7Ym9jhVtxq3OdUI5I5vsED7NgV9c8++baM 7j7ext5v0l8UeulHfj4LglTaJIvwbUrCGgtyS9haKlUHbmey/af1j0sTrGxZs1ky1cTX7yeF nSYs12GRiVZkh/Pf3nRLkjV+kH++ZtR1GZLqwamiYZhAHjo1Vzyl50JT9EuX07/XTyq/Bx6E dcJWr79ZphJ+mR2HrMdvZo3VSpXEgjROpYlD4GKUApFxW6RrZkvMzuR2bqi48FThXKhFXJBd JiTfiO8tpXaHg/yh/V9vNQqdu7KmZIuZ0EdeZHoXe+8lxoNyQPcPSj7LcmE6gONJR8ZqAzyk F5voeRIy005ZmJJ3VOH3Gw6Gz49LVy7Kz72yo1IPHZJNpSV5xwARAQABtCpWaW5lZXQgR3Vw dGEgKGFsaWFzKSA8dmd1cHRhQHN5bm9wc3lzLmNvbT6JAj4EEwECACgCGwMGCwkIBwMCBhUI AgkKCwQWAgMBAh4BAheABQJbBYpwBQkLx0HcAAoJEGnX8d3iisJeChAQAMR2UVbJyydOv3aV jmqP47gVFq4Qml1weP5z6czl1I8n37bIhdW0/lV2Zll+yU1YGpMgdDTHiDqnGWi4pJeu4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+4sZcm8o ItShAoKGIE/UCkj/jPlWqOcM/QIqJ2bR8hjBny83ONRf2O9nJuEYw9vZAPFViPwWG8tZ7J+R euXKai4DDr+8oFOi/40mIDe/Bat3ftyd+94Z1RxDCngd3Q85bw13t2ttNLw5eHufLIpoEyAh TCLNQ58eT91YGVGvFs39IuH0b8ovVvdkKGInCT59Vr0MtfgcsqpDxWQXJXYZYTFHd3/RswAR AQABiQIlBBgBAgAPAhsMBQJbBYpwBQkLx0HdAAoJEGnX8d3iisJewe8P/36pkZrVTfO+U+Gl 1OQh4m6weozuI8Y98/DHLMxEujKAmRzy+zMHYlIl3WgSih1UMOZ7U84yVZQwXQkLItcwXoih ChKD5D2BKnZYEOLM+7f9DuJuWhXpee80aNPzEaubBYQ7dYt8rcmB7SdRz/yZq3lALOrF/zb6 SRleBh0DiBLP/jKUV74UAYV3OYEDHN9blvhWUEFFE0Z+j96M4/kuRdxvbDmp04Nfx79AmJEn fv1Vvc9CFiWVbBrNPKomIN+JV7a7m2lhbfhlLpUk0zGFDTWcWejl4qz/pCYSoIUU4r/VBsCV ZrOun4vd4cSi/yYJRY4kaAJGCL5k7qhflL2tgldUs+wERH8ZCzimWVDBzHTBojz0Ff3w2+gY 6FUbAJBrBZANkymPpdAB/lTsl8D2ZRWyy90f4VVc8LB/QIWY/GiS2towRXQBjHOfkUB1JiEX YH/i93k71mCaKfzKGXTVxObU2I441w7r4vtNlu0sADRHCMUqHmkpkjV1YbnYPvBPFrDBS1V9 OfD9SutXeDjJYe3N+WaLRp3T3x7fYVnkfjQIjDSOdyPWlTzqQv0I3YlUk7KjFrh1rxtrpoYS IQKf5HuMowUNtjyiK2VhA5V2XDqd+ZUT3RqfAPf3Y5HjkhKJRqoIDggUKMUKmXaxCkPGi91T hhqBJlyU6MVUa6vZNv8E Message-ID: <596d2166-1952-a392-ef05-d3f59abf9fd0@synopsys.com> Date: Thu, 2 May 2019 09:55:26 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190501031215.GZ23599@brightrain.aerifal.cx> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.10.161.89] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/30/19 8:12 PM, Rich Felker wrote: >>> What are you trying to achieve? I was just CC'd and I'm missing the >>> context. >> >> Sorry I added you as a subject matter expert but didn't provide enough context. >> >> The original issue [1] was perf failing to build on ARC due to perf tools needing >> a copy of unistd.h but this thread [2] was a small side issue of auto-detecting >> libc variaint in perf tools where despite uClibc tools, glibc is declared to be >> detected, due to uClibc's historical hack of defining __GLIBC__. So __GLIBC__ is >> not sufficient (and probably not the right interface to begin wtih) to ensure glibc. >> >> [1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-April/005676.html >> [2] http://lists.infradead.org/pipermail/linux-snps-arc/2019-April/005684.html > > I think you misunderstood -- :-) > I'm asking what you're trying to achieve > by detecting whether the libc is glibc, rather than whether it has > some particular interface you want to conditionally use. This is a > major smell and is usually something wrong that shouldn't be done. Good question indeed. Back in 2015 I initially ran into some quirks due to subtle libc differences. At the time perf has a fwd ref for strlcpy which exactly matched glibc but not uClibc. see commit a83d869f300bf91 "(perf tools: Elide strlcpy warning with uclibc)" or 0215d59b154 "(tools lib: Reinstate strlcpy() header guard with __UCLIBC__)" But this still used the libc defined symbol __UCLIBC__ or __GLIBC__ Your question however pertains to perf glibc feature check where perf generates an alternate symbol HAVE_GLIBC_SUPPORT. This is dubious as first of all it detects glibc even for uClibc builds. Even of we were to improve it, there seems to be no users of this symbol. $git grep HAVE_GLIBC_SUPPORT perf/Makefile.config: CFLAGS += -DHAVE_GLIBC_SUPPORT perf/builtin-version.c: STATUS(HAVE_GLIBC_SUPPORT, glibc) So I'd propose to remove it ! From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vineet Gupta Subject: Re: Detecting libc in perf (was Re: perf tools build broken after v5.1-rc1) Date: Thu, 2 May 2019 09:55:26 -0700 Message-ID: <596d2166-1952-a392-ef05-d3f59abf9fd0@synopsys.com> References: <20190422152027.GB11750@kernel.org> <20190425214800.GC21829@kernel.org> <20190430011818.GE7857@kernel.org> <20190430170404.GX23599@brightrain.aerifal.cx> <17a86bc7-c1f9-8c3c-8f1d-711e95dac49d@synopsys.com> <20190501031215.GZ23599@brightrain.aerifal.cx> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190501031215.GZ23599@brightrain.aerifal.cx> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+gla-linux-snps-arc=m.gmane.org@lists.infradead.org To: Rich Felker , Jin Yao Cc: "devel@uclibc-ng.org" , Arnaldo Carvalho de Melo , Arnd Bergmann , Arnaldo Carvalho de Melo , lkml , "linux-perf-users@vger.kernel.org" , Jiri Olsa , Namhyung Kim , arcml List-Id: linux-perf-users.vger.kernel.org On 4/30/19 8:12 PM, Rich Felker wrote: >>> What are you trying to achieve? I was just CC'd and I'm missing the >>> context. >> >> Sorry I added you as a subject matter expert but didn't provide enough context. >> >> The original issue [1] was perf failing to build on ARC due to perf tools needing >> a copy of unistd.h but this thread [2] was a small side issue of auto-detecting >> libc variaint in perf tools where despite uClibc tools, glibc is declared to be >> detected, due to uClibc's historical hack of defining __GLIBC__. So __GLIBC__ is >> not sufficient (and probably not the right interface to begin wtih) to ensure glibc. >> >> [1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-April/005676.html >> [2] http://lists.infradead.org/pipermail/linux-snps-arc/2019-April/005684.html > > I think you misunderstood -- :-) > I'm asking what you're trying to achieve > by detecting whether the libc is glibc, rather than whether it has > some particular interface you want to conditionally use. This is a > major smell and is usually something wrong that shouldn't be done. Good question indeed. Back in 2015 I initially ran into some quirks due to subtle libc differences. At the time perf has a fwd ref for strlcpy which exactly matched glibc but not uClibc. see commit a83d869f300bf91 "(perf tools: Elide strlcpy warning with uclibc)" or 0215d59b154 "(tools lib: Reinstate strlcpy() header guard with __UCLIBC__)" But this still used the libc defined symbol __UCLIBC__ or __GLIBC__ Your question however pertains to perf glibc feature check where perf generates an alternate symbol HAVE_GLIBC_SUPPORT. This is dubious as first of all it detects glibc even for uClibc builds. Even of we were to improve it, there seems to be no users of this symbol. $git grep HAVE_GLIBC_SUPPORT perf/Makefile.config: CFLAGS += -DHAVE_GLIBC_SUPPORT perf/builtin-version.c: STATUS(HAVE_GLIBC_SUPPORT, glibc) So I'd propose to remove it ! From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vineet.Gupta1@synopsys.com (Vineet Gupta) Date: Thu, 2 May 2019 09:55:26 -0700 Subject: Detecting libc in perf (was Re: perf tools build broken after v5.1-rc1) In-Reply-To: <20190501031215.GZ23599@brightrain.aerifal.cx> References: <20190422152027.GB11750@kernel.org> <20190425214800.GC21829@kernel.org> <20190430011818.GE7857@kernel.org> <20190430170404.GX23599@brightrain.aerifal.cx> <17a86bc7-c1f9-8c3c-8f1d-711e95dac49d@synopsys.com> <20190501031215.GZ23599@brightrain.aerifal.cx> List-ID: Message-ID: <596d2166-1952-a392-ef05-d3f59abf9fd0@synopsys.com> To: linux-snps-arc@lists.infradead.org On 4/30/19 8:12 PM, Rich Felker wrote: >>> What are you trying to achieve? I was just CC'd and I'm missing the >>> context. >> >> Sorry I added you as a subject matter expert but didn't provide enough context. >> >> The original issue [1] was perf failing to build on ARC due to perf tools needing >> a copy of unistd.h but this thread [2] was a small side issue of auto-detecting >> libc variaint in perf tools where despite uClibc tools, glibc is declared to be >> detected, due to uClibc's historical hack of defining __GLIBC__. So __GLIBC__ is >> not sufficient (and probably not the right interface to begin wtih) to ensure glibc. >> >> [1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-April/005676.html >> [2] http://lists.infradead.org/pipermail/linux-snps-arc/2019-April/005684.html > > I think you misunderstood -- :-) > I'm asking what you're trying to achieve > by detecting whether the libc is glibc, rather than whether it has > some particular interface you want to conditionally use. This is a > major smell and is usually something wrong that shouldn't be done. Good question indeed. Back in 2015 I initially ran into some quirks due to subtle libc differences. At the time perf has a fwd ref for strlcpy which exactly matched glibc but not uClibc. see commit a83d869f300bf91 "(perf tools: Elide strlcpy warning with uclibc)" or 0215d59b154 "(tools lib: Reinstate strlcpy() header guard with __UCLIBC__)" But this still used the libc defined symbol __UCLIBC__ or __GLIBC__ Your question however pertains to perf glibc feature check where perf generates an alternate symbol HAVE_GLIBC_SUPPORT. This is dubious as first of all it detects glibc even for uClibc builds. Even of we were to improve it, there seems to be no users of this symbol. $git grep HAVE_GLIBC_SUPPORT perf/Makefile.config: CFLAGS += -DHAVE_GLIBC_SUPPORT perf/builtin-version.c: STATUS(HAVE_GLIBC_SUPPORT, glibc) So I'd propose to remove it !