From patchwork Wed Sep 4 21:22:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173072 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp454704ilq; Wed, 4 Sep 2019 14:23:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqywBTKkwwi6xcyfeWh8+dDuKzxNmBpKGymLJCWf768szjsb0bWBLQr54OA7y6bwClQ92gir X-Received: by 2002:a62:383:: with SMTP id 125mr48283886pfd.248.1567632185722; Wed, 04 Sep 2019 14:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632185; cv=none; d=google.com; s=arc-20160816; b=hTXLLdTHpghbfxw9C7Lz/bQfDAmQqMTINDi9G7tM+O0rhxjtfNtb0k1pHskAFTD661 WAFXyQ64YiDuqgGjyy5zlJfHbtzS9T2uQfuFwsrNVR6UrDg+5Vv055nqLLI3HZQBaeBr bdwXc8WsnaPxrR8dgDmh6JVKWCS4m2MulympnGxA7iDMZNTL9G2I8pQFBiuHVGyCosCs OWzo9z+Byb6CTAlNmUSqeuNfWmoFLbaRfuF+vqlQj77emF9Bv4ZVsVexk2BQ3XVDQsTF tkcf61GbB4BFb5Be4JdkbIOXAXh33Lz1Vu2Yl2HEQpMZdPIUZ1uhMZ0o0+0A1XRhF0aj 2SXA== 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=Uyna4IYOJol121SLmRwAZvx/NaOoPDVjYK6GTYbGUpc=; b=hYefES79fuQnPkx61wFFepmzZCgVd+Pp6d9fThvfargT4bVQW/oJP0PARCxgay+fiY agDBY/Dp5oNaclmHjB+EwSihMaDCLxNdK6Gh8jzrLq4pMpRtwnKV+WuSFsKABCNTjUcv SEXy252enoDtfizd/YjGjoWsDAGG5F3UvbkbUSNl9HiyhjAWWJDfCvnaxfxAiNAfQ9Ob kquSU2IRsiCDSXIJjBbPTmfNUsoml8ab3xOM+HoYC96r1+D5cB+Oy26NqMa9dafl7t03 ntfn/miidtBw+rngvB9ZeQgJeh8X4C9xV7N+r5dmmVPYPd1SrE2SjdMsCpnNtEhRhkgT 0WzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HEvKyf6h; 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 r9si84420plo.104.2019.09.04.14.23.05; Wed, 04 Sep 2019 14:23:05 -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=HEvKyf6h; 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 S1730214AbfIDVXE (ORCPT + 8 others); Wed, 4 Sep 2019 17:23:04 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:47001 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728072AbfIDVXE (ORCPT ); Wed, 4 Sep 2019 17:23:04 -0400 Received: by mail-lj1-f194.google.com with SMTP id e17so147531ljf.13 for ; Wed, 04 Sep 2019 14:23:03 -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=Uyna4IYOJol121SLmRwAZvx/NaOoPDVjYK6GTYbGUpc=; b=HEvKyf6hs2+1i0SgpYXPM43WRe6XRXXEvFQ0JmJsaAzI+5Kzq7PFffuX1Jzl6+iI+6 ZOS2jHoERLTa7KDEHqUkRHkic/Ja7Ek8udlefSiSVCiZJiE73g8B+EpMrCGc2t5YWh2/ SGTuU7MjjoW3hBkpywZ1if3F4MaZDV3thVqrdaS7K7dnboqNTOKkoxEZTmAPH5EfMJuD 6ylzq81lX5Z/QbVObOZN8N60eGDSFjTidvDL4wbEm3aYKxAhfyU4EGV87B+QV1iOn1Mx 0YQawwISYg8nsmINmbUc4RpqXkqqAl9xBmACJepPDHfZFjxAPRxR7riT3rJe9uEQiNTd Ad2A== 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=Uyna4IYOJol121SLmRwAZvx/NaOoPDVjYK6GTYbGUpc=; b=Q1E1nErGkuVyTWkT3sX4OV301LO3/Obojj2tr8TMsilX2Jkhyriuj1RpCY9gJmo/D+ vBn50IsnOFqasN1UovJXYuWziqxNqn3u4cWhhsqbR0Ln+CF7FC+4JkeTrpMuxDxHuUOw LfT2VL+uoW1h32clGA6JUulg5Y+S3hg2ZQ4lskXRTeZFZJ6MGQONfhQagMb/mrrLJy10 VVkwZ0mOyYbSD+gqnsL/1FWXkt4jn7sVwj+UKjBMRhRGh/Oc43d7uma9fPdIv5RO4Wct se0q+EFlwXNXYuMM6MtgArwlAd6DsRv8XW4JhUWXuFb0tPLv10ZAu39g1tFQXfyez32+ uSTw== X-Gm-Message-State: APjAAAWENsWI/KgP3eWfAS/tof7a9SlIV/2ZWp2Z20xNW6pyxxuYrGxQ mo9seFFJ6LKsuUL/ic8Qx02QUQ== X-Received: by 2002:a2e:93d7:: with SMTP id p23mr3270338ljh.100.1567632182383; Wed, 04 Sep 2019 14:23:02 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id s8sm3540836ljd.94.2019.09.04.14.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 14:23:01 -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, Ivan Khoronzhuk Subject: [PATCH bpf-next 1/8] samples: bpf: Makefile: use --target from cross-compile Date: Thu, 5 Sep 2019 00:22:05 +0300 Message-Id: <20190904212212.13052-2-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904212212.13052-1-ivan.khoronzhuk@linaro.org> References: <20190904212212.13052-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. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 1d9be26b4edd..61b7394b811e 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -196,6 +196,8 @@ 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:%-=%)) +else CLANG_ARCH_ARGS = -target $(ARCH) endif From patchwork Wed Sep 4 21:22:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173073 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp454746ilq; Wed, 4 Sep 2019 14:23:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+nhyNjQd4bCmxiag6Mwx8T7lmUS+X+26o8SU+r879InZmaNPEPu7ZmYpOMAxBjpbWoQZA X-Received: by 2002:a63:7b18:: with SMTP id w24mr170852pgc.328.1567632187248; Wed, 04 Sep 2019 14:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632187; cv=none; d=google.com; s=arc-20160816; b=CDW6bF3c58+DCtdxPLyK0vteC2NdAgRqR9udtFYndwt0KTeCC24/RMl1lWTTULiVbY sGYAsCq70hh85KXKWJXtIGFhi4kkTU0q2sq9qkV4mlRMfoSPH9BSBN8654ue6ERBq85i Fb6d3H1E0wuC/7NfEoxgJIYonjtaJzMqcaVwtlOfa03CZl3foFtEMM6lezHJYiDJ6wep Na3VPrTXEorDaZimyOLtFthBDHUQsYS9txtrHzs5Qlwx2AUd08C7lmd19DEYu3kmtmbo 9EU8Vv1E+35/7jzW44WpApymweiJjs+f/bUYeM6DDiCvvytxanmP1XgzURYBcbe96zVD Izbg== 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=1A0DTH8yoCPJNcxERaZ+ijIkUOQqqgHSIHaATGrPTFQ=; b=VELPA8vWD/mcLrS9UauXguDf7ixtJJdVN2YXOgxMa89gA1Q7BRE1Zi7/SxB9sS0PKB K/lgGe5yPQ66xW7PBBvF+Bu4H1upC+BGoiRi2j4g8L7Glh9G9jZ3PtNdg6mxYXHlFv2s VdVfq08SMdWRW5sYlHO6tYKt57rauwtUx8HiCvONo47CeYHdugZBO35Nm20T3960BpyC TxexcLBmoD5yfTDVb6Nywx2RcJ71MSeviXGogHqLvw5uviwfFesjPko+x74yE65yCna8 IpU4lmV8aRqvWaCVMgFR+idCa6f6XTqfcIbbPWcBGsqmebR/hfTi4tJ5WjTVu2ntC9iv /+Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JxOWBX3K; 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 r9si84420plo.104.2019.09.04.14.23.07; Wed, 04 Sep 2019 14:23:07 -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=JxOWBX3K; 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 S1730364AbfIDVXG (ORCPT + 8 others); Wed, 4 Sep 2019 17:23:06 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42650 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730245AbfIDVXF (ORCPT ); Wed, 4 Sep 2019 17:23:05 -0400 Received: by mail-lj1-f196.google.com with SMTP id y23so171305lje.9 for ; Wed, 04 Sep 2019 14:23:04 -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=1A0DTH8yoCPJNcxERaZ+ijIkUOQqqgHSIHaATGrPTFQ=; b=JxOWBX3K7ATM3R5k6qLko7irOYaDDp/EgE8lqfrCSuMD68Wxvfb5wgkZ5UbBXSNViD R37hhdMVyVTttgCsjHZkCQK2sZsQ/+mOjH2MmEnjoNubt0fsAOh+YGAb5XgJJ7CiMDVm Oj0dm134XL61kE1LH53qBXVlpjUIpWHL04VEkk0t0hzqmk6ihGiJu1fwZYv8qOnE/agN s0JL+ECqalNyE3mSNjOsv45sWpYK0MD9Xb5RhXGiwzcJlKmj7RfFCi0Mx8TMIsSEXmwf 3pc3CzpYyw4n2l94LKGE5Ws0K3mJNjjYb6vSUrZ64UMhnFZ6v1EEzgCkPrikOTSfU4Kj g8Dg== 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=1A0DTH8yoCPJNcxERaZ+ijIkUOQqqgHSIHaATGrPTFQ=; b=fRetIQgO/VXA1D32jDE/8q0btoXJ6PkKQuBi/jJ3ZKCqKU0Cnk0jv3dXvBlvKnJ0UJ dEJ96SCv4DP2DRAajmX2sQkNNrJXJJpaS8I2Dj8HL/vrov5sZNXTfgOfz7cm8NgA7FWs 9C2/FKBgDLPBDVni6UjR+DfwCBPFKraDFL9ELvK4ijRI1CYHijX0fWctjVfMf8ybM79+ eSy0Zt0gcm1qgdK8U+kMELr/roUIIM9dQffzdB0/JhxTIbHSTqEpgHrjPqcZ6vp0uafR NZ/wlJfRMyV/Z+OdAm9Q5qsVV70eYtelqCaZC3swYHV46HNwaqSWc/FbALjBFh36fQuR lOJQ== X-Gm-Message-State: APjAAAVw5lf85RggYweqAQYPDWHewWC9iqnKBXFgB0dXJogmh/V4H+me EpFpnL0luYlvx3lQ/AagKKYU9w== X-Received: by 2002:a2e:7210:: with SMTP id n16mr14294364ljc.235.1567632183622; Wed, 04 Sep 2019 14:23:03 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id s8sm3540836ljd.94.2019.09.04.14.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 14:23:03 -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, Ivan Khoronzhuk Subject: [PATCH bpf-next 2/8] samples: bpf: Makefile: remove target for native build Date: Thu, 5 Sep 2019 00:22:06 +0300 Message-Id: <20190904212212.13052-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904212212.13052-1-ivan.khoronzhuk@linaro.org> References: <20190904212212.13052-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org No need to set --target for native build, at least for arm, the default target will be used anyway. In case of arm, for at least clang 5 - 10 it causes error like: clang: warning: unknown platform, assuming -mfloat-abi=soft LLVM ERROR: Unsupported calling convention make[2]: *** [/home/root/snapshot/samples/bpf/Makefile:299: /home/root/snapshot/samples/bpf/sockex1_kern.o] Error 1 Only set to real triple helps: --target=arm-linux-gnueabihf or just drop the target key to use default one. Decision to just drop it and thus default target will be used (wich is native), looks better. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 -- 1 file changed, 2 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 61b7394b811e..a2953357927e 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -197,8 +197,6 @@ BTF_PAHOLE ?= pahole ifdef CROSS_COMPILE HOSTCC = $(CROSS_COMPILE)gcc CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%)) -else -CLANG_ARCH_ARGS = -target $(ARCH) endif # Don't evaluate probes and warnings if we need to run make recursively From patchwork Wed Sep 4 21:22:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173075 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp454810ilq; Wed, 4 Sep 2019 14:23:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFpu8HCaqBRZTqEgjd9Qt4B+MnAt0XpdmDDI/nXKaXHpvfsqf9ahtlkW76ilqIE5hznude X-Received: by 2002:a65:64cf:: with SMTP id t15mr187995pgv.88.1567632191281; Wed, 04 Sep 2019 14:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632191; cv=none; d=google.com; s=arc-20160816; b=dg2yr817JM/s+y5Q95luhU3xgDKDRLD+34Y3R0Nr/UCEXZ2IJ6tvky/6C5TqPMItQD 7+Ffy5Pl19MwHfecu86U5NW20FY0wZf7Pqk1awUbvG1dEXDA8B0LVHfF3HVd5LU9OM1u K0/B1IyPju06pxjJr9SYgG7BAGGroOoI4n7bxEHh2orcadHFIMpgpxUR5xHbE7yE/dvi wZo1FOGsjW+WKDAKGgmQz8BETclGQNjjvUc9wZJhUxbiqhrbvxG3R7ydYaavYEe29ql5 VGQKH5IjgGT4bj43G2INzE636q7Q0FkfysvwHJa7GMtTFScFfalmK4qWo4JyDccN9EvE N0Mw== 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=XM+El1wyypVfaXfQc7FxTfECR5DYv9zUGiXmgC/VC5g=; b=j9gI/5fKJy5dPLaH3Sq1uoiyZtF6EyiX0ntVlvdAb+EMfq1xO51RhSfT8cLn97DIAV KjH4uyo0ai9tqHJybvlpA1g+W3wR/xGj+hLF34nZ07iIvMTkA/m1JZotcKyaAxdOTQYG x++AfPUz5izPnajv209qN/SwCTAW2wkunjwcLNNomYHRvX+qi7JpLPm5BmGGzchUhajc i/to5y40BCVl3B3QOux6aNZB/HmDWpaXfwP2VNU6N3P4dHOybxb2m66vXiHjq1Kaltlf OlCDv7UFI4g+kT8ArVdnfSbd/LSl0fi2OqHopkSLzHzL56fnlXlrGUNOfdCun4cmJyZr w4PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qrn6kZhS; 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 e79si9317051pfh.68.2019.09.04.14.23.11; Wed, 04 Sep 2019 14:23:11 -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=Qrn6kZhS; 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 S1730546AbfIDVXJ (ORCPT + 8 others); Wed, 4 Sep 2019 17:23:09 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45650 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730269AbfIDVXJ (ORCPT ); Wed, 4 Sep 2019 17:23:09 -0400 Received: by mail-lj1-f193.google.com with SMTP id l1so153018lji.12 for ; Wed, 04 Sep 2019 14:23:07 -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=XM+El1wyypVfaXfQc7FxTfECR5DYv9zUGiXmgC/VC5g=; b=Qrn6kZhSPCRIfWPLbZQrXvK6lt7Iv2mnBJ9fLUFe1bB8d3A93TcSi0pQ7aJIbrRhRF VqBxOcqXvHmwM6B4nLPwZFInG3Lbs0ucLsOPQ7EWJ2SK5XqHUKTssZhdnQhNplsuEwSY x5Svyb5v24/nMZRgCDOGvj1X2TKa9ghB3bZt/+JUncKf7znkKi7UrsFYe2VfXlLM1Pw6 NdwK4iRuxsJnwFPInX7J5KfhCI19YZdPS/RrG1yxKH0/a/oOXRnDwEqfffdjpoAtOtZK I3CsCCXI734MGwDY9NZOTAFvNZ0ReU4TmWIEZK55u9m5rg9WFEW+C4nVp1ngSBNzeEKQ AHEw== 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=XM+El1wyypVfaXfQc7FxTfECR5DYv9zUGiXmgC/VC5g=; b=cKZfQEdF7Sac+TyWN3SC4lZHBp32t9aAdrxYOe+YPP7RqajKlDSkk4R3AbjivoPWG0 T1UMRnupGvzXCNcjpBzwtisDPdTC9RXx4dUlsBLLzLFU2GzJhDhJmPvDywMytr13JMBj rbxejg5qWqUw7aaNnM93UhRpWx53f2aTXvm1yFAgddW+lHlHdOz+bh/tJNbP5xwqSOWG UjZdrccBqoWi3SRNdDFJPmbVZK5tgsd6ui1PwYshrS408Lg1AN+skfEPvgASGIqsxlcS oOs0Tuz2WAQ8AU77kMEvkc7gY48QXTaPdbnTuVqKaWEP5x28w5STB1P32s2E6+7FPxEJ usow== X-Gm-Message-State: APjAAAXBAJS//NbzAR9IjxKfdbtag1PFjQV/eGCviiYiIrNWnB36X5Gl 6Uz3TNXHHPKrjvMOToTqva8l0Q== X-Received: by 2002:a2e:9a82:: with SMTP id p2mr24383354lji.64.1567632187076; Wed, 04 Sep 2019 14:23:07 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id s8sm3540836ljd.94.2019.09.04.14.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 14:23:06 -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, Ivan Khoronzhuk Subject: [PATCH bpf-next 5/8] samples: bpf: Makefile: use vars from KBUILD_CFLAGS to handle linux headers Date: Thu, 5 Sep 2019 00:22:09 +0300 Message-Id: <20190904212212.13052-6-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904212212.13052-1-ivan.khoronzhuk@linaro.org> References: <20190904212212.13052-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The kernel headers are reused from samples bpf, and autoconf.h is not enough to reflect complete configuration for clang. One of such configurations is __LINUX_ARM_ARCH__ min version used as instruction set selector. In another case an error like "SMP is not supported" for arm and others errors are issued and final object is not correct. --- samples/bpf/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index cdd742c05200..9232efa2b1b3 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -186,6 +186,13 @@ HOSTLDLIBS_map_perf_test += -lrt HOSTLDLIBS_test_overhead += -lrt HOSTLDLIBS_xdpsock += -pthread +# Strip all expet -D options needed to handle linux headers +# for arm it's __LINUX_ARM_ARCH__ and potentially others fork vars +D_OPTIONS = $(shell echo "$(KBUILD_CFLAGS) " | sed 's/[[:blank:]]/\n/g' | \ + sed '/^-D/!d' | tr '\n' ' ') + +CLANG_EXTRA_CFLAGS += $(D_OPTIONS) + # 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 Wed Sep 4 21:22:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173077 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp454847ilq; Wed, 4 Sep 2019 14:23:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwL6U4FI5BkkQkpkJBLcSQ0r1eEAg7VuKd4LEzBis70TrBPMLKB3LuJvv2rrGm282X5joPT X-Received: by 2002:a17:902:bb95:: with SMTP id m21mr42329462pls.26.1567632193405; Wed, 04 Sep 2019 14:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632193; cv=none; d=google.com; s=arc-20160816; b=awKw975cX3YG2o5+WVdu2P77QIo702gYywlXrE496esZLx/0+2ox1DqPxUMifdjJxg hx52V6DpLOu/J7a/d+wTGZaqg6oNdi2OjXHnboWPo1eBhdfSzczZkDYxK1655XiC/FjD LYOjvcmu6z5hd+ryVA97SPbZnSRgDIbiLrAPizyhF53VzrrZKg9EMHVRRwKP/ep4eV5B dVQAb9BgDl4loFWaJ57M9zGSJcZgJaQQj2ozYH59lwU1ch/OUyUrNnqqzIW5p0LEofRX qWbnl0lUi/sQjCjlRlqfmJdgbwsQ7nKjATIK+1uIG6Dw983LOIdZx9vHgxVfM6JQM/O3 ra1Q== 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=S7BH2bOuqpWzG3KQU2G046M8ZupbTAkU+KR6zMOgNJI=; b=ddAGQs3KkRuhLXPIWjsN2MKcaM3iU5PMgNGHyHf3OKIeqcZ21KuwHiPy+71qDGrtjP wIq1cMjAXHtuZm3x6rFlDtQ7Psr/ww3hl3N07BprPykHUDwgIrfSfiWHQNTuRny5o+r2 tnJJV9896fyKpeWFNxbtYeZfD8FD0YLLsQ+UZ+8MoJ8DVynuQd1nAX/VyO/43V3E7Pvm Gy3mGxoyzxWoCzC1asE3sPsfaxXStsRoOt+ADwhJ5/UKf9A9f18/TLD5QN0uPAtpNfGW taT0pb/9euj+6HqK4UVxX1y5RAz3vJYNikZCZCiTv0MSYORJU/rKGz51JbIEe7hWLlOe eLOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N+hBm0Fd; 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 g18si56749plo.373.2019.09.04.14.23.13; Wed, 04 Sep 2019 14:23:13 -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=N+hBm0Fd; 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 S1730679AbfIDVXM (ORCPT + 8 others); Wed, 4 Sep 2019 17:23:12 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45655 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730269AbfIDVXL (ORCPT ); Wed, 4 Sep 2019 17:23:11 -0400 Received: by mail-lj1-f195.google.com with SMTP id l1so153098lji.12 for ; Wed, 04 Sep 2019 14:23:10 -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=S7BH2bOuqpWzG3KQU2G046M8ZupbTAkU+KR6zMOgNJI=; b=N+hBm0FdQmrQttzep7czwaMBh1UAfnrbN3973Hn33rJnUCsCcidmdy8VHPuaWuGuv0 25+b2VyQeoEhM1J0hUHbkpMZeNwndzFaRE0S8dREHTa0PP5T7fOxf73nUfg+AbSC2Dho lCthA7fYTbWUWDrPClyG0C0rRDj4HP6S2dgGH9W84BgdIHRjuhApsw0KwKYy4RbCaDSd 7JXdx9cniwUUP1n7VSY11bpix+OGaGkyYkj2reopbGCzbbe7zfi1XMNg2xbwgAZHiRlA ML/AKF493m6fBaA3vQi74YYYwmYhyYqLP8WhLq7Ge0qfBm4nMuE0e7qwtY5YbAWd6k6z hG4w== 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=S7BH2bOuqpWzG3KQU2G046M8ZupbTAkU+KR6zMOgNJI=; b=rF01W8dhsU+vkLsvBzB9SLj+MJu6JSHeafxTcFIFDneD/uBxEtETInSrVck23+X6uq AlKdw4WIm+9+c2MVjgxBIsfbg+CIXEhftxGLIIVGjqlxp7JT2nFQTmTUXfxQ8KQODb8i 2tLnHzXgvL58AR6OesJeETWi0RhBGNmIyC+GOVafctNmAj2aLYsITGZiIfOxzwa3dQQo e1sygLgoWxY5uM3p72D6k8JdEOYMWDLcLhu/QiGHzpB6hp3EtkTU0LAe3jNX6Vmhyq2O xyWcdB7wEL4L07giseYscFgYZZOWE9Khk9n96YvmG+v3Z/m0I/fiPpN+as69d9J3FCHJ cjjw== X-Gm-Message-State: APjAAAXwszyol85YRCDzlUZMC/bFSIdSQ8Rx29bu7WcS4jXCgwiRk1xI bx7gK48p4XNY3oWYpWCg+naa8Q== X-Received: by 2002:a2e:6111:: with SMTP id v17mr24187411ljb.30.1567632189413; Wed, 04 Sep 2019 14:23:09 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id s8sm3540836ljd.94.2019.09.04.14.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 14:23:08 -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, Ivan Khoronzhuk Subject: [PATCH bpf-next 7/8] samples: bpf: add makefile.prog for separate CC build Date: Thu, 5 Sep 2019 00:22:11 +0300 Message-Id: <20190904212212.13052-8-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904212212.13052-1-ivan.khoronzhuk@linaro.org> References: <20190904212212.13052-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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.prog for simplicity, having definition and routines similar to ones, used in script/Makefile.host. That allows later add cross-compilation to samples/bpf with minimum changes. Makefile.prog contains only stuff needed for samples/bpf, potentially can be reused and extended for other prog sets later and now needed only for unblocking tricky samples/bpf cross compilation. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile.prog | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 samples/bpf/Makefile.prog -- 2.17.1 diff --git a/samples/bpf/Makefile.prog b/samples/bpf/Makefile.prog new file mode 100644 index 000000000000..1d138bc21dd4 --- /dev/null +++ b/samples/bpf/Makefile.prog @@ -0,0 +1,77 @@ +# 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. +# +# Only C is supported, but can be extended for C++. +# +# Sample syntax (see Documentation/kbuild/makefiles.rst for reference) +# progs-y := xdpsock_example +# Will compile xdpsock_example.c and create an executable named xdpsock_example +# +# progs-y := xdpsock +# xdpsock-objs := xdpsock_user.o xdpsock_user2.o +# Will compile xdpsock.c and xdpsock.c, and then link the executable +# xdpsock, based on xdpsock_user.o and xdpsock_user2.o +# +# Inherited from scripts/Makefile.host +# +__progs := $(sort $(progs-y)) + +# C code +# Executables compiled from a single .c file +prog-csingle := $(foreach m,$(__progs), \ + $(if $($(m)-objs)$($(m)-cxxobjs),,$(m))) + +# C executables linked based on several .o files +prog-cmulti := $(foreach m,$(__progs),\ + $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m)))) + +# Object (.o) files compiled from .c files +prog-cobjs := $(sort $(foreach m,$(__progs),$($(m)-objs))) + +prog-csingle := $(addprefix $(obj)/,$(prog-csingle)) +prog-cmulti := $(addprefix $(obj)/,$(prog-cmulti)) +prog-cobjs := $(addprefix $(obj)/,$(prog-cobjs)) + +##### +# Handle options to gcc. Support building with separate output directory + +_progc_flags = $(PROGS_CFLAGS) \ + $(PROGCFLAGS_$(basetarget).o) + +# $(objtree)/$(obj) for including generated headers from checkin source files +ifeq ($(KBUILD_EXTMOD),) +ifdef building_out_of_srctree +_progc_flags += -I $(objtree)/$(obj) +endif +endif + +progc_flags = -Wp,-MD,$(depfile) $(_progc_flags) + +# Create executable from a single .c file +# prog-csingle -> Executable +quiet_cmd_prog-csingle = CC $@ + cmd_prog-csingle = $(CC) $(progc_flags) $(PROGS_LDFLAGS) -o $@ $< \ + $(PROGS_LDLIBS) $(PROGLDLIBS_$(@F)) +$(prog-csingle): $(obj)/%: $(src)/%.c FORCE + $(call if_changed_dep,prog-csingle) + +# Link an executable based on list of .o files, all plain c +# prog-cmulti -> executable +quiet_cmd_prog-cmulti = LD $@ + cmd_prog-cmulti = $(CC) $(progc_flags) $(PROGS_LDFLAGS) -o $@ \ + $(addprefix $(obj)/,$($(@F)-objs)) \ + $(PROGS_LDLIBS) $(PROGLDLIBS_$(@F)) +$(prog-cmulti): $(prog-cobjs) FORCE + $(call if_changed,prog-cmulti) +$(call multi_depend, $(prog-cmulti), , -objs) + +# Create .o file from a single .c file +# prog-cobjs -> .o +quiet_cmd_prog-cobjs = CC $@ + cmd_prog-cobjs = $(CC) $(progc_flags) -c -o $@ $< +$(prog-cobjs): $(obj)/%.o: $(src)/%.c FORCE + $(call if_changed_dep,prog-cobjs)