Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp248869ybp; Thu, 10 Oct 2019 17:29:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNLEYgt0K82aba++d7/0adxFsxVFua1fhgRmdnfR/FqeLVFqXIkoSN3q3VtHAdT95++kqp X-Received: by 2002:aa7:d410:: with SMTP id z16mr11049248edq.40.1570753760606; Thu, 10 Oct 2019 17:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570753760; cv=none; d=google.com; s=arc-20160816; b=Kef5h/iiPYBy2V8S0HN2/oK79oM6NBttqzza+O3YYmFGh53sETytw6itiY3dFSuewu gVinT8PA46PFUnnbmpKeRR1XJi4vrn9lSthFp21CxhlZ2YKhBUW+RitLiMKmU/9VRq5B dAne0cMJ/wcRMz8XFtAYVdEgUTZftmf2AYsCRFFDjVWQVUvp/6kpJQcw9KqBvoWSNMXy RRvXji1AKfTzwBfLrmbC41sMQhutyZwq2POcRrcyz6j3gRBplg1mDGUTyiRGuoXacKyy jL6BzbdR/PM4JtOLcyOuzUlbIt9yO6jOuVknGvclvRsYjYm5LhGG2J7ekqNTIc9aKstD PvAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=oHm0qgs35bdRmF9F1S/p3tYJstCeeDVx8Vw6XCI5qDc=; b=jssh/bzRvnUcRgzpZYSRdYdJkaR2yBJDJ6yDD5P6WPC6MmBQMQhTBS2IegrtRSFwVv dWSKIvphPHF4rh2gapzaaPLVC7g202auVR7T9EoiMGZexoCSkisHBkfjVyDezMmz88Co imoJY5TX8YID3XgzU54j33+vkHpN1AONDc2IGkj43UaoMtv6MA9SvDNKqXZ9v1LGwLbA d9yH9lbwFSZPi5ZSJunqvx/HlUZtUbxTGKy6Ik3RYB1poIAVk5/tfWEmIlhy9ZMWGL0h iP6NtT6j27XFd6PLxXWtOLwcDYGmGwZDgh31Po/2LJVjvWRHrYJ6OX7EaaI9sQHWrD58 UKUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oZoFP4EB; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si4924288edk.16.2019.10.10.17.28.57; Thu, 10 Oct 2019 17:29:20 -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=@linaro.org header.s=google header.b=oZoFP4EB; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727757AbfJKA2i (ORCPT + 99 others); Thu, 10 Oct 2019 20:28:38 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35502 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727721AbfJKA2h (ORCPT ); Thu, 10 Oct 2019 20:28:37 -0400 Received: by mail-lj1-f196.google.com with SMTP id m7so8057200lji.2 for ; Thu, 10 Oct 2019 17:28:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oHm0qgs35bdRmF9F1S/p3tYJstCeeDVx8Vw6XCI5qDc=; b=oZoFP4EBvirEOvHM9IfrnbIXJxjTZbSW136oc9UH1jI/wbPjjRATuu7MjU2Rqqkd/z Q12GzulFKtOI+LJ0qj+5jNMmCVsXsm6Du5YO8D0p+tYMDdRNKcMbUISq9/l6pXtBklWP janUJ6/iEWpc64Iuj0bEjCQprSWEhsxeyDw24v0xm1+sb7yVT1l1O4BSA94dZdZnN8fq 0Rdo69y1azsmEHPwIxAdFVnnYGhRyV/skW/4qKuKKE+kQCbdICf5xLj3qVQDQgwjUp4z Em25qhXc2WFbbf826EgIg8xT5txDZCz845v5RT3V5P6kDssmNHcAoUYNkrA4/cxF2U5r wUhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oHm0qgs35bdRmF9F1S/p3tYJstCeeDVx8Vw6XCI5qDc=; b=hEQFkUSR1rYv4w52tTaOZ8qD7KTVCUSEy1xKFUt1zSI6V5nRWdGxnB0bG+zaS2c+kr 67rCSP00T33S3daAcm2a4lHnyIM+WIhPHSMghbhscYqnw8mTvyq7ozTVcx6SJDqeLVl3 U51wAUOumCSrOcztN2MAWx9DLW/U5v6OO14ecAuZV08mCnHBgwj/ubryxB+5C+TG1pLk dOCQbTWCIyfK7Sx0c8XCt9gkBO5ErZOagov+mp5EnXl1kycBrrmwmXe/AArBQn9ISHrf 94v0lG4AS16xRON4welQn/ztAC2RVoXVsuuaOOPiVSHym/6VPUU+b5rD+11CkKp1ecyj I/Xw== X-Gm-Message-State: APjAAAWFA38y9/e/KFaPViZWGP9BSuZdkb6Tp7EEQasHKNN6ZyX5qAyS KVjBpnuusQ0329EV0QMGEni6KQ== X-Received: by 2002:a2e:658f:: with SMTP id e15mr7832403ljf.254.1570753715857; Thu, 10 Oct 2019 17:28:35 -0700 (PDT) Received: from localhost.localdomain (88-201-94-178.pool.ukrtel.net. [178.94.201.88]) by smtp.gmail.com with ESMTPSA id 126sm2367010lfh.45.2019.10.10.17.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:28:35 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: 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, Ivan Khoronzhuk Subject: [PATCH v5 bpf-next 11/15] libbpf: don't use cxx to test_libpf target Date: Fri, 11 Oct 2019 03:28:04 +0300 Message-Id: <20191011002808.28206-12-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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