From patchwork Wed Oct 9 20:41:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175681 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1263970ill; Wed, 9 Oct 2019 13:41:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyS5IhQIHrgubRNU2dBWM+bR+3uGq9hbGU18tIEdAaRgfkqpK7F2lCcsYxG80tkOAm3o/nw X-Received: by 2002:aa7:dd18:: with SMTP id i24mr4904701edv.239.1570653708460; Wed, 09 Oct 2019 13:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570653708; cv=none; d=google.com; s=arc-20160816; b=mqzgNE4N42UuH2qR4B4O1xh8Lqcek8UV7QV6peSQIB27A0OJYYehvuUTlDDIvvwTd2 8K1fNH8k0tuShiTBghXxnFi4+0gJWCkBqkW9UsN04g6GrkFybtgA9tzsRRfnlf04XEXZ iwEDONr9P4nDXICRkoeYzB5J4vdMcfMg4eIGyW0cOFcVqkd8NR0M40cT5MSt8XgRAUgh F+hFbF+QClFE9AldlpOjt2hBDBTG4RQWfFcYRs3EYVpmfkHzvqIEd37EckamXDZPPKyU ogST2w4oN1sesn38cBVtI5V8ezt4obvHswbMJAprms+EKTatkI6OTJUYQl+knU8EMXOM 8m/g== 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=X+OYdLBkIYv08X2eKXt3TCPXQ11so0VYCO7f1mswfR4=; b=O0Oaf7Da6Omoebcdu2mW28m8v4aJz5zyAVpgBvuh6k12gIKiOuQkUr9NLq9VUCd3LI mWwkMCtg5aY2FRvux23uuMdNiG9oXhtvK5B94a3UZ6Rxv4y4fPG5WSc5bpqnkARWXu7b ZTfHkq/kIPRVu0OagF82czmnaCY3S1IcL7USFjCIoV9GBnxS5tzN+El024aJVwD2YGZp LG2CN+zFt2ivImJScQ0vd58D1+uyA3ZHP/PGuxJHVYEBHwbMdv+hHjXuFlkmHOsJWNMj b8jsj2ESXXr9mXYaXzG8Ku7juur49QdfXpiwkfiOtMii1JCYL4pI2QtGsWpUxdzWFrYe kYTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tfJRZwLz; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 l23si1802319ejr.296.2019.10.09.13.41.48; Wed, 09 Oct 2019 13:41:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=tfJRZwLz; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1731987AbfJIUlq (ORCPT + 8 others); Wed, 9 Oct 2019 16:41:46 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:40829 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731952AbfJIUlp (ORCPT ); Wed, 9 Oct 2019 16:41:45 -0400 Received: by mail-lf1-f65.google.com with SMTP id d17so2672968lfa.7 for ; Wed, 09 Oct 2019 13:41:44 -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=X+OYdLBkIYv08X2eKXt3TCPXQ11so0VYCO7f1mswfR4=; b=tfJRZwLztmeYnFVdBAyxDdd+TZuqCcbbHvU5t2tVbgAMeD89v9awCNcvPek+HEsinA K1LAR52j6GCLiPMmHzsyATIhO8GEAHwsq1kzMxTb+kqnSKYNYd/61S+suugTWtGL+xYl hYzte2ORZ6ds9SEIuh1GeM64BiH81APaqQ8DuaBD1dx9qk2i1Er8JYdmwhNet5xJn8FY UA4s3/ng5TBA92c8PW22hDa8b8CpZzr4neRtwwxFfBh7XCXe0ywARrnUdf3onmDwFKSE KtyiZ5pt88z1zElieeXhqhh6EmSJxDY15JKWCgIFMyvdMpMSehHPchYNTgjgh1TOKi7m 700g== 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=X+OYdLBkIYv08X2eKXt3TCPXQ11so0VYCO7f1mswfR4=; b=VtK6wMe9vZpFzTF6ZL7+d0d+FVAa9zahcKu7VKfJrwbQzSrS75536RGmTBzkjff/9L D7QzsxzXyQeZXJveQoi4sKOSD/6fERs7j/ihjdnppEQlQHc2ZcFdmJEM1OSCwREEK9aK TFfih3z2dHgiBdrHYO20jcXXd7buah3wWL5ovEOEGodUOmFj8d/P0igB/HWxwIMy68w2 cYG8eYpJ4x+bpTuwcFMRTft3DIebbMtaZAiXBhgrIKnV7iXAfFsxAOBJdMsZ/aOa8jds S/CsmdVgD5UXxj4Sce+JxzDFaxswkMves086aCYlUJzrUA0HKNLb9vsjd3rbBBzJhfXM /E+Q== X-Gm-Message-State: APjAAAWCOgr9XvlrmUlxUsOifQUCmk60haA2jmfbMjD90FmXOf1huJM3 Pybonafe39kyLnQG6xv87Mk6OA== X-Received: by 2002:a19:380b:: with SMTP id f11mr637307lfa.81.1570653703810; Wed, 09 Oct 2019 13:41:43 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id h3sm730871ljf.12.2019.10.09.13.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 13:41:43 -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 v4 bpf-next 03/15] samples/bpf: use --target from cross-compile Date: Wed, 9 Oct 2019 23:41:22 +0300 Message-Id: <20191009204134.26960-4-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> References: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For cross compiling the target triple can be inherited from cross-compile prefix as it's done in CLANG_FLAGS from kernel makefile. So copy-paste this decision from kernel Makefile. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 045fa43842e6..9c8c9872004d 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -195,7 +195,7 @@ BTF_PAHOLE ?= pahole # Detect that we're cross compiling and use the cross compiler ifdef CROSS_COMPILE HOSTCC = $(CROSS_COMPILE)gcc -CLANG_ARCH_ARGS = -target $(ARCH) +CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%)) endif # Don't evaluate probes and warnings if we need to run make recursively From patchwork Wed Oct 9 20:41:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175682 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1264075ill; Wed, 9 Oct 2019 13:41:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUP09pG1zLwhTKT5LfMfjAWzsmV0cky2Mj51T1ap5vRWPEj22ejl+c/idaDeIBbPaI7nzn X-Received: by 2002:a17:906:792:: with SMTP id l18mr4596170ejc.170.1570653714248; Wed, 09 Oct 2019 13:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570653714; cv=none; d=google.com; s=arc-20160816; b=CqK0In1u2Rq+5J4vdImoeyeUSuAe8H5vA/MvphVbXkbItBp3fb+gmUNBoqkMu6twH9 MyNaNl5ZkbmXBGVUnqAQmEkoCzFKFxpY4o45GiBiR4U6kSxntoGC5Y2gNGbTli0a5/WA ftFFSqdYCj0JZ2g74eGQ2NvWzLhXW309nQTNx9Iq1Qt4te/yo2ziFGuctq2MKDCb0PwF EMds0L9lM+ZYj2tgzP6XH0LUDplpxY81lYNewWOth69xNslKIKBcBVgLFkAj35K0zYlu xwyhmvp4EnkrextUPvDIJnXEaOmB9QQpXlThShK5mu/zskf5ogYPUIKd+iciVlITFDK2 IJ0A== 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=j9oehlPvbpQ/3mUr7ILsjkWG9P4RuU3Cq2akh+BGeG4=; b=HHzWwJliEbAAWB6uLuwIbDwViayuWRMe6r1W6rDHQjOFa76nNAlhanNEpgmMTGjXm1 GZ4o/p4pPbudix4A5x0qkULn6EOexO0OW3VsNp+tRkKZZi2QHlCTLAa45j6NnGmzU0tk FiNoVtvvtcItoqbza1EMZ7RYdY1BiHdT2F4EBdS11ggbk0451IzklaI160oe43bXrdeC ZdQzvkyYT/BxvO3Tv/ZvnNN4qAMlKA7eHZtZGUh7VX2z5Bd7gIo2AejCpl3PjrJqbScH Zue3bqftNSyZYu5j0XsDzV09kC+zOuMwerfAxZtS25aYw6ycsoT++YOFZOlv1pVRmyrM mEzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u9WblPuD; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 g9si2182433edg.58.2019.10.09.13.41.54; Wed, 09 Oct 2019 13:41:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=u9WblPuD; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1732012AbfJIUlr (ORCPT + 8 others); Wed, 9 Oct 2019 16:41:47 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42215 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731977AbfJIUlr (ORCPT ); Wed, 9 Oct 2019 16:41:47 -0400 Received: by mail-lj1-f196.google.com with SMTP id y23so3848357lje.9 for ; Wed, 09 Oct 2019 13:41:46 -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=j9oehlPvbpQ/3mUr7ILsjkWG9P4RuU3Cq2akh+BGeG4=; b=u9WblPuD1rsm0jyX6rOP8LRDXId4vkuFAucoTNQKldbU28hMIlJ4Ye49sY+S9r4GVw FZlnYg+q4HiKAE96sVNakxmBf34Y9mWy3RWPbEpycFz6xT78/mZDLFsz7FEXaIXy1EXt XrgaMdZhH+hP/js5F/dJ3Em5ta0eRVre0FAswR5FWcDfAnxpFAk1mWdRFBtU+/IJF0Ty TBQ4ItMejqowBuKLezbZXsMP0uNYRa5YzBKTB7STXrYiiISY8jmZs0OxMlAXJTxMw2Uo ah+j28+8X6x/K5OMYVKofwMOJqb+8KuBfI6BQFyAyyrKkwdciKWqLYwXUnPM8odBEyds lLKA== 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=j9oehlPvbpQ/3mUr7ILsjkWG9P4RuU3Cq2akh+BGeG4=; b=KJLPSaxySGvJMxz3BzDNKCGWLgOx1I5tTsHqR28KFB3tIQrRyuNy7M/5toqxQdgz/x ZPJ9yPwJD0vvGyO/jiInVPpkt1dpSMMkerT/h3E8Fi/GY3M0tKtmdD/46drcKAmc4O+4 BjkB/faVpVOjGeZsFSsQS8vzS9mcRiVVk2OfXjQOVRC88GYxFi3iIDIhHehfQ0ggwchE AUjHzlv7a8A5cGz8308BSruu7E5CtT0JSF2mnP892P5vHfAfP58+lsSUwrwZEr/YakTa XdiFs+k03MD9oML5jqRakzgLT5rQmm8lRjkGATVzl6jObvwAbryJ3Rz4fDl5B0btCb+2 b2iA== X-Gm-Message-State: APjAAAXCzd58dQrASgPDBExHEP0bzm59LUr7pjoT1Ifs9CTUujNub+nu SYSwUlZ7Tgh5BbcHb2UzsdyoIiPsc98= X-Received: by 2002:a2e:9b12:: with SMTP id u18mr3696925lji.142.1570653705253; Wed, 09 Oct 2019 13:41:45 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id h3sm730871ljf.12.2019.10.09.13.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 13:41:44 -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 v4 bpf-next 04/15] samples/bpf: use own EXTRA_CFLAGS for clang commands Date: Wed, 9 Oct 2019 23:41:23 +0300 Message-Id: <20191009204134.26960-5-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> References: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It can overlap with CFLAGS used for libraries built with gcc if not now then in next patches. Correct it here for simplicity. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 9c8c9872004d..cf882e43648a 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -218,10 +218,10 @@ BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \ /bin/rm -f ./llvm_btf_verify.o) ifneq ($(BTF_LLVM_PROBE),) - EXTRA_CFLAGS += -g + BPF_EXTRA_CFLAGS += -g else ifneq ($(and $(BTF_LLC_PROBE),$(BTF_PAHOLE_PROBE),$(BTF_OBJCOPY_PROBE)),) - EXTRA_CFLAGS += -g + BPF_EXTRA_CFLAGS += -g LLC_FLAGS += -mattr=dwarfris DWARF2BTF = y endif @@ -280,8 +280,9 @@ $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h # useless for BPF samples. $(obj)/%.o: $(src)/%.c @echo " CLANG-bpf " $@ - $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \ - -I$(srctree)/tools/testing/selftests/bpf/ -I$(srctree)/tools/lib/bpf/ \ + $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(BPF_EXTRA_CFLAGS) \ + -I$(obj) -I$(srctree)/tools/testing/selftests/bpf/ \ + -I$(srctree)/tools/lib/bpf/ \ -D__KERNEL__ -D__BPF_TRACING__ -Wno-unused-value -Wno-pointer-sign \ -D__TARGET_ARCH_$(SRCARCH) -Wno-compare-distinct-pointer-types \ -Wno-gnu-variable-sized-type-not-at-end \ From patchwork Wed Oct 9 20:41:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175691 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1264769ill; Wed, 9 Oct 2019 13:42:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/tBbjO4VZEvacDkbN6tGJR1M+J3ZH5bZVBOsGXn85VssPfU9+H0F0pCELbRRcOPsk6RGc X-Received: by 2002:a17:906:360e:: with SMTP id q14mr4634912ejb.313.1570653758348; Wed, 09 Oct 2019 13:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570653758; cv=none; d=google.com; s=arc-20160816; b=zc7ByC9lTPkGjOYjPMrOX0ubmGT6xVpOvzZBVlyVKk+agSsAZukPnfkTcMDNwEE6i+ CwLCfn/ne2hbS6DRn18XvGd8+er6Y7H3XBSHPcVgBFoLFom74fWR2Z2bcAAEcfz4Qnct DRVQVFjja6anf+dKV45oznm4zuCUE+Eo1O9GA+PSwCWDJoXqLFd99xOYOvcVpyJobu65 ulDGSo904issIpFOt823a0TbixRJCFr9HQvX6XyE71M8Rb8DyXEcadXs5XstzVz0OK47 e2NnOFBI9Zg6AdM77qDhtiPR20dc0LqXhceSlzsjssJMv5k3P4GxAd/bOU4rdW2cappi shkQ== 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=M7M9P1nOh5u0u0U5RBRymVMGVBKZgCwkvUp/NKJyprc=; b=KowABF1qIadZMKzb0pZpMJWxxd2a9RYTfaVolfPRe7xqZakFDRIyW7HWAPPP1NMJDF qnBa8h8SrPAca/3cBq2Oogy2mdV8XaWCJBQXdTMhb5ElF+Cn8660/tFRi3XumD1a4Lif K4rH3fnfzbaG/cgG1a3hmwfp/53APTObnM95IkfdHf8BbDHVWOEQHLy73kKt401CSxhC tv1zEqMQY3A5c6RWov1arZ2+gPi8Kf6FcyREPi+XNiGlnPywxy+YuwmRpHkgKHccd21M ctVWllR1ok0igbyW+qO9NLDmls9RgNYc4x7Bg+xlmPWzRzEEXuUOmlTfXTi+pI9YX7PM 3lMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="u/Xk9pOw"; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 sb7si1878178ejb.321.2019.10.09.13.42.38; Wed, 09 Oct 2019 13:42:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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="u/Xk9pOw"; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1732022AbfJIUlx (ORCPT + 8 others); Wed, 9 Oct 2019 16:41:53 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:43615 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732028AbfJIUlx (ORCPT ); Wed, 9 Oct 2019 16:41:53 -0400 Received: by mail-lj1-f196.google.com with SMTP id n14so3849319ljj.10 for ; Wed, 09 Oct 2019 13:41:51 -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=M7M9P1nOh5u0u0U5RBRymVMGVBKZgCwkvUp/NKJyprc=; b=u/Xk9pOwu+pXtdnZq4EGmi0cTQNHqYuWaDKxLVH6S/ZPCh9X28D9YZyft9l8Jx45tp gxgyGp0erhsT0nx5vQ3QPll9ga2XF4vNTonHLIvMx8MX3IkBwvd7pkCq57RiHE3uz8CZ uE1A41hnuUvTdijw0TVr0Fj6QJEmZMwojRd3aM+8XXrOauFFwNNlPMkL8hCbHXkDdPbn rhYkV8snpca1Qq3DIqiXbwqdLfz9pS7WDDeEhDKDh1QWTe0eq9dFVDx6W/IxMjgt86Jj 6lGuiYWHhs01b1q6vYZhgcFSh/4ZJ3lwwI2RS1VuIaAEdsF1eT4VW55WQUxTlHcDjHRH PbEg== 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=M7M9P1nOh5u0u0U5RBRymVMGVBKZgCwkvUp/NKJyprc=; b=GQ6r1od5/hJf6maXUbW941amyOKlw77c4t9BVf0/U2GcICsgwdxoABt1BwBw3wq4NI RerZ8M+mIv64VyXDH9RRfAoJTWU9jiKRKHW1C4BUEdiokON3dVKTJohblF1naQDuEKE3 CsE7A8fwxczOS5QRaR5kJVikkpK87WWVEFkG6PmJd4Dv2lgkTmVroQtKv2jKtrN4qwdr 7Iig6xLdT2/Cy3bh6jODiZUOm5eM56h4GLjgj62mNwH2UpWnmblp9v0mAaCrCsVLxK3p ScLtoPGyao5be95SDy+z0qQAQBt90B/R9n+K/GQII/lvuXDjXFUVS9vt4HNspN1GsKZ0 n3aA== X-Gm-Message-State: APjAAAV9MoB9kCIUprGlhrvD4oxOhws0ZqZa/M/A8d0eVAcS7kWo6opH BUzHyycPLRZOUJTGE2h5onlgjw== X-Received: by 2002:a2e:9816:: with SMTP id a22mr225505ljj.102.1570653710828; Wed, 09 Oct 2019 13:41:50 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id h3sm730871ljf.12.2019.10.09.13.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 13:41:50 -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 v4 bpf-next 08/15] samples/bpf: base target programs rules on Makefile.target Date: Wed, 9 Oct 2019 23:41:27 +0300 Message-Id: <20191009204134.26960-9-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> References: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The main reason for that - HOSTCC and CC have different aims. HOSTCC is used to build programs running on host, that can cross-comple target programs with CC. It was tested for arm and arm64 cross compilation, based on linaro toolchain, but should work for others. So, in order to split cross compilation (CC) with host build (HOSTCC), lets base samples on Makefile.target. It allows to cross-compile samples/bpf programs with CC while auxialry tools running on host built with HOSTCC. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 135 ++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 66 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index bb2d976e824e..91bfb421c278 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -4,55 +4,53 @@ BPF_SAMPLES_PATH ?= $(abspath $(srctree)/$(src)) TOOLS_PATH := $(BPF_SAMPLES_PATH)/../../tools # List of programs to build -hostprogs-y := test_lru_dist -hostprogs-y += sock_example -hostprogs-y += fds_example -hostprogs-y += sockex1 -hostprogs-y += sockex2 -hostprogs-y += sockex3 -hostprogs-y += tracex1 -hostprogs-y += tracex2 -hostprogs-y += tracex3 -hostprogs-y += tracex4 -hostprogs-y += tracex5 -hostprogs-y += tracex6 -hostprogs-y += tracex7 -hostprogs-y += test_probe_write_user -hostprogs-y += trace_output -hostprogs-y += lathist -hostprogs-y += offwaketime -hostprogs-y += spintest -hostprogs-y += map_perf_test -hostprogs-y += test_overhead -hostprogs-y += test_cgrp2_array_pin -hostprogs-y += test_cgrp2_attach -hostprogs-y += test_cgrp2_sock -hostprogs-y += test_cgrp2_sock2 -hostprogs-y += xdp1 -hostprogs-y += xdp2 -hostprogs-y += xdp_router_ipv4 -hostprogs-y += test_current_task_under_cgroup -hostprogs-y += trace_event -hostprogs-y += sampleip -hostprogs-y += tc_l2_redirect -hostprogs-y += lwt_len_hist -hostprogs-y += xdp_tx_iptunnel -hostprogs-y += test_map_in_map -hostprogs-y += per_socket_stats_example -hostprogs-y += xdp_redirect -hostprogs-y += xdp_redirect_map -hostprogs-y += xdp_redirect_cpu -hostprogs-y += xdp_monitor -hostprogs-y += xdp_rxq_info -hostprogs-y += syscall_tp -hostprogs-y += cpustat -hostprogs-y += xdp_adjust_tail -hostprogs-y += xdpsock -hostprogs-y += xdp_fwd -hostprogs-y += task_fd_query -hostprogs-y += xdp_sample_pkts -hostprogs-y += ibumad -hostprogs-y += hbm +tprogs-y := test_lru_dist +tprogs-y += sock_example +tprogs-y += fds_example +tprogs-y += sockex1 +tprogs-y += sockex2 +tprogs-y += sockex3 +tprogs-y += tracex1 +tprogs-y += tracex2 +tprogs-y += tracex3 +tprogs-y += tracex4 +tprogs-y += tracex5 +tprogs-y += tracex6 +tprogs-y += tracex7 +tprogs-y += test_probe_write_user +tprogs-y += trace_output +tprogs-y += lathist +tprogs-y += offwaketime +tprogs-y += spintest +tprogs-y += map_perf_test +tprogs-y += test_overhead +tprogs-y += test_cgrp2_array_pin +tprogs-y += test_cgrp2_attach +tprogs-y += test_cgrp2_sock +tprogs-y += test_cgrp2_sock2 +tprogs-y += xdp1 +tprogs-y += xdp2 +tprogs-y += xdp_router_ipv4 +tprogs-y += test_current_task_under_cgroup +tprogs-y += trace_event +tprogs-y += sampleip +tprogs-y += tc_l2_redirect +tprogs-y += lwt_len_hist +tprogs-y += xdp_tx_iptunnel +tprogs-y += test_map_in_map +tprogs-y += xdp_redirect_map +tprogs-y += xdp_redirect_cpu +tprogs-y += xdp_monitor +tprogs-y += xdp_rxq_info +tprogs-y += syscall_tp +tprogs-y += cpustat +tprogs-y += xdp_adjust_tail +tprogs-y += xdpsock +tprogs-y += xdp_fwd +tprogs-y += task_fd_query +tprogs-y += xdp_sample_pkts +tprogs-y += ibumad +tprogs-y += hbm # Libbpf dependencies LIBBPF = $(TOOLS_PATH)/lib/bpf/libbpf.a @@ -111,7 +109,7 @@ ibumad-objs := bpf_load.o ibumad_user.o $(TRACE_HELPERS) hbm-objs := bpf_load.o hbm.o $(CGROUP_HELPERS) # Tell kbuild to always build the programs -always := $(hostprogs-y) +always := $(tprogs-y) always += sockex1_kern.o always += sockex2_kern.o always += sockex3_kern.o @@ -170,29 +168,32 @@ always += ibumad_kern.o always += hbm_out_kern.o always += hbm_edt_kern.o -KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/bpf/ -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf - -HOSTCFLAGS_bpf_load.o += -Wno-unused-variable - -KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf -HOSTLDLIBS_tracex4 += -lrt -HOSTLDLIBS_trace_output += -lrt -HOSTLDLIBS_map_perf_test += -lrt -HOSTLDLIBS_test_overhead += -lrt -HOSTLDLIBS_xdpsock += -pthread - ifeq ($(ARCH), arm) # Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux # headers when arm instruction set identification is requested. ARM_ARCH_SELECTOR := $(filter -D__LINUX_ARM_ARCH__%, $(KBUILD_CFLAGS)) BPF_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) -KBUILD_HOSTCFLAGS += $(ARM_ARCH_SELECTOR) +TPROGS_CFLAGS += $(ARM_ARCH_SELECTOR) endif +TPROGS_LDLIBS := $(KBUILD_HOSTLDLIBS) +TPROGS_CFLAGS += $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) +TPROGS_CFLAGS += -I$(objtree)/usr/include +TPROGS_CFLAGS += -I$(srctree)/tools/lib/bpf/ +TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ +TPROGS_CFLAGS += -I$(srctree)/tools/lib/ +TPROGS_CFLAGS += -I$(srctree)/tools/include +TPROGS_CFLAGS += -I$(srctree)/tools/perf + +TPROGCFLAGS_bpf_load.o += -Wno-unused-variable + +TPROGS_LDLIBS += $(LIBBPF) -lelf +TPROGLDLIBS_tracex4 += -lrt +TPROGLDLIBS_trace_output += -lrt +TPROGLDLIBS_map_perf_test += -lrt +TPROGLDLIBS_test_overhead += -lrt +TPROGLDLIBS_xdpsock += -pthread + # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang LLC ?= llc @@ -283,6 +284,8 @@ $(obj)/hbm_out_kern.o: $(src)/hbm.h $(src)/hbm_kern.h $(obj)/hbm.o: $(src)/hbm.h $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h +-include $(BPF_SAMPLES_PATH)/Makefile.target + # asm/sysreg.h - inline assembly used by it is incompatible with llvm. # But, there is no easy way to fix it, so just exclude it since it is # useless for BPF samples. From patchwork Wed Oct 9 20:41:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175685 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1264194ill; Wed, 9 Oct 2019 13:42:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3+v/z46zGOAEkVb1aPTkAtuNT7UGywTxlXp6D/03U6M+rVUO+aOvgUW/wAezfTUZW/ofk X-Received: by 2002:a17:906:790:: with SMTP id l16mr4944484ejc.270.1570653723112; Wed, 09 Oct 2019 13:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570653723; cv=none; d=google.com; s=arc-20160816; b=RH+TqIujhU+Vr2BQ9SO8cGQ7K+Mxa1CvtAYOa9AgikEJf8hk89/K2Q1mkEeLayhQhw TB+oLv2LSW3CIZ9hTpa4a7bKiCR0+7/kzwgHpGlD/yUaUPB3kZkC0bA0MhUUZRakmPcj D5soFrEzmmKydvZUK0jMSjyUtv7InVe/uxHqaBgfi1J9dCSt86g0SVqCVpyc0KgBWTQz /tCj4n0iAKbhaDzGyLNLC4H7s5vrlZU15p0pr2Y3tuTWlEs2/P3yaT4SL1X9Vnri7rhC jMKRhMpPs11ZcnS/cc3gKfwNAj/8jjzg3/uaYEZrwj+4jKfMRjwIeYW3xMLFD231x6PL 97Sw== 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=wbL2nu6acnton90gIbsX5qxq9tLlNkmN4RUryN8fm7M=; b=LzCWqfIvgLxT4deCxdLCmMVAi/HYs4GyqryzOH+b8V9O6aidH08h9IX2SaeIxGaNS2 8DL9cTYuEz1YN0d0DLo47NOXGdM+FEBL3f6h0zZBOe9gGgiHPZS6LSZwGRNYj2/I8WWi S8jl9rTTtxhtCNdsiOZAI3xo5n2VUsP6Ye59e6DhckxUfljGeiDtAiyFAX+mWdcSHSQX +nev1/jSC26I53RK36LcujuxhSBy3T5rfrelgQjr4mg9UJ8mIDLx4vDgrRmC9Tyg1z1O +cX+RI/QvpBfBXpKwl87Gj84v0ol6nPZsjXVC+pSn1yfHgDu1BcOr+dv6JMT8tHzyu5X huUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A3gY6o7H; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 f2si1867068ejq.395.2019.10.09.13.42.02; Wed, 09 Oct 2019 13:42:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=A3gY6o7H; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1732145AbfJIUl7 (ORCPT + 8 others); Wed, 9 Oct 2019 16:41:59 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35913 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732114AbfJIUl5 (ORCPT ); Wed, 9 Oct 2019 16:41:57 -0400 Received: by mail-lj1-f193.google.com with SMTP id v24so3899501ljj.3 for ; Wed, 09 Oct 2019 13:41:54 -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=wbL2nu6acnton90gIbsX5qxq9tLlNkmN4RUryN8fm7M=; b=A3gY6o7HgTJ8YPTLbW0H4/UT2ZFoBSmF3dt74q0EUM3FTy6EnbqRwhaISluNSdHvUX CIawMYyGoTlYyjuuN/AxQM4IG/BMqNKUl+BPKvdsxEq50+r7fA4jI4lTQ1TO+R066sXk e7QCppCoKQ++RV9uKddTSrIyVbHD2INrvkF3Ffu2ISQMHRpqp9w9ljJoIeEPfbKLAWxQ urHJWqszpXSN4THwBKlG9/N/woZ8qllhLGFCX1DeT/IzKtBd20H2eeFSdY0HTEnbS6N9 rw4DTH0s5ogzG+ZqTmvII3XMHWFfRIYNURW5r9/hOhHoiOYH598aERl9cfycrKxgW4gA 9eQQ== 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=wbL2nu6acnton90gIbsX5qxq9tLlNkmN4RUryN8fm7M=; b=GsADTsW8U3GSzWTk0bb7U4wrNDtfbE3o+Imblo3zjxDWha5N37C6ze0bfa1Okm/ZkR Q4KpKc19SOmdvfNJh8t65wOlBTFcG5KqvJUGW6EI4OUiABLv6uwtHnTgHkzCTb/vDQ6Z SIv9u0uu3fTBFHvhVzAn6+eRY7aohzillYsRYnbz2d/+4/d2QxdCWZ4BKlyhd0h3bObl IOqMyhrZ8Qlu4fymlz5nwPqXhRre5x14nhRVwNi24ilDFPqy/qiYtpJzigabL+lCiDGH nk13zGnVWon/hqtyIaEsmUaAiA6jJdzEK5xgrJfHpJIXAPKm0oePyR8IyV9ax9z7BiwO tmJw== X-Gm-Message-State: APjAAAV8XLt6R2FfSrRYKwDlDTBznWVjfGDsNhAHeuSufkqEe9MuUlh0 awB7Ir7Bu3waLl5A11ROCUjpbcrspbQ= X-Received: by 2002:a2e:9449:: with SMTP id o9mr3534903ljh.110.1570653713531; Wed, 09 Oct 2019 13:41:53 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id h3sm730871ljf.12.2019.10.09.13.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 13:41:52 -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 v4 bpf-next 10/15] samples/bpf: use target CC environment for HDR_PROBE Date: Wed, 9 Oct 2019 23:41:29 +0300 Message-Id: <20191009204134.26960-11-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> References: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org No need in hacking HOSTCC to be cross-compiler any more, so drop this trick and use target CC for HDR_PROBE. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 57a15ff938a6..a6c33496e8ca 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -205,15 +205,14 @@ BTF_PAHOLE ?= pahole # Detect that we're cross compiling and use the cross compiler ifdef CROSS_COMPILE -HOSTCC = $(CROSS_COMPILE)gcc CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%)) endif # Don't evaluate probes and warnings if we need to run make recursively ifneq ($(src),) HDR_PROBE := $(shell printf "\#include \n struct list_head { int a; }; int main() { return 0; }" | \ - $(HOSTCC) $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \ - echo okay) + $(CC) $(TPROGS_CFLAGS) $(TPROGS_LDFLAGS) -x c - \ + -o /dev/null 2>/dev/null && echo okay) ifeq ($(HDR_PROBE),) $(warning WARNING: Detected possible issues with include path.) From patchwork Wed Oct 9 20:41:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175687 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1264213ill; Wed, 9 Oct 2019 13:42:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzp5d6UnHvY9MACyg4yJ5D2f8A5gnVLcKtGFbhcCtkfysTKM+q7rbuCIKwxdzs/x07ZcBIB X-Received: by 2002:a17:906:364f:: with SMTP id r15mr4826928ejb.194.1570653724004; Wed, 09 Oct 2019 13:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570653724; cv=none; d=google.com; s=arc-20160816; b=r/0P1SPjWa+XPUzmgJanHueZefj7l/ue1Wzbwl7tBxLgzUq2u+/xTeu3RCITF22n4i c+QY0Bt8tiFI+qVVfIBCCEzdR0ce+zE85A3QrVNMVv9X2SgT/Q5SxIgknbsVkvjrdcqf Ie6xC3LtfwiabWoWCCALVM0ObRx61VYls1m/4Ij7QRsXRRg9fJe5EezDkqj1Er7zaHDL ZliK7tl9wx8XpEiwZUUTF8lRTTIwNDSZ5viGTGxHAj/gNw1wiNj95eqd4qvDAPVeLBkM W8OFM46pFfoPD4MVcPpSGNlcy+SRabFqb7AfuWoFso2CReJ/Lb72ebxB9eSHFl37zZSm o05Q== 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=ZSbYJ+tLtfDuMSVqb7LwJbRD3u314/MfD3p1keHf2Mw=; b=MC3UXxIyGlb2XstOqzy+GWfcotnbF8PKfPeJNsshsWmAWTdj4NaIDFBAPhKoylu/4S UbFZdEj56TKZ4LS0+eNfr3SYEB04iSiagRU4cunQLO7X+YTG65VjmfGUUc8ROre0h1+y FpHwo8suSvluT22+g7Ai4dZ/RM3b1yaMq6BWFd1I+HOQ7STQ38HHvxS50phBIxHSdyKK ejm1cvgikIphEc7izu12GkPX7ypTsCbtT9s06hyzsw8hDwDUmYV3EcN2E1xfMRRkwFTG UdU/Ow/WXZ/tIsrPeRfjYXIOv+R9eX3fM1GiuzCopQ+5xWjZnSYHItnvfSr6ms/81ilF sTTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pzdPyL78; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 f2si1867068ejq.395.2019.10.09.13.42.03; Wed, 09 Oct 2019 13:42:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=pzdPyL78; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1732169AbfJIUmB (ORCPT + 8 others); Wed, 9 Oct 2019 16:42:01 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45145 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732170AbfJIUmA (ORCPT ); Wed, 9 Oct 2019 16:42:00 -0400 Received: by mail-lj1-f193.google.com with SMTP id q64so3848538ljb.12 for ; Wed, 09 Oct 2019 13:41:59 -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=ZSbYJ+tLtfDuMSVqb7LwJbRD3u314/MfD3p1keHf2Mw=; b=pzdPyL78q/gbChT77HCP7gSmJXWVdEWKYJQzr4nN7gdvvWnYwHoI8e+zFj+6pgj6yb K8kXXGGo9S629wH2TsCb/WtRqZmXgJJ70q3HTxWrCTT/7iMCwuiKj7zudoSmlfGB+PAI /45wQ4KP7k11v6we53lk8hhEeehY1QX9SjVDv/VQv1jaHINDd6U4g/QtWhYfubjHDXgp XTVVibyKnEQzXFUc37axnMinQOpbyw7ku8dOxYuTW/BDJAeS00IL5E1xmBcZliiAeCXU ntHfGa4HfaPvseNHg7XszDFS0voyh5uMx9tMPpL6EIkU9r4TMaGMpMFzfb6wZW5PrWf4 cALg== 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=ZSbYJ+tLtfDuMSVqb7LwJbRD3u314/MfD3p1keHf2Mw=; b=kunbN/HQtZbKteno6iog/52X0ZrUqjwdx7PKjXXapvAwN4BxrJdcaVV3XzP4nQ+RPD 5PK66zQxwmzxKceXQ0Mh7Saq9TGdgij57/C8m3mv6YhrYK05C/2VD1KL/JToa3dEh7xW mN+l/YHopFyP5J9XsFmQSwJ9GOYkseSbAxRuDdmFcgGQSokPKs91BrElLH04eNhwxMUy JdcZ0ZyAfKlX17GFk11txpnI0MObAucr4aFEect699mu0sVmiMukn0Q2hLYz4TjY428E z6g3tNmooBOdMJTpgAOnNLNC6FmL6iwRUBgp6tNuZi+VTBF1FXm6/mjqu+lmxJzIrGdo JMGg== X-Gm-Message-State: APjAAAUhVO5PAQS37a/IjoPaN2Yc1ipz+LNLbI6F3/mJ+Ey7J2vTaoNK P5+kxCnU9gz8agHoVzQ6YDwkYg== X-Received: by 2002:a2e:86cd:: with SMTP id n13mr3689328ljj.252.1570653718918; Wed, 09 Oct 2019 13:41:58 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id h3sm730871ljf.12.2019.10.09.13.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 13:41:58 -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 v4 bpf-next 14/15] samples/bpf: add sysroot support Date: Wed, 9 Oct 2019 23:41:33 +0300 Message-Id: <20191009204134.26960-15-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> References: <20191009204134.26960-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Basically it only enables that was added by previous couple fixes. Sysroot contains correct libs installed and its headers. Useful when working with NFC or virtual machine. Usage example: clean (on demand) make ARCH=arm -C samples/bpf clean make ARCH=arm -C tools clean make ARCH=arm clean configure and install headers: make ARCH=arm defconfig make ARCH=arm headers_install build samples/bpf: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- samples/bpf/ \ SYSROOT="path/to/sysroot" Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 6b161326ac67..4df11ddb9c75 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -187,6 +187,11 @@ TPROGS_CFLAGS += -I$(srctree)/tools/lib/ TPROGS_CFLAGS += -I$(srctree)/tools/include TPROGS_CFLAGS += -I$(srctree)/tools/perf +ifdef SYSROOT +TPROGS_CFLAGS += --sysroot=$(SYSROOT) +TPROGS_LDFLAGS := -L$(SYSROOT)/usr/lib +endif + TPROGCFLAGS_bpf_load.o += -Wno-unused-variable TPROGS_LDLIBS += $(LIBBPF) -lelf