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=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 3EF67C28CBC for ; Wed, 6 May 2020 13:30:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1999F20575 for ; Wed, 6 May 2020 13:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588771826; bh=ECVm4QKNjJDair6GtGbyySnHMbFsF42dgIyjkrkYqRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=knQ1g/ECfATaeUN/MPA2Cxc38u8cdQ+eAPl8Wn8Ykf7I4VgAVlp/JOfA+bB/hKYXW CzLXWZkK1BLkY4/fXb4ms8PLB8+eh7rEo9bRP0hsolgqFNiV+8bAV7TXq+iagS/wf7 uQq+CcDkGXJ6ryz3IrnwpLkcNtd017ffVPgbHbtA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728688AbgEFNaZ convert rfc822-to-8bit (ORCPT ); Wed, 6 May 2020 09:30:25 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:52711 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728669AbgEFNaY (ORCPT ); Wed, 6 May 2020 09:30:24 -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-120-kR9gOgttP-K3_9o0J4CVfg-1; Wed, 06 May 2020 09:30:19 -0400 X-MC-Unique: kR9gOgttP-K3_9o0J4CVfg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D139046B; Wed, 6 May 2020 13:30:17 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CC58605F7; Wed, 6 May 2020 13:30:14 +0000 (UTC) From: Jiri Olsa To: Alexei Starovoitov , Daniel Borkmann Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, Yonghong Song , Martin KaFai Lau , David Miller , John Fastabend , Jesper Dangaard Brouer , Wenbo Zhang , KP Singh , Andrii Nakryiko , bgregg@netflix.com, Florent Revest , Al Viro Subject: [PATCH 6/9] bpf: Compile bpfwl tool at kernel compilation start Date: Wed, 6 May 2020 15:29:43 +0200 Message-Id: <20200506132946.2164578-7-jolsa@kernel.org> In-Reply-To: <20200506132946.2164578-1-jolsa@kernel.org> References: <20200506132946.2164578-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org The bpfwl tool will be used during the vmlinux linking, so it's necessary it's ready. Signed-off-by: Jiri Olsa --- Makefile | 21 +++++++++++++++++---- tools/Makefile | 3 +++ tools/bpf/Makefile | 5 ++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 49b2709ff44e..b0537af523dc 100644 --- a/Makefile +++ b/Makefile @@ -1017,9 +1017,10 @@ export mod_sign_cmd HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf) +has_libelf = $(call try-run,\ + echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0) + ifdef CONFIG_STACK_VALIDATION - has_libelf := $(call try-run,\ - echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0) ifeq ($(has_libelf),1) objtool_target := tools/objtool FORCE else @@ -1028,6 +1029,14 @@ ifdef CONFIG_STACK_VALIDATION endif endif +ifdef CONFIG_DEBUG_INFO_BTF + ifeq ($(has_libelf),1) + bpfwl_target := tools/bpf/bpfwl FORCE + else + SKIP_BTF_WHITELIST_GENERATION := 1 + endif +endif + PHONY += prepare0 export MODORDER := $(extmod-prefix)modules.order @@ -1141,7 +1150,7 @@ prepare0: archprepare $(Q)$(MAKE) $(build)=. # All the preparing.. -prepare: prepare0 prepare-objtool +prepare: prepare0 prepare-objtool prepare-bpfwl # Support for using generic headers in asm-generic asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj @@ -1154,7 +1163,7 @@ uapi-asm-generic: $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \ generic=include/uapi/asm-generic -PHONY += prepare-objtool +PHONY += prepare-objtool prepare-bpfwl prepare-objtool: $(objtool_target) ifeq ($(SKIP_STACK_VALIDATION),1) ifdef CONFIG_UNWINDER_ORC @@ -1165,6 +1174,10 @@ else endif endif +prepare-bpfwl: $(bpfwl_target) +ifeq ($(SKIP_BTF_WHITELIST_GENERATION),1) + @echo "warning: Cannot use BTF whitelist checks, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2 +endif # Generate some files # --------------------------------------------------------------------------- diff --git a/tools/Makefile b/tools/Makefile index bd778812e915..85af6ebbce91 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -67,6 +67,9 @@ cpupower: FORCE cgroup firewire hv guest bootconfig spi usb virtio vm bpf iio gpio objtool leds wmi pci firmware debugging: FORCE $(call descend,$@) +bpf/%: FORCE + $(call descend,$@) + liblockdep: FORCE $(call descend,lib/lockdep) diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile index f897eeeb0b4f..d4ea2b5a2e58 100644 --- a/tools/bpf/Makefile +++ b/tools/bpf/Makefile @@ -124,5 +124,8 @@ runqslower_install: runqslower_clean: $(call descend,runqslower,clean) +bpfwl: + $(call descend,bpfwl) + .PHONY: all install clean bpftool bpftool_install bpftool_clean \ - runqslower runqslower_install runqslower_clean + runqslower runqslower_install runqslower_clean bpfwl -- 2.25.4