Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp544090lqt; Thu, 6 Jun 2024 10:40:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWurkyn8YqDP5myEFiUG+gXLZZSOGKnvQF8msRNJjEB3NY+GFhPwYPsXvAVNNztwDaKpuwIYT/tAJj2lQnVqGD9eiFoFaMxLeSRtZbGaA== X-Google-Smtp-Source: AGHT+IFj+fXoy7j+V5xe/MDD/fM+1XrOECca6pW0F+q1NzzQjcDt3pka42lYZ8gmaRBuJu/Z5lpp X-Received: by 2002:a2e:86da:0:b0:2ea:8408:c1a7 with SMTP id 38308e7fff4ca-2eadce25967mr2509521fa.21.1717695655501; Thu, 06 Jun 2024 10:40:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717695655; cv=pass; d=google.com; s=arc-20160816; b=bt+kx8/SfkNZGDZ5zMndus3T3JnZGHcFXBaYWox+CqLcHvZGad6JIQdfPaVMnfhTqO iCScJc4gmqm3KmgEXPmACqf9agBw113KIisN/5SJPWy2sWN9ttC66kkGaVeURBAY60Wn pYoT7uNBPiTvoBBUi3InLsPqsyclXhmQGfzm5nT8W1glSg3YXRqNY3g6LCAT0AMRhM12 udN9e2iwtNMmlSigc7rq7/6qKEkR9YILL4yn/JRfwx8/mUgSKK2yTo1nS6gPfl1/tdxQ ULUnOsFTt+3cmchhfsz679DvXoRNX7DRQXP0S3ola6ZbLpAW1heROqgNkmLIV7a7zmPh I+BA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bxRazK9t2YtBfybGPT3gvYuSEdCQU/8ymzrr//NRRdE=; fh=RnXafB7KaCzs0DhHSFvKgjr7RLKjWL5fYGQ/mgxPg2o=; b=JIAbu3w0eYVbBvgHEuL81HqaE6LD6iuUwqJ0ENKdPYVVPD9lS31UxDV2t0Q9B9+VBp zck0u4Qbefqpfy5HGiA0itIGAlWdsMXdDvDB278fxxkyQFDczYQkELOtl+4gb6/GJeSz rHVDcOwKyK+TNNSHHyJyv1yUuhN4RdA+q/39IGHKlVRGOJjkDYwOiODrAalEjwu5YEiV vlSkzqT4U3bKm2bplIUJS2AqIg1Mqn23f93LOf7wTtYAu0m0cOk1//mkkcdr8ENufmjI EmV1qDjrEvw8PGlx8DihhVNYaZ/6CiCU8gBfl8fVuXfHm+5lvlB6e46MottpgmmwEFFr VNLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q9w96H6a; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204825-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae227858si866807a12.348.2024.06.06.10.40.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 10:40:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204825-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q9w96H6a; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204825-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 320D81F285ED for ; Thu, 6 Jun 2024 17:40:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C9A01991C6; Thu, 6 Jun 2024 17:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q9w96H6a" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1E5738DC7; Thu, 6 Jun 2024 17:40:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717695646; cv=none; b=CxTBL615D+/H3Z8PLg25TkQaVC0kXdb2T/c+6yHvMRQWWyv+zqtzBFrZN/V8fHqhq+TDf4cLvWGAVBQu6FtMFNcUyJ7EeW7PKWFf2/f0TZak693kFIVntuZ3Ip8wvclpz+5gl7SJvD2wohIWAZIwwYNg59hf8dleazfaBObzimU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717695646; c=relaxed/simple; bh=ennOQnPWn4O/h2UKcahZrRnfi5DrhPQG7mP3BEFvYoE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Zw2lde7UwE1d/oFfXTVtj/tRhTmlaucP8z7sI1Gx6BxVsNltHI+k1MpGxmhYuguZXcnMuPihq/yFcIvS9WQ36oE+OQcA5XX1uQFWjWrKrVUVHyAuH+JviVGKkVE5f1DqnnU9DbrTCHe4jKM5+DCuUDYwFrbs4A3VJqvgjKDIFqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q9w96H6a; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5DACC2BD10; Thu, 6 Jun 2024 17:40:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717695646; bh=ennOQnPWn4O/h2UKcahZrRnfi5DrhPQG7mP3BEFvYoE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q9w96H6amaJtFPZRtoMvWtv9V2P+7T+xz8vSeDYhcThG6iBvfKSnYKbx1FapfXbbx L7WXP1V9Xqn4G/kRoEymgc644/3yDxp66jVKWu0tbC2a5z88iNGC2DQvaCVK+2H9w6 8bNJvC+xAZdTXLkGrH2g15zeNulWC9+Gvz3HasziskEOq/s7/jSkutyrFt9NsRRkMp mdSxp9y9rWXQ72ni1Yv33PzHPqxz5o7dzIQpZfcvFqQqhpPM6IlimwG0Ntj2gUdwsF 2fq8xNhHpbgbUI9smSIonl3vjyUq8s7DnJNVOeTpq2XWwBIj61SU7ch9vXBOybYkST sISiIsvxon+xg== Date: Thu, 6 Jun 2024 10:40:44 -0700 From: Namhyung Kim To: Leo Yan Cc: Arnaldo Carvalho de Melo , Mark Rutland , James Clark , Ian Rogers , "Liang, Kan" , Nick Terrell , Thomas Richter , Changbin Du , Fangrui Song , Mateusz Kowalczyk , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH v1 4/6] perf: build: Only link libebl.a for old libdw Message-ID: References: <20240604093223.1934236-1-leo.yan@arm.com> <20240604093223.1934236-5-leo.yan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240604093223.1934236-5-leo.yan@arm.com> On Tue, Jun 04, 2024 at 10:32:21AM +0100, Leo Yan wrote: > Since libdw version 0.177, elfutils has merged libebl.a into libdw (see > the commit "libebl: Don't install libebl.a, libebl.h and remove backends > from spec." in the elfutils repository). > > As a result, libebl.a does not exist on Debian Bullseye and newer > releases, causing static perf builds to fail on these distributions. > > This commit checks the libdw version and only links libebl.a if it > detects that the libdw version is older than 0.177. > > Signed-off-by: Leo Yan > --- > tools/build/feature/Makefile | 12 +++++++++++- > tools/perf/Makefile.config | 12 +++++++++++- > 2 files changed, 22 insertions(+), 2 deletions(-) > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile > index 6f52f892f9a3..2f4cfb7b8c14 100644 > --- a/tools/build/feature/Makefile > +++ b/tools/build/feature/Makefile > @@ -159,7 +159,17 @@ $(OUTPUT)test-libopencsd.bin: > > DWARFLIBS := -ldw > ifeq ($(findstring -static,${LDFLAGS}),-static) > -DWARFLIBS += -lelf -lebl -lz -llzma -lbz2 > + DWARFLIBS += -lelf -lz -llzma -lbz2 > + > + LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw) > + LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION))) > + LIBDW_VERSION_2 := $(word 2, $(subst ., ,$(LIBDW_VERSION))) > + > + # Elfutils merged libebl.a into libdw.a starting from version 0.177, > + # Link libebl.a only if libdw is older than this version. > + ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0) > + DWARFLIBS += -lebl > + endif > endif Is there a better way to collect required libraries using pkg-config? I guess that's what we want to with the pkg-config in the first place. Maybe `pkg-config --print-requires-private libdw` ? Thanks, Namhyung > > $(OUTPUT)test-dwarf.bin: > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config > index 646e5af0ed51..e8d3713b081c 100644 > --- a/tools/perf/Makefile.config > +++ b/tools/perf/Makefile.config > @@ -152,7 +152,17 @@ ifdef LIBDW_DIR > endif > DWARFLIBS := -ldw > ifeq ($(findstring -static,${LDFLAGS}),-static) > - DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2 > + DWARFLIBS += -lelf -ldl -lz -llzma -lbz2 > + > + LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw) > + LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION))) > + LIBDW_VERSION_2 := $(word 2, $(subst ., ,$(LIBDW_VERSION))) > + > + # Elfutils merged libebl.a into libdw.a starting from version 0.177, > + # Link libebl.a only if libdw is older than this version. > + ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0) > + DWARFLIBS += -lebl > + endif > endif > FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) > FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS) > -- > 2.34.1 >