Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1475624lqj; Tue, 4 Jun 2024 02:43:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJVYLHgNZc6X/bQQkBOac7HNyuVvmFpQv2llBMDZFPdIKsl9Jc0xMblBeVAMvN/uuDpNQlQU7R3MhQol7YYtq7z3LIiqsDM4W/j8J6PQ== X-Google-Smtp-Source: AGHT+IG/qv7/aHKPunBTMAhC6HBuBBq9vBqURZcLhDPMcGqy77quNYqccvFI7bJYTf+ieR5l+bBp X-Received: by 2002:a17:907:868d:b0:a69:a9a:ba76 with SMTP id a640c23a62f3a-a690a9abb7amr469515566b.43.1717494215277; Tue, 04 Jun 2024 02:43:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717494215; cv=pass; d=google.com; s=arc-20160816; b=Z1YuBahJk9cBuVo/u1GwowWGYJf852QkLOx9DtHxudPULdyqyaD4mIwyPZMYvqx5Sm f+WVlGSaURIHtLpqZkTbJpb5x+jYjonKZJj8V/AI9RXlW+XyVX30dCpaaKi+wAOOL36p yMNdCLUcdOemVqvkgHnNBNNGeQk1VpuUl6sXWdfZlipnhAgBwKAOzZ0KMRjZjC5Jv+hP SJ3c4b4XyH6ZhCwFEu4+dLMgajP1c/7GvfAXTtXKFfXhKIuFFS2E8SEh3eACMZ3dBxrq gw4sCo9YicBKrY5nU9wcEUUzocrnSiIcCtMTk3FdW5+GFZ4s8CHLzByiBJhIRzJelXb3 MiFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=GtucQ0u3a08rGyPdkEe0DR2YpRB3UwSe+2bpWYJOiEQ=; fh=KSiWrCR7xjqa6nMnB8EyauKJbY8zFKZ3kSm6JhLxeok=; b=Ukw+dbFNeHXXhvdphj6OJBjGgQJJAZZYbwEAUaDOOa04gdIaZhMEn0+N6shM6Y7dt7 5iFQxRO8KPAJEmQS8Bac3Fq/5kN0sLkNJUib2Foci3x4KFWVqsV0GDGnqw76u9an+j6u xXnVl6H1QOZ+41KP1ebjKhmPmN1h8K1CwucVZSMOqSIxzBDabELrkOXxHx6+d7KcciVc clAUqTqMGmSHZa17mJcp9KqpPAe6UhJmBbOs/Zr+JdmL9g2u3vmMLuVzCrRlPMSnAprT OkegRLiHmbQ07/NVFX8GhypRvk8SgbFufoi9wjclbMYfzdvEnJdNZOtzRMo9xkR0mDx+ MRcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-200359-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200359-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a68c8dc3c22si317439466b.383.2024.06.04.02.43.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:43:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200359-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; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-200359-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200359-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 E16671F24ACB for ; Tue, 4 Jun 2024 09:34:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DC9F145348; Tue, 4 Jun 2024 09:32:49 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5DB6145327; Tue, 4 Jun 2024 09:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493569; cv=none; b=uLHv9gZIQQc8IMxoQ4acGbT9wZ0lSY2K8pl+oDFHAl87Xf+Y0AH3eQvnVx7tZE0UO2O2Coe/aNMnJzEmfDdp8HMXWGEDSyuDmqnRpWfgOC0cAOJYpLqfykVTngBC19C5VBdZQc4I8ITYEcxtE85Ggyvo8SL4EGIF0vuz+zNP8iE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493569; c=relaxed/simple; bh=f5zCnqc+nOgXNE3aBYf6+yyhziHuGJt+sO5UjVnaqZU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=q5HgJFumh+uhHEAK5iVkapQE5a+tEOI8sKGT8+/U/Y+HiBT22NgoQXDQBeOHGL238ydcbI8IZowHh3o1SAXH2D/sgeUZ70CpFxKSEMh8KWOCQf4mZ/TbisH3P5VWdFiz+mrzAIjFKA4SUIqKifUNiNIfOIThowzxtRMqYOL2lRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 762751516; Tue, 4 Jun 2024 02:33:11 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 697483F762; Tue, 4 Jun 2024 02:32:45 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , 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 Cc: Leo Yan Subject: [PATCH v1 4/6] perf: build: Only link libebl.a for old libdw Date: Tue, 4 Jun 2024 10:32:21 +0100 Message-Id: <20240604093223.1934236-5-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604093223.1934236-1-leo.yan@arm.com> References: <20240604093223.1934236-1-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-Transfer-Encoding: 8bit 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 $(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