Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7623119yba; Thu, 2 May 2019 13:10:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVK5MfDVaca0gf8wCL3JbeYuzxmb0uKe5w3VArrFDajLyzTpmuvqtJLZobY3FSpKxRbKxr X-Received: by 2002:a17:902:141:: with SMTP id 59mr5784671plb.132.1556827834333; Thu, 02 May 2019 13:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556827834; cv=none; d=google.com; s=arc-20160816; b=nolEi4/VzYq1bFuoek1B2bg7lAcbe1U+0WxGV1MzX3XS1c1DxaOdZke/GEigb62dvG 1gbzU3aOujW98AHG8xtWbVh4Pt3i8CFIOa6h1qQvEdfX0Y1n8CizaNDrze9Q61PM3s8N Rf9wALdlaq2b5SEoMXZNA8Rr6ww0O1hQ0SFvW3M+iFFmQFYl4fG7qtK8SGVPxESbVvLV gi8WnIwGwd9YyqgLqgMDxHi+Pjzbdjj9mC7J8rliJPYZ4W3rWMBWrG+8vsQESMPDS4Dc QpV/LDXxkyyeF7b655iHWWGEQouBOGtb/Yqs1XoiILkL9tqJB9k0+f6mNJo9U5q/nZvb ObBg== 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:date:from:dkim-signature; bh=nVxPvb4gHab89NR3TJEjvHX4WUon0plr7WUy6OMsIgU=; b=MLJQgyglObU0T7dTrScGdwieFNK0vhEb8xWeHOUCl0VzGW0pYx2vVlUNV5HN68ooVG L08bb6KmYjHQJ+s5FgT55NmoW7XPJQfTeqGvNBOhV5S+6px8aferwR11empnvJFxnanN C8BbGf71BO4MnUhL3YicejtCVrIxPy4oQcvYnRJMtzjN32WQDEtCi8MWLxRGlFHqcTjt nRaZVSqcgHTN66q3wBbqN0PF7yw4x5lkXcARkkO9hQLISsvWFVe7z53P82zGwuXHOZUv 9+4aDy3rEd/YriMH/b2j83Z8cqlCzOmUqe1pM3GmvWqLsqtrhoArc6LbuJoWodE1jqQR 02gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AuaXaSOR; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62si61090ple.364.2019.05.02.13.10.16; Thu, 02 May 2019 13:10:34 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=AuaXaSOR; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726175AbfEBUJR (ORCPT + 99 others); Thu, 2 May 2019 16:09:17 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:40419 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725962AbfEBUJR (ORCPT ); Thu, 2 May 2019 16:09:17 -0400 Received: by mail-yw1-f66.google.com with SMTP id t79so2552119ywc.7; Thu, 02 May 2019 13:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nVxPvb4gHab89NR3TJEjvHX4WUon0plr7WUy6OMsIgU=; b=AuaXaSORJIR/VQ8YbNOB7UUEN16Uh5aj424ONK7VJlOj9mIK8+USuBZc6kw0OyNS9y NlN0V9u/XiXU2gMmqV/tkT5vHSXJG8l/q9xBVJkQbgb0T6V4pQsMdWXNlvFUnM/kLTfD oJN4njWdOvH/qyKXu21Iz5iepD0mjSFiL10W+juSGjg1TR3wM30mIvF0i3K8kjxonqZ1 o9wsvTpsmfAIvGOnUefYObvnYzWI9n5HUDWjo1ekUsyRNtO1pQXcH2cNps320cX8dFW0 6VxqoJwJ6DWEqv7id6c3G86KUM90UZDsoUY+zzpeA74f/TcVPKhcchST7KowfMbvp3HI xTsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nVxPvb4gHab89NR3TJEjvHX4WUon0plr7WUy6OMsIgU=; b=JeyPEr86nsVOvF+AUtHXH/73Az3gtI37wQMTfqbv8njgYXSSTW7pb+f/jhZqE40Zzv 5U+H26lCo4pyiEmqiwZlqq1XBua9NwZdyose21YkKAsi36z1H1eddg3DmcmZBfu7KeCl eI8PD6SSSZi70q6SFksQjU/fqvOKETq5qiob92ACKyZnwsXwgPaz426AkgRNYc8TLK7k aFwGhydYLhzhG2AVvtYBtgAEs7hmFFZk+pS5F6DvD92R5EH2xeFUpxHmYCO+fJBq2hle FkIwHdqYpt1WFiufQ66PsfzOW0Ldkb4B0DC3DkcgKc4Ag8FtB8MpJQhLCDFGwZhGtUpn 8D6w== X-Gm-Message-State: APjAAAVPOkKHdPAkntbPiagJP22DYfneE1mWJTFCEYmsOyNozY4qAnhz uz4Cd5uBxF833qY4pYFYWM4= X-Received: by 2002:a81:3a11:: with SMTP id h17mr4946712ywa.292.1556827756124; Thu, 02 May 2019 13:09:16 -0700 (PDT) Received: from quaco.ghostprotocols.net (adsl-173-228-226-134.prtc.net. [173.228.226.134]) by smtp.gmail.com with ESMTPSA id m5sm45832ywm.67.2019.05.02.13.09.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2019 13:09:14 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 17969403AD; Thu, 2 May 2019 16:09:14 -0400 (EDT) Date: Thu, 2 May 2019 16:09:14 -0400 To: Vineet Gupta Cc: Rich Felker , Jin Yao , 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 Subject: Re: Detecting libc in perf (was Re: perf tools build broken after v5.1-rc1) Message-ID: <20190502200914.GA22982@kernel.org> 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> <596d2166-1952-a392-ef05-d3f59abf9fd0@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <596d2166-1952-a392-ef05-d3f59abf9fd0@synopsys.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, May 02, 2019 at 09:55:26AM -0700, Vineet Gupta escreveu: > 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 ! This is some remnant of the past, I'll check further but will end up just ditching it altogether as you suggest :-) [acme@quaco perf]$ find tools/ -type f | xargs grep HAVE_GLIBC_SUPPORT tools/perf/builtin-version.c: STATUS(HAVE_GLIBC_SUPPORT, glibc); tools/perf/Makefile.config: CFLAGS += -DHAVE_GLIBC_SUPPORT [acme@quaco perf]$ Its just this case that ends up using that feature detection program, [acme@quaco perf]$ vim tools/perf/Makefile.config [acme@quaco perf]$ find tools/ -type f | xargs grep feature-glibc tools/perf/Makefile.config: ifeq ($(feature-glibc), 1) tools/perf/Makefile.config:ifeq ($(feature-glibc), 1) [acme@quaco perf]$ BTW the function on it doesn't mean anything, what matters is if the program builds or not :-) - Arnaldo