From patchwork Fri Oct 11 00:27:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175897 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp42360ill; Thu, 10 Oct 2019 17:29:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxucya4ndG/yzgm9WwpTnIwMV+D5gW0r8d2mR9wBc96u4dcM8vegkIOtf6pCtY55QxobQ06 X-Received: by 2002:a50:9f68:: with SMTP id b95mr10743223edf.301.1570753781979; Thu, 10 Oct 2019 17:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570753781; cv=none; d=google.com; s=arc-20160816; b=gKKeCPHXyXdhEymcbdkSYh4VyVU+6hk5h2SB2ZfAZgmrT8NCpbexs0PuAm4T+vArvx D06HABMoeyegNjvAOp8oFsvXhqXp5sQEA4Mp6V1tIY7JGhZlufB4AToHy2XDXCH919du R8AM7Qut2gjUZ1xuB5bCZmcC332Et/Zko2PJE0k8BxJshrY/L9auE55WHlJBbMH+KRR0 oqWX9rmU7pnE2SV+rc5vYKnHZZynpEqS8l2wt3axDRCeSlqEaR9Zy9AVEoANHRJ5ITOK knISQfNs3j3EhxHS/XuuZiwq/ibmykNBkrDpJUEBIsN6BPsg0hcvBx2ssKtq19nsLxYT ORyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=X+OYdLBkIYv08X2eKXt3TCPXQ11so0VYCO7f1mswfR4=; b=iNphA/B7STRctsNqs+PGzY0pOPes3BkmYd7n0J0SI9Lb8eYcbQKqHjAZKzWT6jNHOr QMe2QpVK+rAV6PKwjzfqwr2kGrD7EWHe1E9r0hLkmBavY793PmCB42MusAENLFDA7XoM 520C5DWWrh64CQkObyDo+TBjxHIAhnGA1k0xphrgde5ng7pg+gsRybaP2eeD1+E7lq79 v7DkDnJjr9LZ6Gln9agWwjN5Lasd7RLGsOGqVqJhnZh4NQDWXC/BLpl3EzJZMwmyAkg8 kDkr4hyFrvebYDXav8AqJKyqmK53JVI/PlYD9erKhivPNA48NfPzT7Hm0TErtY/pmbni pUKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YKc0wBOK; 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 e22si4005608ejx.107.2019.10.10.17.29.41; Thu, 10 Oct 2019 17:29:41 -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=YKc0wBOK; 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 S1727994AbfJKA3l (ORCPT + 22 others); Thu, 10 Oct 2019 20:29:41 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39235 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727569AbfJKA22 (ORCPT ); Thu, 10 Oct 2019 20:28:28 -0400 Received: by mail-lf1-f65.google.com with SMTP id 72so5725524lfh.6 for ; Thu, 10 Oct 2019 17:28:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X+OYdLBkIYv08X2eKXt3TCPXQ11so0VYCO7f1mswfR4=; b=YKc0wBOK5kw1DdbXCuiOee6bbytIkRtP7xcVtvuTLj4UdL6r5TUv6DcZgG/ZDsLP69 ulWquw4+7tsUAsKSiFy2Cfty4cW+bXLlKps9odJRuCeWnw/lGdGvLR5rkISefH9Phe91 /CAtfzmy5wtryrSDvREOHdPKvSRLjAPu5s7+k7zxv+jQtm2PN0fja1E8kM5N4INyKxLu /Vf7ncX5Q0YaTUYo17CjLST2nR75D+SCZ8tWLmJkPS9ENAAQArYJ0M+MYo6mSMcqEXu7 Tnhwc+jAV+FrQNEWwOXtNudFWCGl6uLf0ZpPNG8Nqh7N9/l5U6zwHP+DruNqbB9COdF4 akmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X+OYdLBkIYv08X2eKXt3TCPXQ11so0VYCO7f1mswfR4=; b=a3b1aM3+uhHLMhJbogNVPG5d78SNr/MAl455ONTCsTxYeNczeJ2iXAGPpWuuU6LKfy PQzM/1tUPnUH+KNd1ECMZlmDvop6WPI0P9m2jcsv4xYyhHD8ZAVVicQ0ZsN/DtKabi1X LBYKhURfXj7Pbvt9x2ohryQfk5ul+OmAnLTj9FJTkg0K/XIANvTpkg9pfQ54XG4zkn0M QB6QKZUeRBLWWHq+TOgOtq38177xciyEGoCy1W73LH9g7/RRcb+3Z8grHt67A1RRX92s 4tHUKj+de8Ah/g2Zsgr7MOPqoypDk7rfK/GYQol1gx3Risfli7FPHvDA5Utdn6xNQzKG Ecyg== X-Gm-Message-State: APjAAAW4Y7VTKhFa/7Hhg01/OqparMLzun6k/Z2rQbN1Ug8dPDS1xais bpRsGYgDQbFCcssK8aYS9AVuuQ== X-Received: by 2002:ac2:41d4:: with SMTP id d20mr7390173lfi.24.1570753705056; Thu, 10 Oct 2019 17:28:25 -0700 (PDT) Received: from localhost.localdomain (88-201-94-178.pool.ukrtel.net. [178.94.201.88]) by smtp.gmail.com with ESMTPSA id 126sm2367010lfh.45.2019.10.10.17.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:28:24 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, ilias.apalodimas@linaro.org, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v5 bpf-next 03/15] samples/bpf: use --target from cross-compile Date: Fri, 11 Oct 2019 03:27:56 +0300 Message-Id: <20191011002808.28206-4-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For cross compiling the target triple can be inherited from cross-compile prefix as it's done in CLANG_FLAGS from kernel makefile. So copy-paste this decision from kernel Makefile. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 045fa43842e6..9c8c9872004d 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -195,7 +195,7 @@ BTF_PAHOLE ?= pahole # Detect that we're cross compiling and use the cross compiler ifdef CROSS_COMPILE HOSTCC = $(CROSS_COMPILE)gcc -CLANG_ARCH_ARGS = -target $(ARCH) +CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%)) endif # Don't evaluate probes and warnings if we need to run make recursively From patchwork Fri Oct 11 00:27:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175885 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp41470ill; Thu, 10 Oct 2019 17:28:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwf3ZgWayjknOJm7YAf26VEn5lAGjXmL9m0Q//zqnpBTClZI/FmVELGbH6X0a9kwTyq+sZF X-Received: by 2002:aa7:d807:: with SMTP id v7mr10715495edq.220.1570753711927; Thu, 10 Oct 2019 17:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570753711; cv=none; d=google.com; s=arc-20160816; b=VYOryNzVRUYDC15rU1NE53Zu3wOBOxN88nOuWE2O+LPTaLUV8AiVWNVR16315iV16f qYJHOJxvS5pNDVB/pPEUvvr/jmf+v62DiFfFVi97CXWSIy8tNisWpmqRkXsAwbzjtpde i286u6PGo3Hp7++eAbM/5uyENPgqZpuGePrSRYSJvZVhihzPuTHzGm+HYGWd0ym1Mo/c RThHO0wkj+W0wF6Sd2+RyXX++jgC7D56QY5qf8FCvgJEd5CamvOvM2/Ail/LWL4MPwHT QHSJXZPld/nQrknVwB8WZLuHgP0l0cyxxt1Qo5mdNOfm+0utr7JzvyX5XxIvoLfBi6m9 lfqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=j9oehlPvbpQ/3mUr7ILsjkWG9P4RuU3Cq2akh+BGeG4=; b=IQGSF2vVgmeI9CfUEksf9oCISHBNVXLVXgEGuWZeELL1oZPhTmfzReTpa2GzjdkWLR nGdBpgJvPK5kbS09LDjopjMETM93wUUR7wcBygHxx7aDzGoT+E5WJ7mxFjaMoQm3Mx0m 1bW+0f3FYP0rm/pn8L6OPrll2USCpo4pyu2aISp6og0og6IZAXk8f4LPs33SM54wNd80 eFxxmQ2O6hTclFgPrz1G7OBff2yjeeM5adRBhmzY59H0GKiW7QC/tb6DWaGvTp9DKXbL 95BTZyOB2Ohfs///TeYe3NTmiV22hABL8Fz3gY4C7RyRFGZ+q9fzwyJaeWt5HFwGLnFE IgGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ARrbso8c; 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 w5si5098961edf.283.2019.10.10.17.28.31; Thu, 10 Oct 2019 17:28:31 -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=ARrbso8c; 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 S1727600AbfJKA23 (ORCPT + 22 others); Thu, 10 Oct 2019 20:28:29 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33566 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727559AbfJKA22 (ORCPT ); Thu, 10 Oct 2019 20:28:28 -0400 Received: by mail-lj1-f195.google.com with SMTP id a22so8065594ljd.0 for ; Thu, 10 Oct 2019 17:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j9oehlPvbpQ/3mUr7ILsjkWG9P4RuU3Cq2akh+BGeG4=; b=ARrbso8csUYbUgve+g7WykoFNP9+JXtn6BeuhwqYVd6l3bO+5ocRcfxrg2hjs5aX1O kCWylnHErMmzxClr+POVIg8M1lPp7KN3gxCF1uVOjnOK1BxmLEGhmNRudGKKRPwlBMy/ temn0HLI8auoXxI/j87dHFM9xgNijn66PJ6QxUeBdzNMFwU6unVq/DNffXJc75oeqmVn 8I1tZ39dO/T+So8R65flnQR8Rx0t8xDfe7phHglv2e5RHy/L2/4h54VLvgCN3PwYEz7+ +nHyT22x7znMK259QnoduZ64Qzoz3Y1ro3y8xWIN3Lg0BuCVq2E+DrZha4QllJgFZKFe ys4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j9oehlPvbpQ/3mUr7ILsjkWG9P4RuU3Cq2akh+BGeG4=; b=Rezj+m0E9arPlDBi9O3q5PsQe2O+OfaakYvSFGfS8+HzGCkLpUWrkAkIsmvwvrCQ6r em7GsZUP25/3Y6RSc0QIo0FhmPbC1qOOhOZQm8QV1x16EknH8JFuoKD05mEHonXMV1uJ YzCa/XTrgBZnRCO8IMrFZP+oFVc2z1eE3QIlAG54Aj65cqbj/GOZ8/Rabuj4n0XTwQFH X5cK7CuCjHYszRtlCDR58E+kHPI+uHPKge2o0Ung4LqcvyxQkGl7dwDTeCqGVBn3V9Y7 V8G5ULsGX5cpyNACpysNnCnicguZplo4Av0+25ZEaQw5nJy6wMmhWNUf8CQzikHpzpV4 og0g== X-Gm-Message-State: APjAAAUITKjT1qzQyD69+llJHDwCc0vwzfCdYm1q3uPIeAe4XioQb/VK JwEyC4r2G6YScPXoRNBsf517+A== X-Received: by 2002:a2e:8183:: with SMTP id e3mr7876486ljg.14.1570753706383; Thu, 10 Oct 2019 17:28:26 -0700 (PDT) Received: from localhost.localdomain (88-201-94-178.pool.ukrtel.net. [178.94.201.88]) by smtp.gmail.com with ESMTPSA id 126sm2367010lfh.45.2019.10.10.17.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:28:25 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, ilias.apalodimas@linaro.org, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v5 bpf-next 04/15] samples/bpf: use own EXTRA_CFLAGS for clang commands Date: Fri, 11 Oct 2019 03:27:57 +0300 Message-Id: <20191011002808.28206-5-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It can overlap with CFLAGS used for libraries built with gcc if not now then in next patches. Correct it here for simplicity. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 9c8c9872004d..cf882e43648a 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -218,10 +218,10 @@ BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \ /bin/rm -f ./llvm_btf_verify.o) ifneq ($(BTF_LLVM_PROBE),) - EXTRA_CFLAGS += -g + BPF_EXTRA_CFLAGS += -g else ifneq ($(and $(BTF_LLC_PROBE),$(BTF_PAHOLE_PROBE),$(BTF_OBJCOPY_PROBE)),) - EXTRA_CFLAGS += -g + BPF_EXTRA_CFLAGS += -g LLC_FLAGS += -mattr=dwarfris DWARF2BTF = y endif @@ -280,8 +280,9 @@ $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h # useless for BPF samples. $(obj)/%.o: $(src)/%.c @echo " CLANG-bpf " $@ - $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \ - -I$(srctree)/tools/testing/selftests/bpf/ -I$(srctree)/tools/lib/bpf/ \ + $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(BPF_EXTRA_CFLAGS) \ + -I$(obj) -I$(srctree)/tools/testing/selftests/bpf/ \ + -I$(srctree)/tools/lib/bpf/ \ -D__KERNEL__ -D__BPF_TRACING__ -Wno-unused-value -Wno-pointer-sign \ -D__TARGET_ARCH_$(SRCARCH) -Wno-compare-distinct-pointer-types \ -Wno-gnu-variable-sized-type-not-at-end \ From patchwork Fri Oct 11 00:27:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175888 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp41572ill; Thu, 10 Oct 2019 17:28:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJjK232sr6ET87JgrevDvrvTrGW2sgbZPQm4rYvvjGfR8472x2FkXhs5o1c4dXduY622b1 X-Received: by 2002:a17:906:ce53:: with SMTP id se19mr10801715ejb.17.1570753720289; Thu, 10 Oct 2019 17:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570753720; cv=none; d=google.com; s=arc-20160816; b=pQ69oQXNEUmaua5kjXURhK/IjW8c1ZXOGM1yeg1sA+4nkAQL8LEImjkyjaH05oxtpk /lnFeRV5nuiWy+38D+GETiZInd8XqSRbry4r0c7lWfiCXYgEOVp3PauLsJLMm7G4eXMm EA0yMnz63Lakp6AA43NuWBDBjxd6Oteju1iv4iGqxvOkQwUYKwwsVrcu6dm14GsXpURw rqucipP0e29zTteWJcoNpSS2SiQUKctedZ5xNDPIhQ1cW229aPkLE71UrjlVZJExRG6P cNY/TEmKniIOQWeM4inR9XlWWDx+OC7xjQQocQthHRoVTP246YuZB07vxBN3m3mVfBNY 2rdA== 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=ZXAfjdX+WvsCZ4Putv4iaBG542bdy+GxK4sst7rF5S0=; b=IdTcVX8cYohcU2cAZQBtckId+gVtzpX9sAq29Gcq3IgsnDVUSAfeKmSF/M+Jyhm7Ig 3ekQpGM5rhAmq6gJZD3OUn5PlmevKMw+jWxGghYmHSqXNEBWm4kkuxhMtSdCL68DJ5Rp q5CWXrxug1vxz59wjPYS2gVsYZmgvr0MjpCyqV+DLel3mxgjLBSbV9lzbWwK0RKkMCtE 33V4bgW0zq/pj2vtoGHdW4Aou8525XzvXtio+TgcnfkC8+XlXYiKUgtgYxM7o5xFWz5P leNWaXx/rSux9xoChDzGW6A0DE7C608HTr7WDxBzgA78SzvhlpJWsTxfJi3bJCN0L9ib /DuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U8B4vmxp; 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 y50si4737688edd.237.2019.10.10.17.28.40; Thu, 10 Oct 2019 17:28:40 -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=U8B4vmxp; 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 S1727739AbfJKA2h (ORCPT + 22 others); Thu, 10 Oct 2019 20:28:37 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:43201 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727609AbfJKA2b (ORCPT ); Thu, 10 Oct 2019 20:28:31 -0400 Received: by mail-lj1-f193.google.com with SMTP id n14so8001802ljj.10 for ; Thu, 10 Oct 2019 17:28:29 -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=ZXAfjdX+WvsCZ4Putv4iaBG542bdy+GxK4sst7rF5S0=; b=U8B4vmxpgfJnzBiDJsbyyQvQCGTuwkGq440RprVd0W/jBwPaWulfeCmeD7ZzaIVdWh PBT2V1HNzKuxn9toI+ubYWKykuXxFguzRYTDd8aU43+pbuXMFAXCOFHgx8OTesJKeHiP u8fxXTOmnvuWqXYlx3MeAD2HpWswrvkvtw0QVFQ1TgcOPxhyNo1fHUaNodXg+eVN8lHz lyUqk+Nwewllbi0cPmn0R28no3ae8PrTbX1i54WHZxoYPkI0ILgtCmFu+vOGKLD3Eskz vjscmyBfhit3N498RUoFIS4ShuUVwWFD8rcLhkMAMURHLcw3iCv8D598o9x/C5n1OoqD dIFA== 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=ZXAfjdX+WvsCZ4Putv4iaBG542bdy+GxK4sst7rF5S0=; b=m/XmnR5Mc5y8v0FdR5T3USIo4SwuJvjnbJy8k+3U5tObDA+WkQpb1+MUjrhaLRrydu YzpyTg3GVyXomHhaYqyFYDMGkvkdodm0mvLkoiOGXSI0CvRSoyFbxmlFkP6WiUemkFiS HLuPqWDuuUiV/E6gWW70LJiLW914EGvjdLvVqbt906iWQP+PZm073Cud5CbomtOQ79B8 i01J1YlfSFUKLiv8uKhYADWHVAVvMX2SDYlpZ9Ewe8B2Nn94Gnl9XYc37NvSnAAgrxYq TdX+OErOBJ4EnrNeUrb+caDX1B45nTbgmsNJCaeAwHNCkp1xWMjDJmgnpvkz/4gWNOVu nCEA== X-Gm-Message-State: APjAAAUOXgY8J5ZKyFcnod0ZF2K5nXmqdG3oSFRi27EsA5CiSFfn8X8v OnaVJfBBSG5POm+NQY9hefaRvw== X-Received: by 2002:a2e:9890:: with SMTP id b16mr7075689ljj.153.1570753709112; Thu, 10 Oct 2019 17:28:29 -0700 (PDT) Received: from localhost.localdomain (88-201-94-178.pool.ukrtel.net. [178.94.201.88]) by smtp.gmail.com with ESMTPSA id 126sm2367010lfh.45.2019.10.10.17.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:28:28 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, ilias.apalodimas@linaro.org, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v5 bpf-next 06/15] samples/bpf: drop unnecessarily inclusion for bpf_load Date: Fri, 11 Oct 2019 03:27:59 +0300 Message-Id: <20191011002808.28206-7-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 9b33e7395eac..bb2d976e824e 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 Fri Oct 11 00:28:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175887 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp41560ill; Thu, 10 Oct 2019 17:28:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQpWuwwF1Cx++OObXUKSb7831CMjGxIgXK5KRtUBBxmWQkBjX+O5y57CGAkhcuFAJ5Saza X-Received: by 2002:a17:906:2d49:: with SMTP id e9mr10893941eji.240.1570753719525; Thu, 10 Oct 2019 17:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570753719; cv=none; d=google.com; s=arc-20160816; b=Vc69Y9c1Vl7ltLCgffVFf0dC1gzdWVOOEfT9rXzlbEZ+U70UVGLTak9la1XG+3Cx5C aKLiJ/ykAkPE/QyqunycvGtKVG2QGDpWyfEHGub1QACLPwhfEpCpfWEcDQPRMnK/zitK VXpOcgBM1+7fYDqnkqN5kl/6ywzArmGUyNBkzDmm5GQWCZmk7wnP6lJnegmwUppQpbyn s5osa0TnfNX6yOJ5IOuZLvMStBR4MYncGz4XJSwl1jpp9PjUocqROhBlGXCfmlXFWyYr 93Je+SAwOt79b88vip7qhuPDeTwDe1R0fF96DYh/hp8NRKYaR1S9ymsVdlmF5s9MFowe tNzw== 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=IxUitNmcKfvxEmpW+0pRzzeuEr0YPZuYrEHpJHWrZps=; b=L/vQKgfYmx9DEsa0o/0ACi2XXg9duFe2XTMFTIjzNmHGHOeAqV+Loummk8uIh/7If5 zlNygbxqsxaA0XdSPGuEweRznJ62fIwXYoQEnfIqDBleFZ7FawOwuRyeg926K6FFu5RG IVz7Hy7+bLQ9raswFObqgM74uQBaJEUl51RGnmLmGdXoNMvOxBIkB86kEgBgu1UkMMmX fxyn7V0nh+ml9DsDgvx3ZFlc90wLLO6B+4UVt2EkpTTfTwE8gpjhq5DHrm8smU310ShK CEM5KqPm+olAJEjmeQ7iCExzdGbIw8bNXRWWggWQfYk8TPyO4GlF9ygal8JRVfEvNGuG BuIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kTqYPLOm; 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 y50si4737688edd.237.2019.10.10.17.28.39; Thu, 10 Oct 2019 17:28:39 -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=kTqYPLOm; 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 S1727709AbfJKA2f (ORCPT + 22 others); Thu, 10 Oct 2019 20:28:35 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:38229 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727667AbfJKA2e (ORCPT ); Thu, 10 Oct 2019 20:28:34 -0400 Received: by mail-lf1-f65.google.com with SMTP id u28so5722556lfc.5 for ; Thu, 10 Oct 2019 17:28:31 -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=IxUitNmcKfvxEmpW+0pRzzeuEr0YPZuYrEHpJHWrZps=; b=kTqYPLOm4wkOer6jQLN5gXRo5/W99qjv/h0pNIhkC9Ld+vW4Z+/itjrilnApQ2JV2J TTWqfjhzT39OjcRXZQLH8WwhLYpDhXrr+t9IOYUK9UdEhhkN6J015Y57WnoYWF/1Fm4o fDOWOcP9H6AQPh3K8REifyxBGiaZJpDkSu4Z0qX5TwElBrZNVKrTnI20OzTm2hNz2+rb qh2Mk/1hUCT2Vz3vAbU9o6YoliEGiGn3QBwM+Oiz4PeCvHHS4iE3/pZ11Fgd9NkIKB1v eoovDJSYruFUOZDr1MGwaSzpJW23LpPLjxnioiLCQuw5aMuBjU+oURZSl5Q7abTzX1qq P5cQ== 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=IxUitNmcKfvxEmpW+0pRzzeuEr0YPZuYrEHpJHWrZps=; b=NT0cJAn5nojM/t3hEoVe+G+WMwuiMM76brTioTibR5aYvqEWM1EC231Hb96mn6CUwv erPW1z3yKKlzmbX8U7nt0uR0z5wRRihb21+jX1PfJLZ+zRNZZ8YNeHIJu8vQpmYWEYKu CbbLHW+E+TqRg27mgCjah380WGKhnuXKQhrlf/3B5b3qhHWaik2XVB1eMxrD3kws2KzK JBFJZR6xMrvSOE+72z5RSrJaUuCUMH4dKqh0jXpueuJ5SaBlKn2eqh1wioY96CkFBC4I pny/AUlxxtRV1BGTcOmp1pIWbLWPV4d+2d4wVVVM83V3ExXYws+GW4+M5IiB95T+uMy3 /7Uw== X-Gm-Message-State: APjAAAU2PAjtA/nlOss9jakKQnSor2Mtm8RGLCJB8W8PsZV92fP/fs66 xtYoxMxFMvSvMsCU8j2l6ce6Tg== X-Received: by 2002:ac2:42c7:: with SMTP id n7mr4905180lfl.138.1570753710432; Thu, 10 Oct 2019 17:28:30 -0700 (PDT) Received: from localhost.localdomain (88-201-94-178.pool.ukrtel.net. [178.94.201.88]) by smtp.gmail.com with ESMTPSA id 126sm2367010lfh.45.2019.10.10.17.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:28:29 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, ilias.apalodimas@linaro.org, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v5 bpf-next 07/15] samples/bpf: add makefile.target for separate CC target build Date: Fri, 11 Oct 2019 03:28:00 +0300 Message-Id: <20191011002808.28206-8-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Makefile.target is added only and will be used in sample/bpf/Makefile later in order to switch cross-compiling to 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..7621f55e2947 --- /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 intended +# to be build for target board, target board can be host of course. Added to +# build binaries to run not on host system. +# +# Sample syntax +# tprogs-y := xsk_example +# Will compile xsk_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 +# +# Derived 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 Fri Oct 11 00:28:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175896 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp42128ill; Thu, 10 Oct 2019 17:29:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3S1lNG3Wn3d9nauNhriSqeNqI2o0PMii7K59BiPuD53Zh/qhqUcUV53d2jMI+vAkG+fNk X-Received: by 2002:a17:906:e89:: with SMTP id p9mr10823688ejf.95.1570753762674; Thu, 10 Oct 2019 17:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570753762; cv=none; d=google.com; s=arc-20160816; b=IVy/rpY3R3Nu/hTX5cmdPLYFXS95VlCXRDT8Mxs5/8IeJ4rV9Zw8GP5ak6ORIjwF8V Qw07h5KoimoamvqP4LgzpKR6MXCu7+LgGf+kIubRAut3AXTu5IWt6BiyGR3lpxgD6MWM PrLr6VQhrKDTyLdHGFuIX0/h4VDL27Avtmu2+BJ5T9lshe57q5B2H2/LVW2y99WxpS6s ylRORi8iz9TRyfcWoqIebyzmlHhh3lVn6aQkOnSBGH8mxVQ0+iGoZEDFsb2Wi3+VQ899 YFY4dDYW3xBCFIj6QEwJuTtHlAdKXsoYKkcWCC0OoTOClAsmjhUzEaSka/S5Ma/w+epR 9yRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=M7M9P1nOh5u0u0U5RBRymVMGVBKZgCwkvUp/NKJyprc=; b=AeI8xjeIAoZ6XQOpgskjS+Nyh5zyxbI5afjugoUp4SNtDaAw9IrWCBB3Bjx8lxU8dh vxl4+xFj3aeU8Fd6lLx1JAYJOwDVvRmlcwTE2WF80bLLLWsH6/TYw0tAJFPVo5kRIjvh bLG+mkYEKTIBUvsD9jQCQYrbR4M3afcJI2sy8iivL0noP3x5LB32hMLHyojcRZz+LFtt GV9Agyb0keRYQlihuFBI2vowEaWVAg7KRVLO70d20vHRCANnMqXpyYGk3mLugeOFrA+/ SlaVFT7oiYJ8Ir0LrJ9fHOBZnXtH7rgEgq9102Vls4OgIRBMnZFmF2m385MYiEppZnZI qHOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ibYg0paF; 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 gz11si4336801ejb.341.2019.10.10.17.29.22; Thu, 10 Oct 2019 17:29:22 -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=ibYg0paF; 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 S1727953AbfJKA3V (ORCPT + 22 others); Thu, 10 Oct 2019 20:29:21 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34295 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727677AbfJKA2f (ORCPT ); Thu, 10 Oct 2019 20:28:35 -0400 Received: by mail-lj1-f196.google.com with SMTP id j19so8070466lja.1 for ; Thu, 10 Oct 2019 17:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M7M9P1nOh5u0u0U5RBRymVMGVBKZgCwkvUp/NKJyprc=; b=ibYg0paFoKo1uWW2ZohFNjD1dit5TC7SSo9UxWFEhTZuMRWCAZYERaHiqsx5GbMMSt JPpuMpWPXyK5ARUbSM2PyJ0BbnRWXAMy+sn/LVb7cfbhfaSTnnFZWnpEzhruB9aUqVMx 84Rg/UsjnI18+4zlOoUlu2wGLESMn2ADGtIHOzPrYSWQjTyhSQ9PzH+2viAhYJEAtnKL l1K9/Bz+aOCQRpd18IecoNgKhpNlsaetrRdfB9E3rcJwxxnW2OS4Kt65Cv+SlBF2s74V xHzn33MZujh9yUTsypo6q2ADqX3EhMX/t1Z8YcC8CiEj1dw9Dw2yvaguJbj6DvVAFeou SJlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M7M9P1nOh5u0u0U5RBRymVMGVBKZgCwkvUp/NKJyprc=; b=omvXKDHCe0ecVKmrkHcn6y6gabh4xXTEndfLtzxR+ODFdFuaG0cGus0trvy7jpGBn1 FVVlWNAN306jzwxcyXlpOiqd9MB6Yj+zuhdIVk1835OAgI0eKAm2GHlP+8NM2mdUduMF P0pO/u/DUCxYtPrmjKd8aPA+nxRW8W/0nKAoCoPY6fH3Njr6daIYLFVUpi9M9iOgbv+X 2G6mDU/hO5pVxLzrqN/OZdgqYf0TZ/r4gEThW98zhXUQhysCrr0Wpjc4+QH9jvexYrN2 SyH/JNrt8XMEwPouJ2TSJmnDWV0FDJzs971iHmL5S8O7Vh5aoCu80X/tUN2opAChFUPH Q4qw== X-Gm-Message-State: APjAAAU+BcmiIZe2EsTXmJR0EyRmN7r+8vemXQw0DsfCuUySnHL15HF4 DrdOXcLQTp/+KVOup0rFtIo1Ug== X-Received: by 2002:a2e:a0c9:: with SMTP id f9mr7869876ljm.77.1570753711744; Thu, 10 Oct 2019 17:28:31 -0700 (PDT) Received: from localhost.localdomain (88-201-94-178.pool.ukrtel.net. [178.94.201.88]) by smtp.gmail.com with ESMTPSA id 126sm2367010lfh.45.2019.10.10.17.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:28:31 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, ilias.apalodimas@linaro.org, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v5 bpf-next 08/15] samples/bpf: base target programs rules on Makefile.target Date: Fri, 11 Oct 2019 03:28:01 +0300 Message-Id: <20191011002808.28206-9-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The main reason for that - HOSTCC and CC have different aims. HOSTCC is used to build programs running on host, that can cross-comple target programs with CC. It was tested for arm and arm64 cross compilation, based on linaro toolchain, but should work for others. So, in order to split cross compilation (CC) with host build (HOSTCC), lets base samples on Makefile.target. It allows to cross-compile samples/bpf programs with CC while auxialry tools running on host built with HOSTCC. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 135 ++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 66 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index bb2d976e824e..91bfb421c278 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -4,55 +4,53 @@ BPF_SAMPLES_PATH ?= $(abspath $(srctree)/$(src)) TOOLS_PATH := $(BPF_SAMPLES_PATH)/../../tools # List of programs to build -hostprogs-y := test_lru_dist -hostprogs-y += sock_example -hostprogs-y += fds_example -hostprogs-y += sockex1 -hostprogs-y += sockex2 -hostprogs-y += sockex3 -hostprogs-y += tracex1 -hostprogs-y += tracex2 -hostprogs-y += tracex3 -hostprogs-y += tracex4 -hostprogs-y += tracex5 -hostprogs-y += tracex6 -hostprogs-y += tracex7 -hostprogs-y += test_probe_write_user -hostprogs-y += trace_output -hostprogs-y += lathist -hostprogs-y += offwaketime -hostprogs-y += spintest -hostprogs-y += map_perf_test -hostprogs-y += test_overhead -hostprogs-y += test_cgrp2_array_pin -hostprogs-y += test_cgrp2_attach -hostprogs-y += test_cgrp2_sock -hostprogs-y += test_cgrp2_sock2 -hostprogs-y += xdp1 -hostprogs-y += xdp2 -hostprogs-y += xdp_router_ipv4 -hostprogs-y += test_current_task_under_cgroup -hostprogs-y += trace_event -hostprogs-y += sampleip -hostprogs-y += tc_l2_redirect -hostprogs-y += lwt_len_hist -hostprogs-y += xdp_tx_iptunnel -hostprogs-y += test_map_in_map -hostprogs-y += per_socket_stats_example -hostprogs-y += xdp_redirect -hostprogs-y += xdp_redirect_map -hostprogs-y += xdp_redirect_cpu -hostprogs-y += xdp_monitor -hostprogs-y += xdp_rxq_info -hostprogs-y += syscall_tp -hostprogs-y += cpustat -hostprogs-y += xdp_adjust_tail -hostprogs-y += xdpsock -hostprogs-y += xdp_fwd -hostprogs-y += task_fd_query -hostprogs-y += xdp_sample_pkts -hostprogs-y += ibumad -hostprogs-y += hbm +tprogs-y := test_lru_dist +tprogs-y += sock_example +tprogs-y += fds_example +tprogs-y += sockex1 +tprogs-y += sockex2 +tprogs-y += sockex3 +tprogs-y += tracex1 +tprogs-y += tracex2 +tprogs-y += tracex3 +tprogs-y += tracex4 +tprogs-y += tracex5 +tprogs-y += tracex6 +tprogs-y += tracex7 +tprogs-y += test_probe_write_user +tprogs-y += trace_output +tprogs-y += lathist +tprogs-y += offwaketime +tprogs-y += spintest +tprogs-y += map_perf_test +tprogs-y += test_overhead +tprogs-y += test_cgrp2_array_pin +tprogs-y += test_cgrp2_attach +tprogs-y += test_cgrp2_sock +tprogs-y += test_cgrp2_sock2 +tprogs-y += xdp1 +tprogs-y += xdp2 +tprogs-y += xdp_router_ipv4 +tprogs-y += test_current_task_under_cgroup +tprogs-y += trace_event +tprogs-y += sampleip +tprogs-y += tc_l2_redirect +tprogs-y += lwt_len_hist +tprogs-y += xdp_tx_iptunnel +tprogs-y += test_map_in_map +tprogs-y += xdp_redirect_map +tprogs-y += xdp_redirect_cpu +tprogs-y += xdp_monitor +tprogs-y += xdp_rxq_info +tprogs-y += syscall_tp +tprogs-y += cpustat +tprogs-y += xdp_adjust_tail +tprogs-y += xdpsock +tprogs-y += xdp_fwd +tprogs-y += task_fd_query +tprogs-y += xdp_sample_pkts +tprogs-y += ibumad +tprogs-y += hbm # Libbpf dependencies LIBBPF = $(TOOLS_PATH)/lib/bpf/libbpf.a @@ -111,7 +109,7 @@ ibumad-objs := bpf_load.o ibumad_user.o $(TRACE_HELPERS) hbm-objs := bpf_load.o hbm.o $(CGROUP_HELPERS) # Tell kbuild to always build the programs -always := $(hostprogs-y) +always := $(tprogs-y) always += sockex1_kern.o always += sockex2_kern.o always += sockex3_kern.o @@ -170,29 +168,32 @@ always += ibumad_kern.o always += hbm_out_kern.o always += hbm_edt_kern.o -KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/bpf/ -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf - -HOSTCFLAGS_bpf_load.o += -Wno-unused-variable - -KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf -HOSTLDLIBS_tracex4 += -lrt -HOSTLDLIBS_trace_output += -lrt -HOSTLDLIBS_map_perf_test += -lrt -HOSTLDLIBS_test_overhead += -lrt -HOSTLDLIBS_xdpsock += -pthread - ifeq ($(ARCH), arm) # Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux # headers when arm instruction set identification is requested. ARM_ARCH_SELECTOR := $(filter -D__LINUX_ARM_ARCH__%, $(KBUILD_CFLAGS)) BPF_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) -KBUILD_HOSTCFLAGS += $(ARM_ARCH_SELECTOR) +TPROGS_CFLAGS += $(ARM_ARCH_SELECTOR) endif +TPROGS_LDLIBS := $(KBUILD_HOSTLDLIBS) +TPROGS_CFLAGS += $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) +TPROGS_CFLAGS += -I$(objtree)/usr/include +TPROGS_CFLAGS += -I$(srctree)/tools/lib/bpf/ +TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ +TPROGS_CFLAGS += -I$(srctree)/tools/lib/ +TPROGS_CFLAGS += -I$(srctree)/tools/include +TPROGS_CFLAGS += -I$(srctree)/tools/perf + +TPROGCFLAGS_bpf_load.o += -Wno-unused-variable + +TPROGS_LDLIBS += $(LIBBPF) -lelf +TPROGLDLIBS_tracex4 += -lrt +TPROGLDLIBS_trace_output += -lrt +TPROGLDLIBS_map_perf_test += -lrt +TPROGLDLIBS_test_overhead += -lrt +TPROGLDLIBS_xdpsock += -pthread + # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang LLC ?= llc @@ -283,6 +284,8 @@ $(obj)/hbm_out_kern.o: $(src)/hbm.h $(src)/hbm_kern.h $(obj)/hbm.o: $(src)/hbm.h $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h +-include $(BPF_SAMPLES_PATH)/Makefile.target + # asm/sysreg.h - inline assembly used by it is incompatible with llvm. # But, there is no easy way to fix it, so just exclude it since it is # useless for BPF samples. From patchwork Fri Oct 11 00:28:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175894 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp41933ill; Thu, 10 Oct 2019 17:29:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOhBmOToy8WGaymjcvtaW9SYcjQmt+En3krZS+8nNr7UFNZMFMkgvapGfcGUVx/DntQoGi X-Received: by 2002:aa7:c303:: with SMTP id l3mr10974422edq.234.1570753749929; Thu, 10 Oct 2019 17:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570753749; cv=none; d=google.com; s=arc-20160816; b=d5aK2okw9vvxSPRzNp9CRvJwt8oHHqfbu4qXoRLu57tkk9QgfQ68s6zkFF0NZWP+v5 8zhd6Ih5+hY80+ryvS5qi3Yu6UPS6XY5HnbrFSYj3gs8dnB9agA2/KXpuXTVlgM9Tdu+ NWULhw25De++/5RnnlcOGlHwXn2sdo7LAwLURWO/GIzcaS75blaNBtNv2ymNvl+dw9oy 0iYmA9a851FZ3XK41GU8oLdqSNSe49wEoslsii59oxP4NobcCCz8hfhkEGveVJjeskZ/ VFxSG6aHoNHZbmN8/iQEFWYyQBCjmWpQlH73ltGVloOabEhNfz0dII8xxSoEC5f7YAus ATkQ== 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=03GhUEVVPKzA4TMKrHg2hN3Csg5CX1o2irsu+gSocso=; b=sdAiTrLxmyOBNHde4Biyci9tVxDfpaSBGW9aqqTAmcw2fIe4RyjJ7Jzab9f25iZiKO PE39XAE69yj3jO8IK5Kdo5dtMuw21/G6vMfatOUhnm15Py60XwcV0vMYiJzuTZ5kq5FN epgoCeOpA0awKAwLfEH1QMZNjr4/UiVEHP757Y78XdCW6GZ5H9oXoCeaDixXYiJw7QXn U0fbk9Ogo2aQ6IueiR06q8y+LZ/tTz6Yj39mJ9/sBGzxnaGymxO0WjTWQ6eF7sUXjVTJ JOlehOmXdthj5I0S+BfupozLDFtSUsBfCKXQvgsblbzncLnU/vIdxdCsDEf+S79fsQHY p7YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lgPdUOsd; 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 q13si4316695eju.46.2019.10.10.17.29.09; Thu, 10 Oct 2019 17:29:09 -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=lgPdUOsd; 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 S1727925AbfJKA3H (ORCPT + 22 others); Thu, 10 Oct 2019 20:29:07 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:42479 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727695AbfJKA2g (ORCPT ); Thu, 10 Oct 2019 20:28:36 -0400 Received: by mail-lf1-f68.google.com with SMTP id c195so5709976lfg.9 for ; Thu, 10 Oct 2019 17:28:33 -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=03GhUEVVPKzA4TMKrHg2hN3Csg5CX1o2irsu+gSocso=; b=lgPdUOsdWvm3NrU+k0qDkNxtB02GwhSc5KwzTrCweHYaxGN3NwSL194iDLlMKbHnkv HQsLrmFRtK/MtY3s/t6lnF+dn79c9z+krOQUQchJEDuQ1x5wj40QtHKQGOOzwMr6pRkZ m5Vkk9C5vFXa/NWObQzlISQO4YdbJs44MBjE2Xjous5QWHXDZlr5DcIOTBFHkyeEGG61 WF5Q7LTNZe3DrJVHzyS/VSxTW8rou+w2JR/RdhCDReKxj3Ac/8BRWjvZzNJle1gTsy0r gvhuogyNpORJ/IMHS8eJ+Y6UViz1GyjAt2gUp2tjQrsb1BfdiOFJaLYy7NLhBHyRChj0 y2Pw== 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=03GhUEVVPKzA4TMKrHg2hN3Csg5CX1o2irsu+gSocso=; b=Z55REVOcbJQPNMFU+LI6jVZes/kxzgG8NZIAQHWhErPV7UfOFI67pHeTp1OL3Bqpmf i+DgiENvbwkky9USSM/xi8uLh+i/UFeAonKOEBf4tB8brB4Nyyi9a8OKqvoYr23IB91N rN8Jd1mblAhT9gVnilULh77RjfCy1BqkHh81sg0GIRrnZKYs2t3l54JFF+b7FrZ4dXo5 jRjzsSLMUjcouDiDDt7iANlJiGAC+zELC+p26HZ5EOH83zMlRLVG+3Rud52jDxXiBmdX gsdjatMlE4PmewtlwfA66qnKZTFjZqaujseWOO/9jGIiu0pPKjZUmvzVjx3HlFYKXs+z Gt1Q== X-Gm-Message-State: APjAAAVEwQXQv1i5+2PNAN/kcR1Ntcvdyu4cTDPt70xw3zSuu/y0FAg9 Rx2p4A1sOw0BMLXnv82/9KnHzw== X-Received: by 2002:ac2:43d9:: with SMTP id u25mr7678515lfl.142.1570753713044; Thu, 10 Oct 2019 17:28:33 -0700 (PDT) Received: from localhost.localdomain (88-201-94-178.pool.ukrtel.net. [178.94.201.88]) by smtp.gmail.com with ESMTPSA id 126sm2367010lfh.45.2019.10.10.17.28.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:28:32 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, ilias.apalodimas@linaro.org, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v5 bpf-next 09/15] samples/bpf: use own flags but not HOSTCFLAGS Date: Fri, 11 Oct 2019 03:28:02 +0300 Message-Id: <20191011002808.28206-10-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While compiling natively, the host's cflags and ldflags are equal to ones used from HOSTCFLAGS and HOSTLDFLAGS. When cross compiling it should have own, used for target arch. While verification, for arm, arm64 and x86_64 the following flags were used always: -Wall -O2 -fomit-frame-pointer -Wmissing-prototypes -Wstrict-prototypes So, add them as they were verified and used before adding Makefile.target and lets omit "-fomit-frame-pointer" as were proposed while review, as no sense in such optimization for samples. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 91bfb421c278..57a15ff938a6 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -176,8 +176,10 @@ BPF_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) TPROGS_CFLAGS += $(ARM_ARCH_SELECTOR) endif -TPROGS_LDLIBS := $(KBUILD_HOSTLDLIBS) -TPROGS_CFLAGS += $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) +TPROGS_CFLAGS += -Wall -O2 +TPROGS_CFLAGS += -Wmissing-prototypes +TPROGS_CFLAGS += -Wstrict-prototypes + TPROGS_CFLAGS += -I$(objtree)/usr/include TPROGS_CFLAGS += -I$(srctree)/tools/lib/bpf/ TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ From patchwork Fri Oct 11 00:28:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175895 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp41951ill; Thu, 10 Oct 2019 17:29:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmlVAqlWVhkqllzDsd6griKY48eff6qLvz6kYntiLNWomgbcUD97jT+aLZhKKUPhvqm8XP X-Received: by 2002:a05:6402:12ca:: with SMTP id k10mr10871442edx.91.1570753750772; Thu, 10 Oct 2019 17:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570753750; cv=none; d=google.com; s=arc-20160816; b=CZA4KCc/xamvacJBn4YFm1VaFuPhAMe36gjAEH6bbXKl88uGjh5ySbDeYHu52hbTzh eXR9ksVDMU7Xdl6CvEv3CINMZnNQcQu0j+Xn37enp6UdfyWfT6yUBiDiMp1sqRM6sePt 4rTzLKMuQVSPfGYPIk64n8ptIqA1XxKfyWlxKR62rLqRquAU/ET0HjFiLbgVDTWCAfOK OYj7sc5UNIlvV8+iFpZLiG47sbYtWlgl6ULJfF1JtZDpi/Q8axMwRQnhApUtXPoL5VwM sW/vNuo3ghQ29IpuZzZ5x7vuRd1ZLg4Vpjb9mVRpLVVEQ+3DqNhpkmN0oa59M4UIPAhR eTzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=wbL2nu6acnton90gIbsX5qxq9tLlNkmN4RUryN8fm7M=; b=SPSTjmmbrE0fi5o04kLFEHRiZ4AYHdET/n6s4jSW7RW6RoxFAR5mcPLyHOhR35xrcH 28HMhg3aWOmitlk0wPxPAi7SCTyLVrVnX5gWhxfANiXkD0d+1FRqLsfiREbHBUHWHfan mRdb9VhLkfT4Sr5jmp2sTu77h9IPFt0TpPXxQLaiJRUodvBHBxA+4w8oxO0QVfGgjI3m wQcDN3n0gMox3Gayfp4nDQR+QBU3CJdDgeKLRJRbCWCaiF22OAua0uhq9UwoKyD86EbV EUiJufWSeu7cfc+WIZIV25RLXDAKDK5VuD/14pqe2mUguxV762j+3S5o7rn0bd+2SHmC Ao5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KZ4g7bs4; 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 q13si4316695eju.46.2019.10.10.17.29.10; Thu, 10 Oct 2019 17:29:10 -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=KZ4g7bs4; 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 S1727913AbfJKA3G (ORCPT + 22 others); Thu, 10 Oct 2019 20:29:06 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38076 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727731AbfJKA2h (ORCPT ); Thu, 10 Oct 2019 20:28:37 -0400 Received: by mail-lj1-f196.google.com with SMTP id b20so8033543ljj.5 for ; Thu, 10 Oct 2019 17:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wbL2nu6acnton90gIbsX5qxq9tLlNkmN4RUryN8fm7M=; b=KZ4g7bs4fOSGzk9FRyjF0hoqEh7hKsbUdY26yluEIfz8HrbcVogNxnuyoe/hxPcvfY TkU3hAUOhkLrtq5AzSARGyoZtpIAwa6YiJutpgj2IfhDFd7rccQbQb6TXAJO3UHkSoTS KVLv4z+Y+wn1/bGde0X3XLQCzqxwzgrKWEYXuOOv5w100VI2wuVg8Z1pJWKOOw2QGMIu xAD92jGqtR5FbkoIFvEdmTYUmuUV51K4APESpxgabNPn1RethPshg4jMreKr/ZBPFC6Z mKPdfQ4ukG2GmYFcT5pC+tXxG/DwLE1KaehHzD/wBCkNIFKCnOdDqIYiyjJkoVevysU6 FEtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wbL2nu6acnton90gIbsX5qxq9tLlNkmN4RUryN8fm7M=; b=Z9u/qxDhqulgJYEhEtLbx7KvmYuKqGcb6Qs2Kf3pAcusjexfFsuE4n1fjTbIQc8lWQ OG8dpu4fSjJJMeMLH2YAdTMN04H0B05kQ5HS/5gBM3NhOoUNYArLxQF2a1PZKGzzh38e SPuDizg4zsG8E3sL4R7AGjpp11yXYRWQT75IUuQbG7aBVDJs+CRTCqBBLm+KFU7eNiC2 qkLVqvks05fGL9am7SmyCYORHhw9MgjXUeJnf+AkS+XR2qEeZhBvc3PatzPdU4WS6HiL f8INVDR4y8ZTeyytoxYsLaOo8FnJji0OQ0xijWc1i8Qczu+PlePCoiz4F7PrtN77Ej4V z4cQ== X-Gm-Message-State: APjAAAVTZUapbbf+XRz8JKYMsRj3rpHUs/+7WHntbwqrsoBVdZjXvCUJ /9GGdsNNi4VVxZ9hx3YBNn/pDg== X-Received: by 2002:a2e:89c4:: with SMTP id c4mr7438097ljk.65.1570753714541; Thu, 10 Oct 2019 17:28:34 -0700 (PDT) Received: from localhost.localdomain (88-201-94-178.pool.ukrtel.net. [178.94.201.88]) by smtp.gmail.com with ESMTPSA id 126sm2367010lfh.45.2019.10.10.17.28.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:28:33 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, ilias.apalodimas@linaro.org, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v5 bpf-next 10/15] samples/bpf: use target CC environment for HDR_PROBE Date: Fri, 11 Oct 2019 03:28:03 +0300 Message-Id: <20191011002808.28206-11-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No need in hacking HOSTCC to be cross-compiler any more, so drop this trick and use target CC for HDR_PROBE. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 57a15ff938a6..a6c33496e8ca 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -205,15 +205,14 @@ BTF_PAHOLE ?= pahole # Detect that we're cross compiling and use the cross compiler ifdef CROSS_COMPILE -HOSTCC = $(CROSS_COMPILE)gcc CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%)) endif # Don't evaluate probes and warnings if we need to run make recursively ifneq ($(src),) HDR_PROBE := $(shell printf "\#include \n struct list_head { int a; }; int main() { return 0; }" | \ - $(HOSTCC) $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \ - echo okay) + $(CC) $(TPROGS_CFLAGS) $(TPROGS_LDFLAGS) -x c - \ + -o /dev/null 2>/dev/null && echo okay) ifeq ($(HDR_PROBE),) $(warning WARNING: Detected possible issues with include path.) From patchwork Fri Oct 11 00:28:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 175893 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp41823ill; Thu, 10 Oct 2019 17:28:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYjkeh2HkHkSQQx9jZqzzbzcrusPz7hgcRYkO6JLg4nEfA0ZqV2BPQOHZH109UASCnjFMw X-Received: by 2002:a50:cb86:: with SMTP id k6mr10882707edi.270.1570753738411; Thu, 10 Oct 2019 17:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570753738; cv=none; d=google.com; s=arc-20160816; b=Kq0ZIBKhk4k/+TeVbWuzrBbmGQSsXiy+n/M12pa04MoiCC7IzxRRqrSp+kLR1fQDoF 3qiOxxZbkP99fP1OoH5/+AiFai5KkOfkTlcclDncNDbmtFdFXIb4nu6urhZQh/0Lrl6p /TOc3w8kxw1ZlzRQoKwdjGn4aTy2ZUfIXNjLxgo+9xUm9lyZsKyPDu8oWBRqodbfhJ6w Q9XkMwBt71cXfi93ttZJYThIq2OulDGY6NE48FvSHuKxcbN4iATzGgDMbizjz3npZ/pE iXJQmLjGrH6mcCGiH8kzOxAKfQ8TnNShEGp4+lvnApLun+8nUsVDeZmwgYZO7o65gumh NviQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=oHm0qgs35bdRmF9F1S/p3tYJstCeeDVx8Vw6XCI5qDc=; b=jssh/bzRvnUcRgzpZYSRdYdJkaR2yBJDJ6yDD5P6WPC6MmBQMQhTBS2IegrtRSFwVv dWSKIvphPHF4rh2gapzaaPLVC7g202auVR7T9EoiMGZexoCSkisHBkfjVyDezMmz88Co imoJY5TX8YID3XgzU54j33+vkHpN1AONDc2IGkj43UaoMtv6MA9SvDNKqXZ9v1LGwLbA d9yH9lbwFSZPi5ZSJunqvx/HlUZtUbxTGKy6Ik3RYB1poIAVk5/tfWEmIlhy9ZMWGL0h iP6NtT6j27XFd6PLxXWtOLwcDYGmGwZDgh31Po/2LJVjvWRHrYJ6OX7EaaI9sQHWrD58 UKUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oZoFP4EB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ch6si4078440ejb.275.2019.10.10.17.28.58; Thu, 10 Oct 2019 17:28:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oZoFP4EB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727785AbfJKA2k (ORCPT + 22 others); Thu, 10 Oct 2019 20:28:40 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35502 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727721AbfJKA2h (ORCPT ); Thu, 10 Oct 2019 20:28:37 -0400 Received: by mail-lj1-f196.google.com with SMTP id m7so8057200lji.2 for ; Thu, 10 Oct 2019 17:28:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oHm0qgs35bdRmF9F1S/p3tYJstCeeDVx8Vw6XCI5qDc=; b=oZoFP4EBvirEOvHM9IfrnbIXJxjTZbSW136oc9UH1jI/wbPjjRATuu7MjU2Rqqkd/z Q12GzulFKtOI+LJ0qj+5jNMmCVsXsm6Du5YO8D0p+tYMDdRNKcMbUISq9/l6pXtBklWP janUJ6/iEWpc64Iuj0bEjCQprSWEhsxeyDw24v0xm1+sb7yVT1l1O4BSA94dZdZnN8fq 0Rdo69y1azsmEHPwIxAdFVnnYGhRyV/skW/4qKuKKE+kQCbdICf5xLj3qVQDQgwjUp4z Em25qhXc2WFbbf826EgIg8xT5txDZCz845v5RT3V5P6kDssmNHcAoUYNkrA4/cxF2U5r wUhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oHm0qgs35bdRmF9F1S/p3tYJstCeeDVx8Vw6XCI5qDc=; b=hEQFkUSR1rYv4w52tTaOZ8qD7KTVCUSEy1xKFUt1zSI6V5nRWdGxnB0bG+zaS2c+kr 67rCSP00T33S3daAcm2a4lHnyIM+WIhPHSMghbhscYqnw8mTvyq7ozTVcx6SJDqeLVl3 U51wAUOumCSrOcztN2MAWx9DLW/U5v6OO14ecAuZV08mCnHBgwj/ubryxB+5C+TG1pLk dOCQbTWCIyfK7Sx0c8XCt9gkBO5ErZOagov+mp5EnXl1kycBrrmwmXe/AArBQn9ISHrf 94v0lG4AS16xRON4welQn/ztAC2RVoXVsuuaOOPiVSHym/6VPUU+b5rD+11CkKp1ecyj I/Xw== X-Gm-Message-State: APjAAAWFA38y9/e/KFaPViZWGP9BSuZdkb6Tp7EEQasHKNN6ZyX5qAyS KVjBpnuusQ0329EV0QMGEni6KQ== X-Received: by 2002:a2e:658f:: with SMTP id e15mr7832403ljf.254.1570753715857; Thu, 10 Oct 2019 17:28:35 -0700 (PDT) Received: from localhost.localdomain (88-201-94-178.pool.ukrtel.net. [178.94.201.88]) by smtp.gmail.com with ESMTPSA id 126sm2367010lfh.45.2019.10.10.17.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:28:35 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, ilias.apalodimas@linaro.org, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v5 bpf-next 11/15] libbpf: don't use cxx to test_libpf target Date: Fri, 11 Oct 2019 03:28:04 +0300 Message-Id: <20191011002808.28206-12-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> References: <20191011002808.28206-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No need to use C++ for test_libbpf target when libbpf is on C and it can be tested with C, after this change the CXXFLAGS in makefiles can be avoided, at least in bpf samples, when sysroot is used, passing same C/LDFLAGS as for lib. Add "return 0" in test_libbpf to avoid warn, but also remove spaces at start of the lines to keep same style and avoid warns while apply. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/Makefile | 18 +++++------------- .../lib/bpf/{test_libbpf.cpp => test_libbpf.c} | 14 ++++++++------ 2 files changed, 13 insertions(+), 19 deletions(-) rename tools/lib/bpf/{test_libbpf.cpp => test_libbpf.c} (61%) -- 2.17.1 diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index 1270955e4845..46280b5ad48d 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -52,7 +52,7 @@ ifndef VERBOSE endif FEATURE_USER = .libbpf -FEATURE_TESTS = libelf libelf-mmap bpf reallocarray cxx +FEATURE_TESTS = libelf libelf-mmap bpf reallocarray FEATURE_DISPLAY = libelf bpf INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi @@ -142,15 +142,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \ VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \ grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l) -CMD_TARGETS = $(LIB_TARGET) $(PC_FILE) - -CXX_TEST_TARGET = $(OUTPUT)test_libbpf - -ifeq ($(feature-cxx), 1) - CMD_TARGETS += $(CXX_TEST_TARGET) -endif - -TARGETS = $(CMD_TARGETS) +CMD_TARGETS = $(LIB_TARGET) $(PC_FILE) $(OUTPUT)test_libbpf all: fixdep $(Q)$(MAKE) all_cmd @@ -190,8 +182,8 @@ $(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN) $(OUTPUT)libbpf.a: $(BPF_IN) $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ -$(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a - $(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@ +$(OUTPUT)test_libbpf: test_libbpf.c $(OUTPUT)libbpf.a + $(QUIET_LINK)$(CC) $(INCLUDES) $^ -lelf -o $@ $(OUTPUT)libbpf.pc: $(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \ @@ -266,7 +258,7 @@ config-clean: $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null clean: - $(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \ + $(call QUIET_CLEAN, libbpf) $(RM) $(CMD_TARGETS) \ *.o *~ *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) .*.d .*.cmd \ *.pc LIBBPF-CFLAGS bpf_helper_defs.h $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf diff --git a/tools/lib/bpf/test_libbpf.cpp b/tools/lib/bpf/test_libbpf.c similarity index 61% rename from tools/lib/bpf/test_libbpf.cpp rename to tools/lib/bpf/test_libbpf.c index fc134873bb6d..f0eb2727b766 100644 --- a/tools/lib/bpf/test_libbpf.cpp +++ b/tools/lib/bpf/test_libbpf.c @@ -7,12 +7,14 @@ int main(int argc, char *argv[]) { - /* libbpf.h */ - libbpf_set_print(NULL); + /* libbpf.h */ + libbpf_set_print(NULL); - /* bpf.h */ - bpf_prog_get_fd_by_id(0); + /* bpf.h */ + bpf_prog_get_fd_by_id(0); - /* btf.h */ - btf__new(NULL, 0); + /* btf.h */ + btf__new(NULL, 0); + + return 0; }