Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1217320imm; Wed, 25 Jul 2018 13:47:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdA0rTFVpdGMdX001UUNWR3yiYY5sP+VmjDb/Tz6KBn6R6vxBdaBCFvC6XeRKYjONdOCyXs X-Received: by 2002:a63:b504:: with SMTP id y4-v6mr22336743pge.247.1532551635436; Wed, 25 Jul 2018 13:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532551635; cv=none; d=google.com; s=arc-20160816; b=fSjYm5tw7L9bsJdmYkzSvjePhQh45pcHLVszKHvrG7wKHMSHaU3yDpkOvuHDIzM3OE FoeyY7+3PqqtjTAuxKOh3M1KGlCbW6RA3w4yi12CK88BUZzh01w9TGRzpe5dm1YJZGqR B2iMVqSkPCdtUVQZ+fTVqs1ixBwWj3XHa+m0h75/hXLYxcv40jxsIeciOpyC/wn2yepT UBY/YqgZPlwUk0zEmSxKlX9p7ez/6xJYkmTib7pYJ/DJbqF9MmogeCHfa8F2MqQH9tON EMbvsQJzgCDbFsinO5S9jMohWTw7v2wYaPtnm2a07dGwcikA7X0iVE4ezYaXRfw5tkvr hkOA== 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:from:date:dkim-signature:arc-authentication-results; bh=jkoO+Wn4bz9nDHhKw3QPQlLOUpKqqyrRso/v/jQibIY=; b=TFzsFEHgCv/33REoXSXXk+I59cmyTEwhb4ax3JjIX3kPqf7wkr2eX/HHOfb6aGNpQ4 LG4PWA8NjM18o9o06c91v7L4/CmTwXClQRO2revKNFXilTd6jqRGzJVJ4c2DdrwhHgrw UtVeEJkqSCfJa23CY7dClQY8BJ+W+3F3JBvrDm71GVq6pupspM0lCK5ct6moGUUjBQeP TgMOZzOnap9MwpE9bUjkHWWuIm/OWnioy1e81GUE2pEXNcep6TIgUtuQhfJCdD75/6nR QoWcZI+Eoj0y0KTDsYWfBOi1nwNF19o/rftVUp9oQsxshSw8abxtR7JpO5U2CSNjCPm2 6tsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=pKyhAlD2; 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=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m24-v6si15198694pfk.56.2018.07.25.13.47.00; Wed, 25 Jul 2018 13:47:15 -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=@fb.com header.s=facebook header.b=pKyhAlD2; 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=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731474AbeGYV70 (ORCPT + 99 others); Wed, 25 Jul 2018 17:59:26 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:36622 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730535AbeGYV70 (ORCPT ); Wed, 25 Jul 2018 17:59:26 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6PKW9Vw009175; Wed, 25 Jul 2018 13:45:41 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=jkoO+Wn4bz9nDHhKw3QPQlLOUpKqqyrRso/v/jQibIY=; b=pKyhAlD2HMbjMj0B9ikFPVRYuL+Whnhx4RvGIi3kMWyIxzzlts0hJvbEy+nURYAaQanW EBdoePTCEL5V6tjyX3w8W57CFf/erFMVndVD+Rt6biJ03QYFU479cfpVRKklfEh03y+b 6hKgq/O/JII6r+NaR4ZxfJT/AVcwv1iEykw= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 2kf057r277-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 25 Jul 2018 13:45:40 -0700 Received: from kafai-mbp.dhcp.thefacebook.com (192.168.52.123) by mail.TheFacebook.com (192.168.16.18) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 25 Jul 2018 13:45:38 -0700 Date: Wed, 25 Jul 2018 13:45:38 -0700 From: Martin KaFai Lau To: Taeung Song CC: Daniel Borkmann , Alexei Starovoitov , , Subject: Re: [PATCH] samples/bpf: Add BTF build flags to Makefile Message-ID: <20180725204538.is5aidet4qwbvlg4@kafai-mbp.dhcp.thefacebook.com> References: <20180725163039.2838-1-treeze.taeung@gmail.com> <20180725203844.ighlqmfw6227rhby@kafai-mbp.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180725203844.ighlqmfw6227rhby@kafai-mbp.dhcp.thefacebook.com> User-Agent: NeoMutt/20180512 X-Originating-IP: [192.168.52.123] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-25_04:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 25, 2018 at 01:38:44PM -0700, Martin KaFai Lau wrote: > On Thu, Jul 26, 2018 at 01:30:39AM +0900, Taeung Song wrote: > > To smoothly test BTF supported binary on samples/bpf, > > let samples/bpf/Makefile probe llc, pahole and > > llvm-objcopy for BPF support and use them > > like tools/testing/selftests/bpf/Makefile > > changed from the commit c0fa1b6c3efc ("bpf: btf: > > Add BTF tests") > > > > Cc: Martin KaFai Lau > > Signed-off-by: Taeung Song > Thanks for the patch. LGTM. > > Acked-by: Martin KaFai Lau and it should go to bpf-next (Please use the proper tag in the Subject, thanks!). > > > --- > > samples/bpf/Makefile | 21 ++++++++++++++++++++- > > 1 file changed, 20 insertions(+), 1 deletion(-) > > > > diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile > > index 1303af10e54d..e079266360a3 100644 > > --- a/samples/bpf/Makefile > > +++ b/samples/bpf/Makefile > > @@ -191,6 +191,8 @@ HOSTLOADLIBES_xdpsock += -pthread > > # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang > > LLC ?= llc > > CLANG ?= clang > > +LLVM_OBJCOPY ?= llvm-objcopy > > +BTF_PAHOLE ?= pahole > > > > # Detect that we're cross compiling and use the cross compiler > > ifdef CROSS_COMPILE > > @@ -198,6 +200,20 @@ HOSTCC = $(CROSS_COMPILE)gcc > > CLANG_ARCH_ARGS = -target $(ARCH) > > endif > > > > +BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris) > > +BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF) > > +BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm') > > + > > +ifneq ($(BTF_LLC_PROBE),) > > +ifneq ($(BTF_PAHOLE_PROBE),) > > +ifneq ($(BTF_OBJCOPY_PROBE),) > > + EXTRA_CFLAGS += -g > > + LLC_FLAGS += -mattr=dwarfris > > + DWARF2BTF = y > > +endif > > +endif > > +endif > > + > > # Trick to allow make to be run from this directory > > all: > > $(MAKE) -C ../../ $(CURDIR)/ BPF_SAMPLES_PATH=$(CURDIR) > > @@ -256,4 +272,7 @@ $(obj)/%.o: $(src)/%.c > > -Wno-gnu-variable-sized-type-not-at-end \ > > -Wno-address-of-packed-member -Wno-tautological-compare \ > > -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \ > > - -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ > > + -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf $(LLC_FLAGS) -filetype=obj -o $@ > > +ifeq ($(DWARF2BTF),y) > > + $(BTF_PAHOLE) -J $@ > > +endif > > -- > > 2.17.1 > >