Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1314929pxj; Sat, 8 May 2021 13:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbPF7njw8bFa6fJXlk1WpQtEHTdE4xyi0tskUBbk11Z8mJHFucfOsT7EkS3sNoVt0E1FEP X-Received: by 2002:a92:d7c4:: with SMTP id g4mr13917774ilq.224.1620507078038; Sat, 08 May 2021 13:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620507078; cv=none; d=google.com; s=arc-20160816; b=l7B7oTLy2oFwapMYZ3H0ih8h/wYCKLWn1tI9hfovDBJzsjx7jFvgwnJegKfpOB2L/i AdPyyFcsby1yMJzXpjrU+2xRzdQOwbWEM/YdRyxDXFHdHZCZ2Y/Gy5k90P0oOKvqsGS2 T8iOvE0qTRzfFa+J/23lu9n3dZUWn8+hTt2BRVGDyIQNTMkzbWEiOUSh7Q/VepnvmB8a +oWgwxR2P/q3Iev2xgkaStUbrDzmu3FEo5cMg2/Zbk67v37DWy8Wsk2M08oNM0QafZqK 1Dn71IWFIRsFRHwICEO67WDZ7yiK3nrpQlJ3vAvL5T17FNULaVMOGRiAVRP4m0BWWrEx GuXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=OdaBpZ0rnH+UGKN0js89cwSr/V7Wa63JQxt7D3AHXQQ=; b=utzro2xw+eJO/tJE6YPH7cwSuREkd0YFUgMdql7CCmGRG9HdKTU7+PDxRQGC/jlfMf W/BKuMv3+7UnNnE8bWNdnoVkPYYwcaq3UdcDvajIEm0AaX0G64lFSVsVr0HuNqV2t8J9 xpG7+z35fs6Fg38SckalykCKs72/EwW7MnrADgJaSJgH1Bce3LTzno8Fyv0x13+pAjlv KFsOl1d4NgarzfMN2hFhkCzbZXgiNG1FLcTP/hVnNdVNSNB6D5Df+zCDThIbfDlioesK jyf3DkZzs6gqXWkZXQVgayshdx0HmsGrz7h2Nk2+tDgJy32Qr4DaL1gj0A06KSbx9369 7ufQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si10852210iow.6.2021.05.08.13.51.03; Sat, 08 May 2021 13:51:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbhEHUvf convert rfc822-to-8bit (ORCPT + 99 others); Sat, 8 May 2021 16:51:35 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:55956 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbhEHUvf (ORCPT ); Sat, 8 May 2021 16:51:35 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-lEE9aI5YNN-KhvcsOFOykA-1; Sat, 08 May 2021 16:50:25 -0400 X-MC-Unique: lEE9aI5YNN-KhvcsOFOykA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CC937107ACC7; Sat, 8 May 2021 20:50:23 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 480BA1037F20; Sat, 8 May 2021 20:50:21 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Ian Rogers , "Justin M . Forbes" , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan Subject: [PATCH] perf tools: Fix dynamic libbpf link Date: Sat, 8 May 2021 22:50:20 +0200 Message-Id: <20210508205020.617984-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Justin reported broken build with LIBBPF_DYNAMIC=1. When linking libbpf dynamically we need to use perf's hashmap object, because it's not exported in libbpf.so (only in libbpf.a). Following build is now passing: $ make LIBBPF_DYNAMIC=1 BUILD: Doing 'make -j8' parallel build ... $ ldd perf | grep libbpf libbpf.so.0 => /lib64/libbpf.so.0 (0x00007fa7630db000) Fixes: eee19501926d ("perf tools: Grab a copy of libbpf's hashmap") Cc: Ian Rogers Reported-by: Justin M. Forbes Signed-off-by: Jiri Olsa --- tools/perf/Makefile.config | 1 + tools/perf/util/Build | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 7b195e16040e..dacd16874d3d 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -546,6 +546,7 @@ ifndef NO_LIBELF ifdef LIBBPF_DYNAMIC ifeq ($(feature-libbpf), 1) EXTLIBS += -lbpf + $(call detected,CONFIG_LIBBPF_DYNAMIC) else dummy := $(error Error: No libbpf devel library found, please install libbpf-devel); endif diff --git a/tools/perf/util/Build b/tools/perf/util/Build index e27a551acd3a..95e15d1035ab 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -145,7 +145,14 @@ perf-$(CONFIG_LIBELF) += symbol-elf.o perf-$(CONFIG_LIBELF) += probe-file.o perf-$(CONFIG_LIBELF) += probe-event.o +ifdef CONFIG_LIBBPF_DYNAMIC + hashmap := 1 +endif ifndef CONFIG_LIBBPF + hashmap := 1 +endif + +ifdef hashmap perf-y += hashmap.o endif -- 2.31.1