From patchwork Mon Sep 16 10:54:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173822 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3337720ilq; Mon, 16 Sep 2019 03:54:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7QhEeFiQAf674G+Tq+fVhTngPijNmNttX3C29JXOo9IrJ08DEjct8qDg/S8xXY6pdnVcd X-Received: by 2002:a17:906:e2d8:: with SMTP id gr24mr5801984ejb.55.1568631288149; Mon, 16 Sep 2019 03:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568631288; cv=none; d=google.com; s=arc-20160816; b=hWIE3iHTKbsxfRji5IwONMj3v2yTYkn3G8NyvFcVYdUu4u+LE6Pre57jlMeASnrmwK Pn7voHPJlVWnH6XtW/k8+2FltuLQ1tnTFCHgmRI2oHmn9ou+44PZksk3xUUeYmYnlFT6 j+uXn9lIbabRN2St57xJ4CMVupC2fdTpZquuj3RCclHKjaY7Pw6Q8cjF3jWcH37ooN7s uq6OIfMX0YQPBpsOapcQOI7XYR7EQFUDQbC5krV+W58TgEA8M4Hn/Z5C7RK0CUZrAfst snwFc7XL3AgvsxcYeXcnB7Ju6DouZFni0XBQ7vvcCenKaI3mQI3jIAuGIYoSXY5dlsCb Gf6w== 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=6kzj0QUIRS1sDUroHtM76x4Sw0PaH661mS2z6H9lrYY=; b=t1iVaiISUpBLgCSCoP4iYF3sXBPz2lfDH4HDvlkt31XAEG+tely3xUR1qwUrbZ3NAR EHiCDMwlQxcotO9RfdnuKeChe+VCXzElRZuOQNoKQJ9o22s3c5UEYhsomSN3nD01KB83 zptIxNwNsROMtqb5QH0RlpfFHDPz3DkZrI0POtL5k9d1iJEYPYyfqUvHd8HITGWt8XUQ 8eDWyPpOeTuHYM3vmAWxs/+fdmmqnxjCDdLduxyEoeEHeHtGOvAQAIEDPc8McsndM2Nf bsRe0QGh3tDw3Pch0y6iVLOdCaRYMzWVSOUIy/30oeTtCpTmeD5OMefNkbgcVD466lHS l9ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LYey3wmg; 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 b13si21252224edt.403.2019.09.16.03.54.47; Mon, 16 Sep 2019 03:54:48 -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=LYey3wmg; 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 S1732446AbfIPKyn (ORCPT + 27 others); Mon, 16 Sep 2019 06:54:43 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39210 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbfIPKyn (ORCPT ); Mon, 16 Sep 2019 06:54:43 -0400 Received: by mail-lf1-f65.google.com with SMTP id 72so784265lfh.6 for ; Mon, 16 Sep 2019 03:54:42 -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=6kzj0QUIRS1sDUroHtM76x4Sw0PaH661mS2z6H9lrYY=; b=LYey3wmgdmHy2NTiQkVRdiP/+xWiXr7/VhQu0JvCqcUIAToMMaoYBOM6JFuBqaxkZ1 JfYQeW6MTnVu/A2LKmVE2hLug+wszlySKPK3lLmm5cC6B8YCZTCUrLGdZnxzx1ACnH70 UB4kW6+0PoqV7L3+af21M7FxoqOZMXAUDxZSKtf5Wwlpf/fPZeNLIS3PaJbluIKMIsao zeKD032jBuH34HlHMsQ2ZAaBWHjzEdEuE2cwW2q876Uoe+JjqzWdVvHCsWaR/4ByQm/a uhSDh/DlVgXPaV80sBavReU3gg/Ek+7zUMmJllxUFjANBPZRlVHU2OI0ORj/g+vLAgMn Ac7g== 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=6kzj0QUIRS1sDUroHtM76x4Sw0PaH661mS2z6H9lrYY=; b=rCsTqa2zcgVIs1zPjmlv6Dav0MFqyPA114W18rxcaevt1vmh3ab6bmWXb+8WxERwZx 3ReFMBWWqCIJaUPInKQBUtLcef3xGZFm4q+W2FMjO/fvkCaPtML5xugHAS9xOJ+/hN0E 7XBosrD/MFB/2ttll/ePzcBSRQJL7wR0eSdx+CI4lCOnA57KulOEQv+3XP6oLffpNfL1 2NzbZlxnPVywfVW9k7N6eqNEICGzPcCcCfyDsvkUFmbRvAGjOzRG4Gr7l/0qIm17fLTn P6i1zIRfAndCF5Aa1FRr3iLY8Tdl+4wSbOUy8BHoySMbI0ZBv0OVsFBmcGaBYAYkobqJ O61g== X-Gm-Message-State: APjAAAV/U7/tnd9BmvC/IyhfwdjusQDaQvAoQv1BsWTyTc46Olz4lWlf 4tcBP1L7PBzBJVHGPJjgT8mdNA== X-Received: by 2002:ac2:4ad9:: with SMTP id m25mr11489559lfp.89.1568631281688; Mon, 16 Sep 2019 03:54:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:41 -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 01/14] samples: bpf: makefile: fix HDR_PROBE "echo" Date: Mon, 16 Sep 2019 13:54:20 +0300 Message-Id: <20190916105433.11404-2-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 echo should be replaced with echo -e to handle '\n' correctly, but instead, replace it with printf as some systems can't handle echo -e. 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 1d9be26b4edd..f50ca852c2a8 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -201,7 +201,7 @@ endif # Don't evaluate probes and warnings if we need to run make recursively ifneq ($(src),) -HDR_PROBE := $(shell echo "\#include \n struct list_head { int a; }; int main() { return 0; }" | \ +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) From patchwork Mon Sep 16 10:54:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173823 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3337725ilq; Mon, 16 Sep 2019 03:54:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOsACCCtgvJBZkfBo5TDpS4kpwUJt27X771x9pFH2ORFNHsHoA8NFrNn6kjCihhu7EwaA2 X-Received: by 2002:a05:6402:7d1:: with SMTP id u17mr60843154edy.132.1568631288564; Mon, 16 Sep 2019 03:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568631288; cv=none; d=google.com; s=arc-20160816; b=BvAYKkAGQFCcqSMCG7dCjRmU6u2hp+OUdBYPDhSI5X6ySRTZeAj+eQXo8YZTk3I7/z 9NS0J4mLKfDebsVkrcQwmV7IeT+Khji+voUzu5E2wf0YBM34eIV3tH6LsR5b7y4q3JBu 6fra6vJpjhrb1cYDagQDHI1h1CTtEsx3rZrHWmDE60DHANbt+BmKrHnswHz0gcoXO8Gm NTPpSDtxeEJbystztiFYkoT6gtqZMppvPKza/RBxH1PsowNWq7gcSJ4aYpdM0huZ8Dr1 K3IcPsu3PmrXYzjsMVAFyTYGaXg4tkae616q6hP8YI5LATC/tHCdCHLQXQLy07XTIrEV tlog== 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=myQi7tUoXKWvWu2Otr2cMzZrUikwx9p5w927Z5U7K18=; b=CDMWDVMAyJlPdn0uAN+C8Ywb5SkHuPwNAMZqvU7AgjgPEszJ0z8FkUpFSqRlYEy1a0 K9s1dKF0dRB2kyxdJmKGrcOjKhgETNbGrGxc3C83lrAXCFt3AX8fgIuEfC3sC67kkG+4 QdvRbHBcQSMHLWQHwpsvn1DJca10sp5kvBUFQiUcqeGBOuqlXOGyr6ERd0jd5cApz9c9 /nJ30RlaVYewTtTGVttMKUzLvQue4gMJQSCTsWUE5LoIv6+436vOn8JIdipkUwYNffP1 0BKvww/0dQqCVFJcyC7qk18G7q415tdx7/UmJ4gKiusc3qRdSr5bJtd9B1DrPXJUEvFj //Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zqzL4Jzw; 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 b13si21252224edt.403.2019.09.16.03.54.48; Mon, 16 Sep 2019 03:54:48 -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=zqzL4Jzw; 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 S1732473AbfIPKyq (ORCPT + 27 others); Mon, 16 Sep 2019 06:54:46 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:41129 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732442AbfIPKyo (ORCPT ); Mon, 16 Sep 2019 06:54:44 -0400 Received: by mail-lj1-f193.google.com with SMTP id f5so1272114ljg.8 for ; Mon, 16 Sep 2019 03:54:43 -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=myQi7tUoXKWvWu2Otr2cMzZrUikwx9p5w927Z5U7K18=; b=zqzL4JzwdgYet7wSFB53zjRItWpS1hdeN0ygAfE9AmPl/tgeJ6oyvRLjQXycdwZXvW 0LkJJSRAf4imSOLOE29XGY2MZ3eqllofQcObiDHWP0n70jafz5Etprt2/18so9bAoNTR PAxrU/Zo2hoAsOPF39JndhObn/PUwZAIGsIAbIudvGDm7SINJLoGj6UWh+CSx6AR54CG cqRWHQ/B4qTgGzo7uNYmgSSKMEPe9rgAJFIAtbz5BnbBBB1x1PXd9E9GZFdPz3dzbqwH 8ftOXF8bhIMPmwb3IKjgxhtoyYYyFPxole8xysIfutsFzMyg7yF01NS6KpCla5EtW1LM 4LFw== 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=myQi7tUoXKWvWu2Otr2cMzZrUikwx9p5w927Z5U7K18=; b=FrzUFfLbx6ipIbR4EACKnQQ4UQ0BnqT5QYZdYKgSQdgow9JJEXjkpbGMx3YBby+7ta NTwvMtoZCTQlC3V/Y/ijXqbLXMI1uQe3CE7cSyz+W6lE5ZaIVdrQ/GRtAmFrF3dCZxcm g86fNk6a0xMFaERqabQ0aekVIufhqLxoZL45Zsm7gPloJVD8Bs6jQcmW/+f+0sV7MfbZ WlW5Ia6M/7k2XO68urSOMk9Hob29q9Yz8z2q08U/ScY4RTBoKminhE542h6foyxIH84V 8gIChJwJvZmD/Mji0vh4SY0Ign1hISevuAN6JeGDAs/dv61gghPDrFHJNdEF/qqX+Nz1 BHow== X-Gm-Message-State: APjAAAV7/IKhqPUITUKHhU+x/yUj2D0wCHbs8r7xVJVrKvBM/YacM5Hq 1/+xPnx4dEGEfUYYwyp/bfhZoA== X-Received: by 2002:a2e:b0c2:: with SMTP id g2mr1900577ljl.217.1568631282996; Mon, 16 Sep 2019 03:54:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:42 -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 02/14] samples: bpf: makefile: fix cookie_uid_helper_example obj build Date: Mon, 16 Sep 2019 13:54:21 +0300 Message-Id: <20190916105433.11404-3-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 Don't list userspace "cookie_uid_helper_example" object in list for bpf objects. 'always' target is used for listing bpf programs, but 'cookie_uid_helper_example.o' is a user space ELF file, and covered by rule `per_socket_stats_example`, so shouldn't be in 'always'. Let us remove `always += cookie_uid_helper_example.o`, which avoids breaking cross compilation due to mismatched includes. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 1 - 1 file changed, 1 deletion(-) -- 2.17.1 Acked-by: Andrii Nakryiko diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index f50ca852c2a8..43dee90dffa4 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -145,7 +145,6 @@ always += sampleip_kern.o always += lwt_len_hist_kern.o always += xdp_tx_iptunnel_kern.o always += test_map_in_map_kern.o -always += cookie_uid_helper_example.o always += tcp_synrto_kern.o always += tcp_rwnd_kern.o always += tcp_bufs_kern.o From patchwork Mon Sep 16 10:54:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173833 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3338372ilq; Mon, 16 Sep 2019 03:55:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVKSFabCR6ifEoYQHdrdBtJe7Zax2+yNiTshbbN1FFSJXb2eTPnteckKXc7Odc4aCNste3 X-Received: by 2002:a50:d5c5:: with SMTP id g5mr58222689edj.57.1568631342906; Mon, 16 Sep 2019 03:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568631342; cv=none; d=google.com; s=arc-20160816; b=sglvQF4P+wnc69y4ByC9H7xV3ycQncD2mCD5QCEsTLR+WuqFM49/iDHD/BS4oabaMd UE2S31nineTXQ1oP+JnkEECCRB3bR6XGYgdclWJ5+BH+kFfmXmkypkWZUTEz4ToSODfc NAJ9AGkfwpkMq/E50+KjiCSO9HOr/+EvV8bNbP06p22fJyYuFD5BOWcOv16EQnIRYnhB MVtFcikaJzMj7j6FubHqutLvAtVo0K0t999oPR2xw0W77ls1qb/wz++EN/iVfIycVyRc vfXGFfIlP8MZBBAZysJ00hiBqhwDSDxYpiXujDhYeC/d2AuW3MMSNmAkE3IKje5jC45Q 23nw== 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=H+Oq4KltqpOb9wzu+L9OzY4bSDO7cEMe/MUjYdSZoPU=; b=RdKE+ZvDUSQJdKvXJn6D+qF6KgXsBUG91dbTs6YxBSjSgCDgfry37x5736Pi3GwsAa 5aKWUSJnvK0gh/iGsd3txhOTwuI0oFfU0lVi0JdNKaMwfUr+JsHc2OZBH13P576OrqZx lpDPjvT9C+5k8gRHWekpaRJUvN19ba385deisL7JyJmC3EbhB1bC8avxItZcaopr81/I OCKINxndLI4uR7xcH3G8wV+uy7VBht8xBRydmETPqS8nJmqM0EI/drVI7MphR+cvxJDu 8QRdaL12ACjr/DLQvtvteMtmlSpCABakEJfWRuQaqNmtTibd1z/b8J714/uG2jNnzZQI Yyvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UrB84xhN; 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 c8si22887515edb.82.2019.09.16.03.55.42; Mon, 16 Sep 2019 03:55:42 -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=UrB84xhN; 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 S1732518AbfIPKyw (ORCPT + 27 others); Mon, 16 Sep 2019 06:54:52 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45316 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732442AbfIPKyt (ORCPT ); Mon, 16 Sep 2019 06:54:49 -0400 Received: by mail-lj1-f196.google.com with SMTP id q64so22747244ljb.12 for ; Mon, 16 Sep 2019 03:54:47 -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=H+Oq4KltqpOb9wzu+L9OzY4bSDO7cEMe/MUjYdSZoPU=; b=UrB84xhNOOGhDmRHN4tEy21BxZte/v8W4CZVHuwaeoMKZensFssyvROhnk9udXZAWz JReS0yZSuYH5mPKKBCWNIaMerRcfSF+DPnCTQVKPlPwrFyp5Oe8NoO4Y9InriRYX05eg QrgslNhgph2Jw9DXJ5YHj96hldOtquP1+z33zTZKJDg+32Gxz59xznVRAdUl+l7//C2/ eatPjrGBSFUM3gi0Ov7oJ1/yjdBVMoMGc38yUqD6zyZH446H0JDswC/cboiHLROsjxj2 MaiWKvwY0xGH+DLg6A40H0Ta+e6uQZ9fGECdAQkuo2REdw7Cn/aEzLOnuAzM66wputxt 6IAA== 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=H+Oq4KltqpOb9wzu+L9OzY4bSDO7cEMe/MUjYdSZoPU=; b=qrTRcUTNyugU7BGR/Xj1K5YuGurvE3dKjGidZicKTXN22uDbcIonmru49oC+Fh0B/d 9dborPT4SKq9HAAMrOEuexcb0xOXiXv9atP71v8pF6R/sVN1HEahxnpPDk6JKWivEuI1 7DzTcVfhfidslOjnQWuMH1P35shnVAZZebENPeLB9JEQvfImfimwxaQUmjxLDvZQSli4 iJtHtpMFjDhu7l0I105kW/GbZsdD8So3/dXhYMUirPm8Bai7xvKeN6J3wxWJcirYR/SM PfHriaS54RI23xQ4Z7dcXHzFm4YfMM5JuGhZpeKx2rmKBc/4EPdFAxrqJdn1WCYdacq5 Hnog== X-Gm-Message-State: APjAAAWQSx5GmX4kMwFA+f+8UK2EAc3NvHYsJ5iVKljbn7iQseXaBImR fzsUyAdhmpnvOKSapGqop0Sq4Q== X-Received: by 2002:a2e:2bdb:: with SMTP id r88mr36236050ljr.82.1568631286844; Mon, 16 Sep 2019 03:54:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:46 -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 05/14] samples: bpf: makefile: use __LINUX_ARM_ARCH__ selector for arm Date: Mon, 16 Sep 2019 13:54:24 +0300 Message-Id: <20190916105433.11404-6-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 For arm, -D__LINUX_ARM_ARCH__=X is min version used as instruction set selector and is absolutely required while parsing some parts of headers. It's present in KBUILD_CFLAGS but not in autoconf.h, so let's retrieve it from and add to programs cflags. In another case errors like "SMP is not supported" for armv7 and bunch of other errors are issued resulting to incorrect final object. --- samples/bpf/Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 8ecc5d0c2d5b..d3c8db3df560 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -185,6 +185,16 @@ 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 = $(shell echo "$(KBUILD_CFLAGS) " | \ + sed 's/[[:blank:]]/\n/g' | sed '/^-D__LINUX_ARM_ARCH__/!d') + +CLANG_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) +KBUILD_HOSTCFLAGS := $(ARM_ARCH_SELECTOR) +endif + # 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 From patchwork Mon Sep 16 10:54:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173834 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3338396ilq; Mon, 16 Sep 2019 03:55:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTkGPKEe6nm8XCYA5RIfjwfeJwIpTEyKvFBW8md4l0oh6egsVCxLNujiWwrfCXCZGvcqkz X-Received: by 2002:a17:906:5214:: with SMTP id g20mr49874121ejm.220.1568631344860; Mon, 16 Sep 2019 03:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568631344; cv=none; d=google.com; s=arc-20160816; b=qT6JbZNVFupHSokuJRGdmUJolIC8NmPmVspDuP4EOlLzBSJ7P7PE01BB0qLDq/AJg2 cZpN9eDRZ+LZEnn3IHc+1dTSziYIskxQfQ2joSPhy/HUrm2tpt0d2drcUc/7e8Qmlmoh Ax7fDEHWdCpnPXj3DmazlU9gM2ZkFAAg7s9doERIH6x18r2zIP7xEyzvvELI+Dj38YpZ KB+OqoeS5LqCcSb0yvRl8mf8i7EfiPgxeJS2O8/KUiA6F4ZWIYHMwhHG7ESlDgnp4SEj 8arx0k6GTVRLGsWJ/8Lu6T9MwgUJEiHeIBQmnzK9vtHlnGAnBnKxXjK76rCx/uqs67Bd 43Ig== 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=ICv/vY4XAwe136r6/MDdnRXmmJJ1JFeohZKBWO948JI=; b=Mm6YL9udckYyLwUd+/U2Be26ui/cSghk1vnjImkVV2M2oIKmKl9fMfvMLOFcpVY3hT PlXSKV6Xb71kafRPjMAYRXbXE6aBDQ8c36H3zNwG6aMTIJyO7TmRTZiXIiXsqD7/0qh9 9ysFb80h9FnwWvXBugECBGc4y+EKHceOr4lFlAH5mFO9LHC+6bDj2CKISC5S9CDE8+D4 cK/WDPok0Zy4D+1uTjWHVqFrtglJoUk3FbZfhtmjI8fa20LpU/2El59r9vPk5p8thTGH jG4Dk/UxBp8ebqA/HFV+bVSvDWI9G6jsqRFXPZcerI7hpEzUQxqN05/EduTafFH5fNwX KiaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=renlPhv6; 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 d1si822912edr.446.2019.09.16.03.55.44; Mon, 16 Sep 2019 03:55:44 -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=renlPhv6; 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 S1732696AbfIPKzn (ORCPT + 27 others); Mon, 16 Sep 2019 06:55:43 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36827 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732499AbfIPKyw (ORCPT ); Mon, 16 Sep 2019 06:54:52 -0400 Received: by mail-lj1-f194.google.com with SMTP id v24so5649636ljj.3 for ; Mon, 16 Sep 2019 03:54:48 -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=ICv/vY4XAwe136r6/MDdnRXmmJJ1JFeohZKBWO948JI=; b=renlPhv6Vx5CNHYksA5WzO20FVIYXEGpjJn5/YGtCgnC0BCwjUvLBlAbeS2QWSwpah jcbI6KeCWf9WpTaXKqzoATiWjCG2prOysrOtXjGAuLCXoTntdh4Qt/9m80BBL8QN4pzD XadY611DPWHua3DwZGOlRJTNUpZN6TrPk0Qwv6sDmublMKNGDX/eMekRKEEMHAPLynHN 5myrlSfFkSMecyixXnfJtcPFSkWkbeUOkkzmZn0e084lNX5MEANYr1m0mJB052RjofTA cKvGdlGjvGxXUcAUQef27FEQY1g72gk+N/QCID6XsEJxukpv5MfPHG1nANwRFzRONI4R ysPQ== 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=ICv/vY4XAwe136r6/MDdnRXmmJJ1JFeohZKBWO948JI=; b=SEKVvt9PVIjrOJ0euzxr6AA9sW5LBudLqJfCGUXrMjHFxjuc+1d0mNLz7NUsTMKX9z rZw29NTVawUhd4LWUhpA5rY/BPesep3PZHPe3QPa7+IGQJsbur9gwzdAPB4j64+/uM+/ CKVPBep9Ba4SHtLfLpy2NsmI5NC8dqTjrJdbw/uHqYvEvUaI5WgO9219m8DLDw4VaNbw xt6dFCq9jI01hZRUFmZJOBm/w2DCWwAyNQ0ZypZKjEkNQn3jB4yaXEySJIh4FjhsY8aj gbvWn25aX2IGV+o+yKH9AsDC7UpetDxWo8p9Mb08W1/6MicS7Q2lpXFzoeCO3RnkAiOT ajTg== X-Gm-Message-State: APjAAAVox9371/gw1khg1aZdszBNOz4IAtcrrOHr97yeij/sse/tzq9R 1P6d62Fcwx3WPWDmMSmLoJODeQ== X-Received: by 2002:a2e:9881:: with SMTP id b1mr19271028ljj.134.1568631288103; Mon, 16 Sep 2019 03:54:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:47 -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 06/14] samples: bpf: makefile: drop unnecessarily inclusion for bpf_load Date: Mon, 16 Sep 2019 13:54:25 +0300 Message-Id: <20190916105433.11404-7-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 Drop inclusion for bpf_load -I$(objtree)/usr/include as it is included for all objects anyway, with above line: KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include 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 d3c8db3df560..9d923546e087 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -176,7 +176,7 @@ 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 += -I$(objtree)/usr/include -Wno-unused-variable +HOSTCFLAGS_bpf_load.o += -Wno-unused-variable KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf HOSTLDLIBS_tracex4 += -lrt From patchwork Mon Sep 16 10:54:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173825 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3337804ilq; Mon, 16 Sep 2019 03:54:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXsFoJUh4NKOxgurEZ8IPyRIM/jUTWJiPsOf9lXlh0UkHaoVV13rBWXGTi2/yvWNEbPAJl X-Received: by 2002:a50:a8a2:: with SMTP id k31mr22484861edc.79.1568631295298; Mon, 16 Sep 2019 03:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568631295; cv=none; d=google.com; s=arc-20160816; b=nt9nEVzGDGgee3CyHrVQZ1fh2WRpGgQFSd+qGvXCQ9+tymFBi3lHOJ5aV/Kym8DA8B e0qtoZCHuu6NVlx3zZJ3AJAqTijSSHdPu5RoiuIwvt2AvNtI5IWtdqzUD+ETmSG3fo+h XStIQEiTHBkBQyG3AqwXGoxsCic6t7khDlQKPiqNy7jwiYpD3RBokPMUt+ZWM/XcLmXu +H9tvc2Y8Yg3svyIr3YuJU0q5MhGIryjli4jjgy/XLO8At7jfFtsdFXuGJaRlq2N0xDk ohdFH30CHayicAGuQXE79+tvJrgg+CUZqX2QMR8Z9moVLzVk7I9U2n5RERgaJhHg7nui p3Ww== 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=qALJbnp9FTLPJAoGDKJIaiGyevgs6xsdVhuDmgFkzac=; b=j8n1ss832Jj3vNwoPRlBLkKdM63p4eqVCpyyOaRkciXi36Mg/yjrY+2PPNjXlQf9rs WWEInSygd944ODvMRpa1fjypRm56qV867aDdDzP4VIdkkt3Tqolmfu2Smi6Z/tFffzKh ZJc7bKiX5daCh50U7rWE3kR8VKEfHL++N/wwSWZsbeBBAorhfnOcYRCbmEnc1bb54mYR MCXJ5c7FkW72iYH2FiC7mVmRCve1hO3BgTU+d6NSIyLnLKgIn7ntvni7xfSUahIoKMpG KiZseNLDBgKUQ2m3/jimq/vm0ctSVU0j4mqhGjL79vm79Yo9RzCJTzYO5novX/hQW/Xt F/3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tp5OvP8r; 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 j46si21629887eda.9.2019.09.16.03.54.55; Mon, 16 Sep 2019 03:54:55 -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=Tp5OvP8r; 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 S1732534AbfIPKyx (ORCPT + 27 others); Mon, 16 Sep 2019 06:54:53 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40615 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfIPKyw (ORCPT ); Mon, 16 Sep 2019 06:54:52 -0400 Received: by mail-lf1-f66.google.com with SMTP id d17so9214673lfa.7 for ; Mon, 16 Sep 2019 03:54:50 -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=qALJbnp9FTLPJAoGDKJIaiGyevgs6xsdVhuDmgFkzac=; b=Tp5OvP8rCaZb13D4ww3vj2mw2PWVAqGybOa6fUs/oIVw5T7/73Nqpmo57DltCqgBmW W/9ysUCIVjTtDUmMneoWsxRoIIm7/1ZmqNsLJ+HjEvvkOOIiQYjOkchVu5eqKs/Mqt1X VjfxITukqZHlV1t0Rqp7NNolwQVY8JYuqJ9aTg8QvAEanrhVhyRBlUtWCC2xv0LResJy TDMAy3NvtfKh5oTRrkwcPoMTpDX87g8TjD24bYIbVovX1/Wj9J6d5+Ri38Y1b0NWoLst CHjgzSYJCQAkhWGFdxr3rIBRjCkEgXHxMGQFp+nj7h4J2kMn6KpOxmGFCXE87IoRKeWc 23Kg== 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=qALJbnp9FTLPJAoGDKJIaiGyevgs6xsdVhuDmgFkzac=; b=YbK/e6f0g/AZsWZdtafHBkkSjnPoTUsr+oEvo/rF8e7J8f5tjfymiHyDIUroHVD7EM PIXZq7iEgx2TwloyIR3M/4Ralnql3NnDUwBIgOy1fMg2vipCK90nkzMeyOUoI8OHFx9b 8Jw285uGCLnjFi4tuGn31Enp8riPuBep74V3cdfbm3AzJcOFD9cUj4ZBV+lyDdmU5sJo hCapusLW4A9XTsT1ZYRDYR575lbOLmaGG63HqPTsdWOZGhfIx6+jeMgE2iKGU2hZ2l5Z TRqdE+3RqpsCedOrXa5Hukps1WdWbBMGmHU9kFZlPf9TNKYo3ag3QQ2b07jxnieKnnqN oCoA== X-Gm-Message-State: APjAAAWBxwnSzKeOoztWNaYgmCn/n2ViE7hfg242jd7+Nqt3ySggBaH+ M2J2vrxrAc4WHZvLboeRk/Pg4g== X-Received: by 2002:ac2:5451:: with SMTP id d17mr37030113lfn.77.1568631289427; Mon, 16 Sep 2019 03:54:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:48 -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 07/14] samples: bpf: add makefile.target for separate CC target build Date: Mon, 16 Sep 2019 13:54:26 +0300 Message-Id: <20190916105433.11404-8-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 The makefile.target is added only and will be used in sample/bpf/Makefile later in order to switch cross-compiling on CC from HOSTCC environment. The HOSTCC is supposed to build binaries and tools running on the host afterwards, in order to simplify build or so, like "fixdep" or else. In case of cross compiling "fixdep" is executed on host when the rest samples should run on target arch. In order to build binaries for target arch with CC and tools running on host with HOSTCC, lets add Makefile.target for simplicity, having definition and routines similar to ones, used in script/Makefile.host. This allows later add cross-compilation to samples/bpf with minimum changes. The tprog stands for target programs built with CC. Makefile.target contains only stuff needed for samples/bpf, potentially can be reused later and now needed only for unblocking tricky samples/bpf cross compilation. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile.target | 75 +++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 samples/bpf/Makefile.target -- 2.17.1 diff --git a/samples/bpf/Makefile.target b/samples/bpf/Makefile.target new file mode 100644 index 000000000000..fb6de63f7d2f --- /dev/null +++ b/samples/bpf/Makefile.target @@ -0,0 +1,75 @@ +# SPDX-License-Identifier: GPL-2.0 +# ========================================================================== +# Building binaries on the host system +# Binaries are not used during the compilation of the kernel, and intendent +# to be build for target board, target board can be host ofc. Added to build +# binaries to run not on host system. +# +# Sample syntax (see Documentation/kbuild/makefiles.rst for reference) +# tprogs-y := xsk_example +# Will compile xdpsock_example.c and create an executable named xsk_example +# +# tprogs-y := xdpsock +# xdpsock-objs := xdpsock_1.o xdpsock_2.o +# Will compile xdpsock_1.c and xdpsock_2.c, and then link the executable +# xdpsock, based on xdpsock_1.o and xdpsock_2.o +# +# Inherited from scripts/Makefile.host +# +__tprogs := $(sort $(tprogs-y)) + +# C code +# Executables compiled from a single .c file +tprog-csingle := $(foreach m,$(__tprogs), \ + $(if $($(m)-objs),,$(m))) + +# C executables linked based on several .o files +tprog-cmulti := $(foreach m,$(__tprogs),\ + $(if $($(m)-objs),$(m))) + +# Object (.o) files compiled from .c files +tprog-cobjs := $(sort $(foreach m,$(__tprogs),$($(m)-objs))) + +tprog-csingle := $(addprefix $(obj)/,$(tprog-csingle)) +tprog-cmulti := $(addprefix $(obj)/,$(tprog-cmulti)) +tprog-cobjs := $(addprefix $(obj)/,$(tprog-cobjs)) + +##### +# Handle options to gcc. Support building with separate output directory + +_tprogc_flags = $(TPROGS_CFLAGS) \ + $(TPROGCFLAGS_$(basetarget).o) + +# $(objtree)/$(obj) for including generated headers from checkin source files +ifeq ($(KBUILD_EXTMOD),) +ifdef building_out_of_srctree +_tprogc_flags += -I $(objtree)/$(obj) +endif +endif + +tprogc_flags = -Wp,-MD,$(depfile) $(_tprogc_flags) + +# Create executable from a single .c file +# tprog-csingle -> Executable +quiet_cmd_tprog-csingle = CC $@ + cmd_tprog-csingle = $(CC) $(tprogc_flags) $(TPROGS_LDFLAGS) -o $@ $< \ + $(TPROGS_LDLIBS) $(TPROGLDLIBS_$(@F)) +$(tprog-csingle): $(obj)/%: $(src)/%.c FORCE + $(call if_changed_dep,tprog-csingle) + +# Link an executable based on list of .o files, all plain c +# tprog-cmulti -> executable +quiet_cmd_tprog-cmulti = LD $@ + cmd_tprog-cmulti = $(CC) $(tprogc_flags) $(TPROGS_LDFLAGS) -o $@ \ + $(addprefix $(obj)/,$($(@F)-objs)) \ + $(TPROGS_LDLIBS) $(TPROGLDLIBS_$(@F)) +$(tprog-cmulti): $(tprog-cobjs) FORCE + $(call if_changed,tprog-cmulti) +$(call multi_depend, $(tprog-cmulti), , -objs) + +# Create .o file from a single .c file +# tprog-cobjs -> .o +quiet_cmd_tprog-cobjs = CC $@ + cmd_tprog-cobjs = $(CC) $(tprogc_flags) -c -o $@ $< +$(tprog-cobjs): $(obj)/%.o: $(src)/%.c FORCE + $(call if_changed_dep,tprog-cobjs) From patchwork Mon Sep 16 10:54:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173832 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3338203ilq; Mon, 16 Sep 2019 03:55:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxs5/7WZsSQtxQYBTp/3vn1dIeVNWdGO7h2aRPt6JCjBgShzW+bnGmDIAtX9BugLPab9yzx X-Received: by 2002:a17:906:4cca:: with SMTP id q10mr19477040ejt.236.1568631327625; Mon, 16 Sep 2019 03:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568631327; cv=none; d=google.com; s=arc-20160816; b=qU/67NJjLjL74JZnLQAWw4vVhP9ulrRq7pUWvVoDfDiQb1Gdl5xN9sk0hBcXexhv0v ce8OIGHLxmpvAOrI25uvwhGgaLUcgpIw3eJrC4YRInnYE0gxFFEfhT6E9N1sCn8xbT9u k9QXOf6eEoLBl81Z0bdlEdAzHax9JT/F3J53ayz6hFd69Q5jsRXBszugLMNqFopMKlzJ Ws+GM2YgHBUW/4RoKyP8KjWj8LsPNs55UQ1lT0z1olDlTn2tPaaF6kmRTVFRq5BtSTkl GOnOCnr/RTIEpqN3Z1U5lHZeZFaSUKgQH2PeGC3ZDhpYaGjHzcEbD64jAU55rnHktbaF 6Aeg== 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=MLJcNNJZkagwGK0zIyaqmigCmuc2QO9sJ0CkQCG94a8=; b=Dit2vlqzdQsenms8D1S/4A2TGKXm3Iah+azCTxgzXuM0/T4M0BHhFKwQ43Ki4QHQvM Ipu6uwanuCyKvdyS2P0QW0OgQiuPD39LtU5Ca8iwK7cuz4xyQSROiXFxAIsVpLKq5mv/ hieZKYlJ4HfpZ9O3R8+qL5rOmQ4GHdPu3Cmx2fU/PtpHdCehajT99ErGxqXLd5B3VojX QVXxpfMLb3anIOoOlN/8Ge9LxPqTMxoqQaXbQjBJSberaifDksNgwsjdUrYnCbu9L7Si va8xraVs9EHfJDB8H241qUpw2RoEuMeqrgyyHfczmVpbDbmoMEwyN8BO8AHdbVnUfXSW fvgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E9WHFu0T; 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 m6si20600239edv.288.2019.09.16.03.55.27; Mon, 16 Sep 2019 03:55:27 -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=E9WHFu0T; 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 S1732656AbfIPKzY (ORCPT + 27 others); Mon, 16 Sep 2019 06:55:24 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:33541 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732547AbfIPKy4 (ORCPT ); Mon, 16 Sep 2019 06:54:56 -0400 Received: by mail-lj1-f196.google.com with SMTP id a22so33277842ljd.0 for ; Mon, 16 Sep 2019 03:54:55 -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=MLJcNNJZkagwGK0zIyaqmigCmuc2QO9sJ0CkQCG94a8=; b=E9WHFu0TVM9YPIg7e9FZQRJiw7GUUX46qDnJ7XJhp3tzqNkGIEkdZ/VfJkd5CiXCIu soL1+mGe5drovecAMdpE93IRIhgR5mqv5Inm7FMZtz3sR+ufpAD/Vj+CYguj9jaX979F eFqpi/6RF90/XKCxiwnqHbTubyY2+/Q2q7UmsEzAUVdYX0iubLOvOOMtNb6rLhLftlI8 LGDNDWirLx7qPTGiEj+xYJs+l+TAonQmkRLwyJcjWSOCrpnM1a9qakwXyDalWaCOcOpj avbgMt/cu6EWydrCF+LYQy6vWHBc6xfHcI6HCINSXEg03CYbhAha+4hat/DwPB08BSH0 IXoQ== 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=MLJcNNJZkagwGK0zIyaqmigCmuc2QO9sJ0CkQCG94a8=; b=ixgkfsE1g5RJNWxjTltbkwxOr/hsB9566bs0uEt1MHmsEXgTnVIZogiqTnSbExnGvW wB22/PZNbGTI2zXB4P8yp6/iTC4mm99d8g0Y8o+7MQt2xGC+oRRg/v4iFmCLER5Hpt1a 0Cy2QCoHUpJC7zJJODSHFHt5C+fvHCVI0LH0Z6oN5Bm0VV6RhjtR6iFZ7lIXptabBklC vuoPhz6uX0Aw3/JsnmZra/I11xeLmqRr2cTIHUt6SZZY8m7uDC6dpcGAbOH6mkEu7Dsi 6UVw4Ze0j9NPAUArO5B858buyjR1+fB9oX1VDK18hyGD2YK4p4+0mRpRZpT/7sJMQ/vs 1M7w== X-Gm-Message-State: APjAAAU/khHl0nLWuGTcCg7Xqy+jYcAP0byAizMHOhIVADChJBVmBg7/ LjgqWLCszfKikdEdL5L+CiU6WA== X-Received: by 2002:a2e:9f17:: with SMTP id u23mr2122827ljk.241.1568631294682; Mon, 16 Sep 2019 03:54:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:54 -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 11/14] libbpf: makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets Date: Mon, 16 Sep 2019 13:54:30 +0300 Message-Id: <20190916105433.11404-12-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 case of LDFLAGS and EXTRA_CC/CXX flags there is no way to pass them correctly to build command, for instance when --sysroot is used or external libraries are used, like -lelf, wich can be absent in toolchain. This can be used for samples/bpf cross-compiling allowing to get elf lib from sysroot. Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index c6f94cffe06e..bccfa556ef4e 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -94,6 +94,10 @@ else CFLAGS := -g -Wall endif +ifdef EXTRA_CXXFLAGS + CXXFLAGS := $(EXTRA_CXXFLAGS) +endif + ifeq ($(feature-libelf-mmap), 1) override CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT endif @@ -176,8 +180,9 @@ $(BPF_IN): force elfdep bpfdep $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) $(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN) - $(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \ - -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@ + $(QUIET_LINK)$(CC) $(LDFLAGS) \ + --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \ + -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@ @ln -sf $(@F) $(OUTPUT)libbpf.so @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION) @@ -185,7 +190,7 @@ $(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 $@ + $(QUIET_LINK)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $^ -lelf -o $@ $(OUTPUT)libbpf.pc: $(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \ 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__) From patchwork Mon Sep 16 10:54:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173831 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3338140ilq; Mon, 16 Sep 2019 03:55:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyE4xm76t53UG2w5hIXSWYWb15IpdOZ6RHoJ1EnedR3Nue4gYFIul/CP9LATTX+RSU8nPSs X-Received: by 2002:a50:ee92:: with SMTP id f18mr39300417edr.253.1568631321153; Mon, 16 Sep 2019 03:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568631321; cv=none; d=google.com; s=arc-20160816; b=RUbPTYSS7Cqh6NjE70jfdeT22IWSsf26pDoVpTZzOH5rmOhZySagmVt6mSIahyfqTn qwYpQfVWY1Ch+biv3yCYMdEGR3If3kTjtaLSLjXBsRb25CXN0GSMeFq/qJMGORaZUu8R a1SgBJpxkGIpYOjuZkg+jIQHt7jDyJkMUSWzNgckbZU8wwKtx8A7bdNEpMrlbP2iEUKK n2Wp222EW+iwA9pdVbQnja1buywhiLI4Emjsg1u3T9eeHfQThifo2pjDiwQcHfZtCiCJ lKPAU3C7pOxIHZk3q21XZsoa8eqh+QF2G3qtVuIq8gFw7xkwLhpTZTCoP0X4nJ/PwtVZ Z7EA== 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=L1rbvOW+wQJfkI127ZZlgGnuYj2RYmEzxNGLFnF8DNQ=; b=xeQlOEaVATvdvaZBehdD2mbgSvUG+/WtvRvgLw7cpzsrgJK/HoqyQULxVI+3S9Cbp3 lZh42h+SXqXuh9FqZZwnnVlunMXuRgA0zEGve3caVV3gC/ixoXbulyRnipH9Xyt57C5m EUmkCFLbKz/1OauLUri6HOXcfOwTq4tVcpg7Hv6sr28rE5JmNYRGlYMzFb7BJWqbdnAN LMOtlbnVPgBJxJnBzjDlX3NO1Jf11XIB2JfZ4t3LcyOBNWeND4J/Y2QjzCj0MmOvM5zb qFkTokaKARlPAyc9hlO8gS432LlOd2YMb4d02ihdmAtRAW6FQGzGjtTErIhZAvT83HAu 4d6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o+zzeQpt; 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 c14si24476548eda.8.2019.09.16.03.55.20; Mon, 16 Sep 2019 03:55:21 -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=o+zzeQpt; 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 S1732642AbfIPKzS (ORCPT + 27 others); Mon, 16 Sep 2019 06:55:18 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:33863 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732583AbfIPKzA (ORCPT ); Mon, 16 Sep 2019 06:55:00 -0400 Received: by mail-lf1-f68.google.com with SMTP id r22so15775518lfm.1 for ; Mon, 16 Sep 2019 03:54:57 -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=L1rbvOW+wQJfkI127ZZlgGnuYj2RYmEzxNGLFnF8DNQ=; b=o+zzeQpt0mAYpx6mc2RIjYCWYyOjhTHqnHHulW/RKWFhLKUdVgrqTTPr3iHy5E374v gG4cPe1wWsiBBnufog5HnjOQF5rH/3ruhSqJGzFNCB3Tx7RBfcMe458xx/vcOVqdU4ts H/5JFK4Mt4r8nE+O035eNaJztJhlPuKngB+tr//LANN79yG1GKmd28Rk5SiJlpiZykoJ V2B4/S10B+jsSXXcJqch1uNJyQ2ORizv9Nrw2rUMutmDleyxOSRakaDYiVvDKRcMHhej Po+om1loSyc7BuoEjEhiDxDFLDwFH2Zx5+OY39T98MmR5JOB2iRCiX+TxdT2sBk1zq5o cVYQ== 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=L1rbvOW+wQJfkI127ZZlgGnuYj2RYmEzxNGLFnF8DNQ=; b=OLzmxERlDcDsbeC7i8f8ZjSofP+e562wb8J+fiTU0xMZHO4xvIch4B1TivUYLHj4Pw bQIbb6gWM8lFGF0MTHuRv52C0NId7fh9CRtEEo64uDMTp08ptzf71sRHUGzXoviU7uTj cwFY0FmywPmoZLnszEfUq9lVPvLd/HMGW7fERfWVPeGwDP4aHfx0B1JrqZlYTAyzpNtc 03uvS2UEDOxYTrfHbmF9uRpeEAJo6EUPuKp6N0dtA7hpuIt4J+aHQweMAgUBENGb8/4C ngLk6XEqqqxntiHYhGlO4Ga63tLzGDq10ey12KpGyLNT2uVdlv77A2lMGi467JEqzsi2 FTkQ== X-Gm-Message-State: APjAAAUVb5SxED9sjUurXf9wVLENk8xc+goL1fMFt+hFV+e6gerH43Al UpFUauqWFIIevG6JgzP9NJ2+bw== X-Received: by 2002:a05:6512:251:: with SMTP id b17mr16802393lfo.35.1568631297220; Mon, 16 Sep 2019 03:54:57 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:56 -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 13/14] samples: bpf: makefile: add sysroot support Date: Mon, 16 Sep 2019 13:54:32 +0300 Message-Id: <20190916105433.11404-14-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 Basically it only enables that was added by previous couple fixes. Sysroot contains correct libs installed and its headers ofc. Useful when working with NFC or virtual machine. Usage: 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 133123d4c7d7..57ddf055d6c3 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -194,6 +194,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 + EXTRA_CXXFLAGS := $(TPROGS_CFLAGS) # options not valid for C++ From patchwork Mon Sep 16 10:54: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: 173830 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3337956ilq; Mon, 16 Sep 2019 03:55:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxN4FJlZa3p/4D0A/zxhSPoB8Q9iGJgcGxZNYakuda5IIGxU6Y6NE+5Kq5FWL+oxG6arvmG X-Received: by 2002:a05:6402:17aa:: with SMTP id j10mr60395769edy.222.1568631306546; 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=Uu253/tAIuY9wzc1g4+Qzik8BBKaJweWgbWJ6iEwMFFtCcm/9FKqil61+iniMCMsmS jemCwrKrbkZ51aXfBjba7R/4+PAeBMxxMgH6VYfDKBeZ6JgiDCvleUHY0DZeqhhXfM7R ziSVXlC96U+d5GgpJRRJNB4ksVEnZAfPkCs0nRYQLN+DHldP9qt9oQVwG9vTjM65ZDEG xCLFXyvoTAWxyv3KQm5f3ekq1G4dlSLlAkPbT8k0/ZLTVnoJgBk5WqWDm3h0UVSylFX/ uMNngDeJws5G043Q7RYcXq7FaWLnQRmaUBaAApzut9iQfrCXP5tGQmCAgMw10C9dfRgz 5lVA== 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=sLN8PEIzdXJ4vyRQJpg4LVfYYRixS2x0Ts7jhtzHOWM=; b=LUgSpqWmWMGbVNtTvqbTG4dGDXKEr0O8B1lwIke41vemh7bC6TuH6EbW+g0fvwE0j0 Qa2ZT1lLv2uAm3QNY8gjDtXQaS0l1mp8sxHyRkX6sJO943ThUztMk5eX4jseRQ+riUDh 8iHtKXcotkDzm73EYCb9c56JEJv34JrC5x4xeg+0yX3rs7SB5YSvijhBbk97f1/D8isK Qjv2Gjg5+41xPPT0cceXzwUb+LJkh09rdMTjmeG+oWJgv/1rtt7Jko8VxZVdfDXPy4MZ e5ipHOSyC7Se+gfa1TjiBiK85q7qFR8NbTA2k3NIhv//GcQzzY3YHvOlCUUyxh8cd+Wq bwlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MhheypW2; 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.06; 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=MhheypW2; 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 S1732623AbfIPKzE (ORCPT + 27 others); Mon, 16 Sep 2019 06:55:04 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:34920 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732586AbfIPKzB (ORCPT ); Mon, 16 Sep 2019 06:55:01 -0400 Received: by mail-lf1-f67.google.com with SMTP id w6so27101470lfl.2 for ; Mon, 16 Sep 2019 03:54: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=sLN8PEIzdXJ4vyRQJpg4LVfYYRixS2x0Ts7jhtzHOWM=; b=MhheypW2XDysOKktHNsxSG7LxAVuj81gvn1nIXQCjY3ZjEOWVw64CWPx+TsC7e8i/L N3aTKRxdyURBfnZY8cnxzthB0q06sfJEdgrJndGnTTm5DkQ05sqC18szpQVvwPI205JM FD5UbVZfrw17pax6P2aNxvYr0kPjRThua9mL+vYGNNZLqWM5aAc2R1FBXyERvpvxhH9Y sO3McigyojSgOHI03jFVLTIjTnYlbMcahGt86azSZyWWNsHChJFWikNBqpHmK10qnbhD MUjWVDOpY59AA0cDjDtsDASxXF5BF6kAI1VLiq/RWUSorKaA/C3Pq9jt+rQKiEq3xjlk 8fRA== 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=sLN8PEIzdXJ4vyRQJpg4LVfYYRixS2x0Ts7jhtzHOWM=; b=XzZtM3yuX5so8aNSRkfwPhcRbeaWN6lPWmFK3ux3getfjjIU1ibXKkKQOZ5THCcssH n4gpslaFEj2gb3eCgbYyGenrE54MHcVBnQ320LleCQxzvPXP1EbkjmUfu3k3mLsIxC3p P01Q9cqKNF1n70OBxWzhaloSrQ5PbSh11z2jWsnQ1x4S0NczuCVoIm+8Erf/86JWbNEW vaWolduI6AIhuEBCcdv7lR9Lm1hoRs7yggVtexkF8TQSiv+88l5pXF50fL/GU92Roez4 RZE8VrUgDz0ip4rtYc2dEGFsIo0UbzMvyqAE3B9DGZxRE3bCzQWmiIwwDa/vxk04XqCt vHgA== X-Gm-Message-State: APjAAAWnHh/VqtB92/Tg0dqAs8An/FUKtoVkC7UkDtTkYdGSVIlURpgs pWWjy92tQ/4SVPXUZojqf7NRAA== X-Received: by 2002:a19:4f5a:: with SMTP id a26mr37493210lfk.116.1568631298482; Mon, 16 Sep 2019 03:54: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 v1sm8987737lfq.89.2019.09.16.03.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:57 -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 14/14] samples: bpf: README: add preparation steps and sysroot info Date: Mon, 16 Sep 2019 13:54:33 +0300 Message-Id: <20190916105433.11404-15-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 Add couple preparation steps: clean and configuration. Also add newly added sysroot support info to cross-compile section. --- samples/bpf/README.rst | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/samples/bpf/README.rst b/samples/bpf/README.rst index 5f27e4faca50..d5845d73ab7d 100644 --- a/samples/bpf/README.rst +++ b/samples/bpf/README.rst @@ -14,6 +14,20 @@ Compiling requires having installed: Note that LLVM's tool 'llc' must support target 'bpf', list version and supported targets with command: ``llc --version`` +Clean and configuration +----------------------- + +It can be needed to clean tools, samples or kernel before trying new arch or +after some changes (on demand):: + + make -C tools clean + make -C samples/bpf clean + make clean + +Configure kernel, defconfig for instance:: + + make defconfig + Kernel headers -------------- @@ -68,9 +82,26 @@ It is also possible to point make to the newly compiled 'llc' or Cross compiling samples ----------------------- In order to cross-compile, say for arm64 targets, export CROSS_COMPILE and ARCH -environment variables before calling make. This will direct make to build -samples for the cross target. +environment variables before calling make. But do this before clean, +cofiguration and header install steps described above. This will direct make to +build samples for the cross target:: + + export ARCH=arm64 + export CROSS_COMPILE="aarch64-linux-gnu-" + +Headers can be also installed on RFC of target board if need to keep them in +sync (not necessarily and it creates a local "usr/include" directory also):: + + make INSTALL_HDR_PATH=~/some_sysroot/usr headers_install + +Pointing LLC and CLANG is not necessarily if it's installed on HOST and have +in its targets appropriate arm64 arch (usually it has several arches). +Build samples:: + + make samples/bpf/ + +Or build samples with SYSROOT if some header or library is absent in toolchain, +say libelf, providing address to file system containing headers and libs, +can be RFS of target board:: -export ARCH=arm64 -export CROSS_COMPILE="aarch64-linux-gnu-" -make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang + make samples/bpf/ SYSROOT=~/some_sysroot