From patchwork Mon Sep 16 10:54:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173829 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3337945ilq; Mon, 16 Sep 2019 03:55:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwy76fZrFxnLxJTShu8uh0o4tNbUl0iTzOYht2QSxAT0bW1H5IcJ9R4iNHBzk3xpcbZvxX X-Received: by 2002:a17:906:31c3:: with SMTP id f3mr51924386ejf.296.1568631306092; Mon, 16 Sep 2019 03:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568631306; cv=none; d=google.com; s=arc-20160816; b=0pmj3wi43AXtaIjNHCO2qUVivcd4JeMjd1kVMDBBkIa+URTJM2Nsnb5A80BpbBZJnU zn//DUTqaCWsaeLNSvkkC9udQyDboGVSj/HPTh4i0YWynbcBFpXOgRQVUYSIJRCA660d jI/AdRO8xGFwfMI+FJRIWEU3kv1w9V6TbPHk7qDU62Hb2/d+7N4//WBBQhRoZbrGwy0r xb2hjl8lSO8UGjQV9MeP/dZPQPN/et6tTF9N+/w/tLxIt7AWuXx/+/3EYRb0Z44KzwkL w+tlLUKAh4Ql+w+HXenUrkBI/lrkTLhyIjcNOFVdn9EWwuUU/I6vn53HASR1aF3PM720 25YA== 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=GxawIQ/MKoaOi42wOtzkwYPMR5CVbDtqJel19jnEoB8=; b=sKv8pHLUb0nDKuQ0bWeOYjJbielycU2xpkYrWmEkLyq/xIZKTybQeGlepVnr0nfyru dGF/kJ81XL2YisEBisMGp2Cg/8XYxE3nanROSCBirsFA0nuaCzj+BlwRn8n75YlP2y1n 7O3p05Q1sIzcvJkYhSaaJ4bEuBYB93bXCSp2lIgalypbkM8uUDxZzf606fB7XoG7CIHi dUtL0LnReSsqdG8NuJWbMyDc6jB6i4NvFQxbb/kSlgwvdwNWvuRJ5fVTsU1TieUHeJtv zRNeCoxCMIa6I3SLxk+qP9uNJY9DgHkcme1pGlidS31pqsnXRYW0tilYY+96jK1nN/pg 8ndQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kBKPwGq0; 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 x29si21684933eda.297.2019.09.16.03.55.05; Mon, 16 Sep 2019 03:55:06 -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=kBKPwGq0; 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 S1725912AbfIPKzC (ORCPT + 27 others); Mon, 16 Sep 2019 06:55:02 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:46673 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732563AbfIPKy6 (ORCPT ); Mon, 16 Sep 2019 06:54:58 -0400 Received: by mail-lf1-f65.google.com with SMTP id t8so27019010lfc.13 for ; Mon, 16 Sep 2019 03:54:56 -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=GxawIQ/MKoaOi42wOtzkwYPMR5CVbDtqJel19jnEoB8=; b=kBKPwGq0mxxasnUu8ZX4K5BUyfdUDK4at7rwgKR0KzP3udeJcRypxl6J6mXwSYptEI GTvX/Y9iRzZddsykOu7Nlc8Pw/gKhZd+iad9pzVoqIiGe8rjSNE+J2mVt23GFITZ+Zy1 ENpShtY9dvkl0TIxofqTrkdzjwgILVAW6GT1zul5j6yyGWB56wXx34c7J7RUYINRpTdl cu7B1+uzv1Nz4WWCL4UcKSvh8ShMCvcLzxr4WZSRinLS7NDUSri7YzJM1k6fvRn5p3+n 3Naodq56EveQzQ5cGR1+YAil3F1aalEHLr4w0rRvTpue+DuT6rfDoAYi0+8uPQ0+a3t9 utlQ== 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=GxawIQ/MKoaOi42wOtzkwYPMR5CVbDtqJel19jnEoB8=; b=mY5e+QYVjROEmc1WO1qzB4+opIRdd5JVyxCrO2TMxMHqLBPEwe1mVEXRW4OiyWmWxd 8Xen09nM+4W4eV7iX61K5kmyBP23/pWaCvZ2t8Z4D1wbPhUx3A0kO2x/lSy5Y9xZCZpe zWGmnJpbaBS5KwUIOGNgh/AaN2hnTzeLnTjg1KBz6lJbaGQ34aFFWO8EcqVpUZLtkLIh Ood3rnZ6T3pqkcrabguV1ARUgt5vGRBkUJTcwdR54K1J/M0GtNa9UKHtoPAZ0wf5wzsK 7v+0bwpag8MvTUO2I2l7xauS/3OKD/p9kDuRUtoygaM4rV+KpJNjfaaECOxYQGRvrsyZ y5UA== X-Gm-Message-State: APjAAAVyIPX0IXBkREfypl9/CFnoeSQ/+biRPvaKlwiKH77Xc9cHkqEP KuNtgV8Vl4utbRScRvJ3rCvVqw== X-Received: by 2002:ac2:5090:: with SMTP id f16mr39613241lfm.66.1568631295949; Mon, 16 Sep 2019 03:54:55 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:55 -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, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 12/14] samples: bpf: makefile: provide C/CXX/LD flags to libbpf Date: Mon, 16 Sep 2019 13:54:31 +0300 Message-Id: <20190916105433.11404-13-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to build libs using C/CXX/LD flags of target arch, provide them to libbpf make. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 18ec22e7b444..133123d4c7d7 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -182,8 +182,6 @@ ifdef CROSS_COMPILE TPROGS_CFLAGS += -Wall TPROGS_CFLAGS += -O2 TPROGS_CFLAGS += -fomit-frame-pointer -TPROGS_CFLAGS += -Wmissing-prototypes -TPROGS_CFLAGS += -Wstrict-prototypes else TPROGS_LDLIBS := $(KBUILD_HOSTLDLIBS) TPROGS_CFLAGS += $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) @@ -196,6 +194,14 @@ TPROGS_CFLAGS += -I$(srctree)/tools/lib/ TPROGS_CFLAGS += -I$(srctree)/tools/include TPROGS_CFLAGS += -I$(srctree)/tools/perf +EXTRA_CXXFLAGS := $(TPROGS_CFLAGS) + +# options not valid for C++ +ifdef CROSS_COMPILE +$(TPROGS_CFLAGS) += -Wmissing-prototypes +$(TPROGS_CFLAGS) += -Wstrict-prototypes +endif + TPROGCFLAGS_bpf_load.o += -Wno-unused-variable TPROGS_LDLIBS += $(LIBBPF) -lelf @@ -257,7 +263,9 @@ clean: $(LIBBPF): FORCE # Fix up variables inherited from Kbuild that tools/ build system won't like - $(MAKE) -C $(dir $@) RM='rm -rf' LDFLAGS= srctree=$(BPF_SAMPLES_PATH)/../../ O= + $(MAKE) -C $(dir $@) RM='rm -rf' EXTRA_CFLAGS="$(TPROGS_CFLAGS)" \ + EXTRA_CXXFLAGS="$(EXTRA_CXXFLAGS)" LDFLAGS=$(TPROGS_LDFLAGS) \ + srctree=$(BPF_SAMPLES_PATH)/../../ O= $(obj)/syscall_nrs.h: $(obj)/syscall_nrs.s FORCE $(call filechk,offsets,__SYSCALL_NRS_H__)