Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754603AbbERRf3 (ORCPT ); Mon, 18 May 2015 13:35:29 -0400 Received: from mail-ig0-f178.google.com ([209.85.213.178]:34296 "EHLO mail-ig0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754304AbbERRf1 (ORCPT ); Mon, 18 May 2015 13:35:27 -0400 Message-ID: <555A22DB.5040200@plumgrid.com> Date: Mon, 18 May 2015 10:35:23 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Wang Nan , paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com CC: lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH v3 06/37] bpf tools: Introduce 'bpf' library to tools References: <1431860222-61636-1-git-send-email-wangnan0@huawei.com> <1431860222-61636-7-git-send-email-wangnan0@huawei.com> In-Reply-To: <1431860222-61636-7-git-send-email-wangnan0@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2491 Lines: 73 On 5/17/15 3:56 AM, Wang Nan wrote: > This is the first patch of libbpf. The goal of libbpf is to create a > standard way for accessing eBPF object files. This patch creates > Makefile and Build for it, allows 'make' to build libbpf.a and > libbpf.so, 'make install' to put them into proper directories. > Most part of Makefile is borrowed from traceevent. Before building, > it checks the existance of libelf in Makefile, and deny to build if > not found. Instead of throw an error if libelf not found, the error > raises in a phony target "elfdep". This design is to ensure > 'make clean' still workable even if libelf is not found. > > Signed-off-by: Wang Nan > --- ... > + > +# Version of eBPF elf file > +FILE_VERSION = 1 what that comment suppose to mean? > +# Makefiles suck: This macro sets a default value of $(2) for the > +# variable named by $(1), unless the variable has been set by > +# environment or command line. This is necessary for CC and AR > +# because make sets default values, so the simpler ?= approach > +# won't work as expected. what this for? copy-paste? > +# Allow setting CC and AR, or setting CROSS_COMPILE as a prefix. > +$(call allow-override,CC,$(CROSS_COMPILE)gcc) > +$(call allow-override,AR,$(CROSS_COMPILE)ar) was cross-compile tested or just copy-pasted? > +EXT = -std=gnu99 I guess it was copy-pasted from libtraceevent, but please double check that it's actually needed. > +# Append required CFLAGS > +override CFLAGS += -fPIC > +override CFLAGS += $(INCLUDES) > +override CFLAGS += -D_GNU_SOURCE _GNU_SOURCE actually needed? Please sanitize the file. > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > new file mode 100644 > index 0000000..bebe99a > --- /dev/null > +++ b/tools/lib/bpf/libbpf.c > @@ -0,0 +1,15 @@ > +/* > + * common eBPF ELF loading operations. > + * > + * Copyright (C) 2015, Wang Nan > + * Copyright (C) 2015, Huawei Inc. since it borrows heavily from samples/bpf/bpf_load.c, libbpf.h would be nice if you mention the source and/or copyright in the header. > + * > + * Released under the GPL v2. (and only v2, not any later version) > + */ are you sure about this restriction? libtracevent is LGPL, for example. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/