Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3783339ybc; Thu, 21 Nov 2019 13:44:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzlKkUGCLr5TqxBmvpIrznvmgqCGYkOfJRkH4E+X8GYEwZtdsgMb3NPL7wSpjs7GZfRzU16 X-Received: by 2002:a7b:cd86:: with SMTP id y6mr12570000wmj.163.1574372645382; Thu, 21 Nov 2019 13:44:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574372645; cv=none; d=google.com; s=arc-20160816; b=LVpF0UQsW/7r2xWpWGM5RNGsLA12ismoXRlssSG7doFi52skXKGaCRTctg/7SfHNqQ r94hU7OikzvMpNrUVtVDMvW9oMj5WWT4WOYsulF/RbT+BdOGAqoy+PgFYNCvTX/hfVRm cGGCYibQwr2Zaxuz90TMNKD5J6T0+jCqKdwsbJ+FJ9vyfuovoE3Wbd0m163H2X1IwY/n hqO+F9v1uQagDewUSEvyZQqRrcTehKjIQpK+kJnmD9V2kNGIrQgvnFvd21ARwQEzgsLv BqkzOjpvU9KN3xW+IdgnRXyDfCv1FCn83h3vOdAKyTEtj2F1oRzKvmpAA/GVbWIS4MRp SQDg== 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; bh=t6UbFd+jsoBUib7qTx+BJ7svX081NKhXcR40/0W3LxE=; b=CLOVFTWE8EZ4l7d8jlJxn1VNkfw1UzuLiLsmDHR7uqc2XLi1XfK55OF0XtZcEgZ4+0 Bi9HFxk6IVzFtivhd/E0mfLn9QQw5/9j9Qs421qTr7jnTF7KySsguhVfweutBlo0chbB MSBq7Csh9gtxMg9HvFsQj9q/hbCiqu0UYc9lehw/9MuvadTLb9fzWSIq+AWy6ZjEDTUr 8WYQkk4KYCbSB1Sy55rTfRzx5715uzXktN751787HH9LIfaj60u6tmhwr/e+oUAlEQ04 hJ/Rk/y7Pz3zrBk/+b1BZINsD68FbvbhiY1V2eXtAp+HqkukO6OC8hzcgrm2+7Kb4wGO 8IVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fomichev-me.20150623.gappssmtp.com header.s=20150623 header.b=NzfzBTFL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ca10si3212521edb.67.2019.11.21.13.43.37; Thu, 21 Nov 2019 13:44:05 -0800 (PST) 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=@fomichev-me.20150623.gappssmtp.com header.s=20150623 header.b=NzfzBTFL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726540AbfKUVm3 (ORCPT + 99 others); Thu, 21 Nov 2019 16:42:29 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:32918 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbfKUVm2 (ORCPT ); Thu, 21 Nov 2019 16:42:28 -0500 Received: by mail-pl1-f193.google.com with SMTP id ay6so2207630plb.0 for ; Thu, 21 Nov 2019 13:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fomichev-me.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=t6UbFd+jsoBUib7qTx+BJ7svX081NKhXcR40/0W3LxE=; b=NzfzBTFLLQbShuKd0+1iHPSbgolHJ4OtPiIo3cDBAbu/SkruCzBCsN/endbdxELPdg a2BGy0s6vp2YcKj3PofvztX4RQFiTivhdir/N//IVWWRGQ2a6JfQvwJKUa/sAuQPkwBl vBzjsu5iH77F4iDXo+o57Y1A0xCR1HoBzEOIXdj4vx1A4uyAlcehU83323iGR7g2J/+T uLncB6IFuO9PUxXESW8i/3VrqJSUb5vUYh9h4fhk7GTlwcBXKjqFLvEuw58816PaT84Z 740FYIO0PN1Pk84xVg5afM3Ai1eLS0aNwBlJYsNwBCTkO/bbIj6cSHCWddN53w5Qr6VY QAsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=t6UbFd+jsoBUib7qTx+BJ7svX081NKhXcR40/0W3LxE=; b=iwNeGLWqYpW4mA75mH2x3Rthos3tsFVY3Jb6qTmdWYquI8ySusnjbo/HfFelPxsE1Z cdXTzinQP4Y2+D1dKqXgcWQ86knCmUtCtP0qdVmrpE1WdKTXpP9JV2R9MOHXyKPxQG0N AVs1Bb9aLCaHt44biHn1sHbG9/1Qz3JGVzAc9fG/XKapKZEWTHon8fA39iWX+cmopX4l fQkDw3yQZM56GSV0WtAjcQ7YcGdn4X6r+RGkcqz/5bB9vE3ycURRkASJ4/VNyblMUuIS ssfaEHL5tWw4rg/mzDRvI60rtwQ8Jsi3capKp7br3Aoqt10Sj00CGkXfbuuE2SNBw8Hw FQVA== X-Gm-Message-State: APjAAAVD45/O2MMJAlCJF22YOQ3ZTo78Pi1040HL+vzs9fWscfiDLFWG rZPzMT9Hxr7jJkUG/Tb9h2TUSg== X-Received: by 2002:a17:902:854c:: with SMTP id d12mr6529877plo.264.1574372547563; Thu, 21 Nov 2019 13:42:27 -0800 (PST) Received: from localhost ([2601:646:8f00:18d9:d0fa:7a4b:764f:de48]) by smtp.gmail.com with ESMTPSA id 6sm4768899pfy.43.2019.11.21.13.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 13:42:25 -0800 (PST) Date: Thu, 21 Nov 2019 13:42:25 -0800 From: Stanislav Fomichev To: Ivan Khoronzhuk Cc: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, ilias.apalodimas@linaro.org, sergei.shtylyov@cogentembedded.com, andriin@fb.com Subject: Re: [PATCH v5 bpf-next 11/15] libbpf: don't use cxx to test_libpf target Message-ID: <20191121214225.GA3145429@mini-arch.hsd1.ca.comcast.net> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> <20191011002808.28206-12-ivan.khoronzhuk@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191011002808.28206-12-ivan.khoronzhuk@linaro.org> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/11, Ivan Khoronzhuk wrote: > No need to use C++ for test_libbpf target when libbpf is on C and it > can be tested with C, after this change the CXXFLAGS in makefiles can > be avoided, at least in bpf samples, when sysroot is used, passing > same C/LDFLAGS as for lib. > > Add "return 0" in test_libbpf to avoid warn, but also remove spaces at > start of the lines to keep same style and avoid warns while apply. Hey, just spotted this patch, not sure how it slipped through. The c++ test was there to make sure libbpf can be included and linked against c++ code (i.e. libbpf headers don't have some c++ keywords/etc). Any particular reason you were not happy with it? Can we revert it back to c++ and fix your use-case instead? Alternatively, we can just remove this test if we don't really care about c++. > Acked-by: Andrii Nakryiko > Signed-off-by: Ivan Khoronzhuk > --- > tools/lib/bpf/Makefile | 18 +++++------------- > .../lib/bpf/{test_libbpf.cpp => test_libbpf.c} | 14 ++++++++------ > 2 files changed, 13 insertions(+), 19 deletions(-) > rename tools/lib/bpf/{test_libbpf.cpp => test_libbpf.c} (61%) > > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile > index 1270955e4845..46280b5ad48d 100644 > --- a/tools/lib/bpf/Makefile > +++ b/tools/lib/bpf/Makefile > @@ -52,7 +52,7 @@ ifndef VERBOSE > endif > > FEATURE_USER = .libbpf > -FEATURE_TESTS = libelf libelf-mmap bpf reallocarray cxx > +FEATURE_TESTS = libelf libelf-mmap bpf reallocarray > FEATURE_DISPLAY = libelf bpf > > INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi > @@ -142,15 +142,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \ > VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \ > grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l) > > -CMD_TARGETS = $(LIB_TARGET) $(PC_FILE) > - > -CXX_TEST_TARGET = $(OUTPUT)test_libbpf > - > -ifeq ($(feature-cxx), 1) > - CMD_TARGETS += $(CXX_TEST_TARGET) > -endif > - > -TARGETS = $(CMD_TARGETS) > +CMD_TARGETS = $(LIB_TARGET) $(PC_FILE) $(OUTPUT)test_libbpf > > all: fixdep > $(Q)$(MAKE) all_cmd > @@ -190,8 +182,8 @@ $(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN) > $(OUTPUT)libbpf.a: $(BPF_IN) > $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ > > -$(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a > - $(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@ > +$(OUTPUT)test_libbpf: test_libbpf.c $(OUTPUT)libbpf.a > + $(QUIET_LINK)$(CC) $(INCLUDES) $^ -lelf -o $@ > > $(OUTPUT)libbpf.pc: > $(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \ > @@ -266,7 +258,7 @@ config-clean: > $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null > > clean: > - $(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \ > + $(call QUIET_CLEAN, libbpf) $(RM) $(CMD_TARGETS) \ > *.o *~ *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) .*.d .*.cmd \ > *.pc LIBBPF-CFLAGS bpf_helper_defs.h > $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf > diff --git a/tools/lib/bpf/test_libbpf.cpp b/tools/lib/bpf/test_libbpf.c > similarity index 61% > rename from tools/lib/bpf/test_libbpf.cpp > rename to tools/lib/bpf/test_libbpf.c > index fc134873bb6d..f0eb2727b766 100644 > --- a/tools/lib/bpf/test_libbpf.cpp > +++ b/tools/lib/bpf/test_libbpf.c > @@ -7,12 +7,14 @@ > > int main(int argc, char *argv[]) > { > - /* libbpf.h */ > - libbpf_set_print(NULL); > + /* libbpf.h */ > + libbpf_set_print(NULL); > > - /* bpf.h */ > - bpf_prog_get_fd_by_id(0); > + /* bpf.h */ > + bpf_prog_get_fd_by_id(0); > > - /* btf.h */ > - btf__new(NULL, 0); > + /* btf.h */ > + btf__new(NULL, 0); > + > + return 0; > } > -- > 2.17.1 >