From patchwork Tue Sep 10 10:38: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: 173497 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp5609594ilq; Tue, 10 Sep 2019 03:38:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxqtFRZlGx9kKtZHOiZJo6fmHmgAxg1vVY0g5hZ9sHmvyGkO0TCSpxKuxpE/cSC5/k0aiR3 X-Received: by 2002:a17:906:c304:: with SMTP id s4mr24095530ejz.71.1568111921988; Tue, 10 Sep 2019 03:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568111921; cv=none; d=google.com; s=arc-20160816; b=bk+Qi4YOlzBcGG+rTuQwd98mommGY5UceT5kF77+kZQGXRM8lR1v3+zFHvdJyuDZlH K3t3R4L3tk/iWK3yfp05U2hZ+NJq/wQqd4qKi8/F2LhjLyrXXHQM6GI4usV1so34I+JB MGT4pDo1uyQL8eqjI/DEbl+6rNLCslJG4oCaSJUvjnjS5wr7DdW3apDgmt4FnPryqJB4 0D5p5aI6LIXLs8/6yNuJvFkOPhRnQMmcl9zIGrFlsrJb47HebGVLLrn8I3LwX5gUr09n aGV09lX6ITq7FNBqaTgKkX4ArY1JDzKohvTjtvCjfxk3H1M6azL3N8ZXt8Lo9x+BkRH5 HFgA== 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=NGKQzll/A9IaEu36OmTkFVayy8Bwv+m3n0iuRSm1M6Y=; b=AqxXnyBAsnN6Qdpqe2jBxXcwo+FmgqioVkmXHlVEepbCi1SrrbZ851qjYaksK5Pblh bccZa4HYxHPhEHiiI0hE0lR9y/iYL+Io8x1ln226Qa2cIYW/wWcCR/zJotnBKFOD5VO8 ijrPcoP4RAjXLsBGsyuGq/BGYq+jQW/Qsn9LgKT3V4NdFyzmvDDm4De1xzzA72/z3iJy 3J7Wibef7O1AqjQ7rX3jIU+q7O5ymg8G0qNFILGOKHuMWtRs8RUBeCvqkdl250MSDaPH iHC17b2nWciY3ddhUCQEW/UVjX7z23qaOpFE792K0CrAiObcvoudin8GQZtiYjgx0xFB XaWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ABzAt76o; 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 f12si8234488ejt.234.2019.09.10.03.38.41; Tue, 10 Sep 2019 03:38: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=ABzAt76o; 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 S2393806AbfIJKik (ORCPT + 27 others); Tue, 10 Sep 2019 06:38:40 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45931 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388984AbfIJKik (ORCPT ); Tue, 10 Sep 2019 06:38:40 -0400 Received: by mail-lj1-f196.google.com with SMTP id q64so5343711ljb.12 for ; Tue, 10 Sep 2019 03:38:39 -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=NGKQzll/A9IaEu36OmTkFVayy8Bwv+m3n0iuRSm1M6Y=; b=ABzAt76oNXU0+8r79M+Uq/vNmBPlKtTMxdiCXMEvHZE5RCKq3QqV2iBKiCEqCQMDfD 5MRDIcIUmhICZ3oxwsncRXUExmaAd9uO3zO0pf2FzyrZMXEgHWGUsMrthX1YCuT8uNr8 Fy0s+pdJsRFxY31Gq1uTHRY9vyjkZ4Lx/gplROpBnTB/nyNhoWEI9RhKa13TJTdcaqC9 qsDUhmIGRXpmc/qhpPCYEP73F4LEXLy/8Q1Cw3S1pNBR2BYa3qjcBMPKNVQUbuY7MZyb DEINpV16u8PrEGM44UFFxvEoPR+mFi0diwU1Esg8Xd3hntXMUtO/QSHNxqgy9MXXYTPm aZLw== 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=NGKQzll/A9IaEu36OmTkFVayy8Bwv+m3n0iuRSm1M6Y=; b=oJfX/eI7is2UBHuYKgTexX5+BkrydJuaOWeWNoD5JXSLGpuMR8bgIjxXYTSyW8KEC+ rDwuR+RbLATCNCy6EnSGQbjLT34kS3cqHQG+Y2Ho8oOV1lvZpHwHMBbhGP5hv4077r/i TsvFvy1zj3P3wsY4MTQZ5EDM/Lw1oGkqOYsW1MN3OzQ3khE5P7BtoDFHfDBp2+OZptKk rijfgAEifWiRj3Gv5vcBoTXx2fzVUDJR7kcgXXDEWWXfiGbB+OpqNRdGYESC0mMYr5AL 2QttP+TlTvlkjB/XvIQeRqA9cVB+sdUsB/0kwRyFLUIrHjDppkvRA64Nii9DKngjTAq6 EqQQ== X-Gm-Message-State: APjAAAWNsVfw1N6kyWksBLdWcREw9id7qTO3rwryPhmcLeFlNGoQs0u2 a0Pz+Ei54Kf4icRP8BKi0y1zJA== X-Received: by 2002:a2e:5456:: with SMTP id y22mr19750906ljd.60.1568111918957; Tue, 10 Sep 2019 03:38:38 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id g5sm4005563lfh.2.2019.09.10.03.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 03:38:38 -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 01/11] samples: bpf: makefile: fix HDR_PROBE "echo" Date: Tue, 10 Sep 2019 13:38:20 +0300 Message-Id: <20190910103830.20794-2-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190910103830.20794-1-ivan.khoronzhuk@linaro.org> References: <20190910103830.20794-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 on echo -e to handle \n correctly, but instead, replace it on 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 Tue Sep 10 10:38:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173498 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp5609633ilq; Tue, 10 Sep 2019 03:38:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+36tLSy8qCBnLH8OIaATOb5qH9ZliRS2it1BTJ/yx12qR0kgVw21ml8oGJQb/W7wPCqME X-Received: by 2002:a50:f418:: with SMTP id r24mr29423592edm.248.1568111925070; Tue, 10 Sep 2019 03:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568111925; cv=none; d=google.com; s=arc-20160816; b=LOaAyctyPC4C9J7wsi6FmDSiIcqPhIakqEXmGEnGyx0SSDVFz2Wm0puZ0VwjADGLDc ZwdmDSGK2RX2jVN+q6bDKtGUxfnClkLgtyC3TwW798l6TP4hrNZTzRKNMftU6O2L0fBL bWg3SkN+O8RJyXNtbLut7+T1ALbF5VV94D27ShR3Fnw78dxOGwGWNprf/a9XO8ZLz5w8 MP7uzh+yEHRcfLu5K0Oef03PoE4wt+zTgTWANvstc9J6uPXcXn78eP/wJ5Eg4OHcyMvC TcH1ZtxpP/BcYcTRoCTLRX2MokIOhFiKZMtFeu8/ad69As4XgPGRjuJQnnIDnW6w7pDJ EwJQ== 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=HSB3pC6OCIzwVYGBAJ0R7QI4CKajD+8ovp0KUKhem8g=; b=NH5QwL9uIwZNkmcF779vzfpHTInujoqNi3ezKQ7MwHedUumSGHuIAaj3zT0nkI7bOD WibhQx7qfQLhIsZ0yFGMIFk1z9lEkek9VVJGVO6MVf1FOl9Iv223qUx8rXnsaHvohMvA w6Va5nHN1lvuM8p0FNG34B/RGRdjzZa+Gf1mfJs27GJaqk1qLxn7dYq+73/8GV+W1B8e zM2YaH+uk+BiAWPftvHmrSK0g7jMW4TAdoksoKidRKKmvm9+gtb3T56CIOAY94aDG722 SbDbUDdrTbpQr/5yp4ozMjhywR0dsxa6LyqAB7972gMm5vyAwg+JrjpdG6bcNiSUp+gT YvIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BtxKUtJE; 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 f12si8234488ejt.234.2019.09.10.03.38.44; Tue, 10 Sep 2019 03:38:45 -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=BtxKUtJE; 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 S2406057AbfIJKio (ORCPT + 27 others); Tue, 10 Sep 2019 06:38:44 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:45120 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393845AbfIJKin (ORCPT ); Tue, 10 Sep 2019 06:38:43 -0400 Received: by mail-lf1-f66.google.com with SMTP id r134so13001561lff.12 for ; Tue, 10 Sep 2019 03:38:41 -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=HSB3pC6OCIzwVYGBAJ0R7QI4CKajD+8ovp0KUKhem8g=; b=BtxKUtJE9gTBoy7cQq768A85FEoTmttXAUMIXlqEYSl+FRdXX2kB5jdIbIAbVAuLka 1fVCV27e42wBzxjb/Bhz1Gw0GCUdkfeC/sqN0we0OmZzldeKYdu/7oDDYhIOSqfPekKL DtzSpGrwCW9FbqNs4HCAnpo187xcVH9uoY9+8CKqcNB99tyVhAKXsK4mNdbA3YDLG/cf UnohngwVbieXHXNgn34avvAKimIBbSljiBS4vPo7O1JyK/LWiGdHLdDScFNNTr3o4A76 o3YPptxKoKDvEn27JvOnnL7ymbXYrMZgR+KttC8F6NC7vu3bJXIHgLQhgZChos8nRSKs tuyg== 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=HSB3pC6OCIzwVYGBAJ0R7QI4CKajD+8ovp0KUKhem8g=; b=bcuGuiG4cXUE1k29FM/elmBUTAMxb7xf/p2ju/tbVu/7xee/hKAj+hFJ4lMu1eJ/mf /5NI3QxuIwPj1bzMeBFZtNZ0j/lEeOB8upT4kUFSPCgaVfSoGpzL5+DtoUjTiUMAhKyx N1rZbU10PaUvmKpQ0sHSJx5+TIWlwL8iG2OO1kq1kBx1fcKBQCx4qH926jw/XKLKptWF 2sdwoDw27ycsTOYb6ZwR5l1PeM5kX0VrUINJmJko1I8drL+2LORzTAWM/AQMv75J+B6x l1oiYekRvEkcDmo2RZ9F20d4BHm3zqprgKaDhdt5QUMCG3l5rQ+dw/yv6GkDWPZS8nI6 EEng== X-Gm-Message-State: APjAAAXWtQr9RDKXKvbtGRiDWO4r5b98jKdgM4oiM1GLckGuLm591NWm 9SeaChBVoCAmDE2yvQsuaEZCPg== X-Received: by 2002:a19:4f07:: with SMTP id d7mr281498lfb.161.1568111921277; Tue, 10 Sep 2019 03:38: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 g5sm4005563lfh.2.2019.09.10.03.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 03:38:40 -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 03/11] samples: bpf: makefile: use --target from cross-compile Date: Tue, 10 Sep 2019 13:38:22 +0300 Message-Id: <20190910103830.20794-4-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190910103830.20794-1-ivan.khoronzhuk@linaro.org> References: <20190910103830.20794-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. 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 43dee90dffa4..b59e77e2250e 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 Tue Sep 10 10:38: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: 173500 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp5609716ilq; Tue, 10 Sep 2019 03:38:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKo5nMca3YQMXId0FM6/M/UAHd3WHhO/EXwNU5IbYbEX9+9G/EpcDGYR4J9PgXN0S1mgnK X-Received: by 2002:a17:906:5393:: with SMTP id g19mr13593294ejo.256.1568111929747; Tue, 10 Sep 2019 03:38:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568111929; cv=none; d=google.com; s=arc-20160816; b=p4+Z7jgGd9Y4ef0SPG/XjshQD+ek/xvVT3SXV4GR3zUI/JPafjpoplIkZDRDCrGBTN Ump+fZIzd+YtOJ7ruMIzQmueI4A1ADctRZysuY4ZCdBHdLEJTy69GO9BG+DRe79YyDzg 1YbvwX31gOZHNeILXF6PPI4+k0Xa3bldMZHdBjFhtqdhUWEfYBxsiTEHJmp7aiUuDCMj ewCFKeDmhWQIE19PELJ1H7/PuV7yx706+jzNsOdanGagcFaSzdW7O1u8ZUvOV4duxdRm WfTO1eKnmNrj8C5vlNc539ulBsfUCWXJbe/V9YFsrEfgr1fUDNeIKzeMmXtdoLmN5RU7 S08A== 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=2CISuDOqpRrytITzE2bzjW1/55vOTPEJWp8ToeKeR/s=; b=nClb81qx4fF61T6EoD0KV9rIk+57ORczQgJtbtS5mPkzeFRGD+VU/dQfVyMaiLtMiB Nhfs/WuqPaBO07cRZzU1K/mN0EbaMwQSjciS1RLC2tqNf088pIseWZmUM8oHJtyjTh39 1+3XWL0qckj/Ze11880gm8qKHDuAT7qnqrXS5qYcuOFBKbcfw2Kdcru2BPVJ3tYsOqFH BJUnnhlqve7q7Q+WlrMoLKwKwVPcD4QrRPns4WLCc+7Vdz9Cpse32Mk3UEotZ2Ql8eqT HKa2KVgR5TraKQGWUylOcq0NI21PzCk7brmy851KjOZf2OfogRfc+goLkCTKSfu8r7+i impg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P7UfO+FT; 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 y9si8966603ejb.5.2019.09.10.03.38.49; Tue, 10 Sep 2019 03:38:49 -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=P7UfO+FT; 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 S2436559AbfIJKir (ORCPT + 27 others); Tue, 10 Sep 2019 06:38:47 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:45123 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406052AbfIJKip (ORCPT ); Tue, 10 Sep 2019 06:38:45 -0400 Received: by mail-lf1-f66.google.com with SMTP id r134so13001641lff.12 for ; Tue, 10 Sep 2019 03:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2CISuDOqpRrytITzE2bzjW1/55vOTPEJWp8ToeKeR/s=; b=P7UfO+FTl1bnzu58ITbd2c6ZsAqQrt8Qa1tZHEKjiRiiGqt4NsWRiu1jKrm7bdxgfl ORiWhKn4HTpMA7X/BlerAFmJfDj66KexpV3883rEICKB3oibNnHNbMTriwzuasJhOwhd 6U5eZvYvHKZgO3w6I4GkuD+ksR0NvR+5nMNkTwqMzO6QQF+QyIKbyxt8DPDSgk4ELsis hJxSS1nCRfzKd2XnW/zsh1U5A0kDPAUV2sEDRbeyjjB7JiOZsE6gxdVD5RVR5LrE2XNf d7CAthgXfH5bWJ5MBh3D+HX10ChBb/Sobj2KWiGwXwVb086DHwlDeknb9+lb07r3Ec3D PktQ== 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=2CISuDOqpRrytITzE2bzjW1/55vOTPEJWp8ToeKeR/s=; b=DbR194JWppXOEDgkib4t5ygrJbN5aqen4r+afVySCU1RzKKvj9fdycqEy1J0RS659o g0IWHlW5NZmKhTd3WBxyvpEvGdm8oXNlf/yiCQ7R4eQliAuGGDtmeLdnIyu+GtDjPA4e qir6Z4meD4yuHhi/0JFz13zUtf8VD8bGC5ElGJfpwVtGritnW8Bn6CO6Naj1dW+gkpXt YOMAAYfhwWDz7zGXiYzQXJ39V+MqRLYAxOhiLyjkhgqcY1vEvlG13LRSlb9uC5dEKJqq Loabl4l6VOXf2WAkgUSvwIjkm/M35ONWBkW0Wl+lhtjONhNo4vjrccUq4aVvtKBTo3g3 Bf/w== X-Gm-Message-State: APjAAAXrQJNGPEhj2lsqoALvmw+hVhhEyIzT2E61csdUezWRW1FlP6zL wv0aevkVSJhMPzVmuBiTZsBCSQ== X-Received: by 2002:a19:381a:: with SMTP id f26mr19784105lfa.168.1568111923667; Tue, 10 Sep 2019 03:38:43 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id g5sm4005563lfh.2.2019.09.10.03.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 03:38:43 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH bpf-next 05/11] samples: bpf: makefile: use D vars from KBUILD_CFLAGS to handle headers Date: Tue, 10 Sep 2019 13:38:24 +0300 Message-Id: <20190910103830.20794-6-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190910103830.20794-1-ivan.khoronzhuk@linaro.org> References: <20190910103830.20794-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 kernel headers are reused from samples bpf, and autoconf.h is not enough to reflect complete arch configuration for clang. But CLANG-bpf cmds are sensitive for assembler part taken from linux headers and -D vars, usually used in CFLAGS, should be carefully added for each arch. For that, for CLANG-bpf, lets filter them only for arm arch as it definitely requires __LINUX_ARM_ARCH__ to be set, but ignore for others till it's really needed. For arm, -D__LINUX_ARM_ARCH__ is min version used as instruction set selector. In another case errors like "SMP is not supported" for arm and bunch of other errors are issued resulting to incorrect final object. Later D_OPTIONS can be used for gcc part. --- samples/bpf/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 8ecc5d0c2d5b..6492b7e65c08 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -185,6 +185,15 @@ 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' ' ') + +ifeq ($(ARCH), arm) +CLANG_EXTRA_CFLAGS := $(D_OPTIONS) +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 Tue Sep 10 10:38: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: 173501 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp5609811ilq; Tue, 10 Sep 2019 03:38:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqySpfadRSWMnEmPPuqp/58Eq5KPRT7x0c/9thkGOBm+Om20Ysx4Z4KJkag5Z5RtVElNEgCZ X-Received: by 2002:aa7:db59:: with SMTP id n25mr29805306edt.77.1568111936441; Tue, 10 Sep 2019 03:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568111936; cv=none; d=google.com; s=arc-20160816; b=hfssLOJvjUYKPiunxCDBZfNYtiH6JK9CTr/2HSyFTfgXl6+8RRYchlXzSbInlkBm6b N9rdWvedH/it4iod4eq+BBzvbcdIeCEGLHbWl4EYxn8D5/re5oSo2KR+jsvkjrXtj6V5 9fRuIKv5A4dGFyuZrv2haJ9IAqUBMXL6/qPLbQdU0pktepFxqrbpqZxWKt7ZhIgg+QX6 lA4HDt3HmPFSJrtrzy37B7xZ/pnvNMC0KQwmdxk9gdIUEWaD/pTaML9yo1L/eYV6VNeS 8mNo6s4rO2pETtndpWsmzh5tjmICg2lh0DxEwvyOv+05HsIdYs1lbjrqBCTADc9zi7EO /LlQ== 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=IxZ/+fqqCuVj1pULMKRHJJXa1zIHgEU0C4IiN6cmJWE=; b=Xj2BZkcBXUCNWwyTY40OJe/PmTtOIPrte51I0vpj20oZeDdJyzeeYz577Dw7YStkcm p1Jtuazw6IlJW6Q9sRB8VDKA3VN59RBww1jCfnbVHQdtZBizJV6DTJwQ27PHgHVt6WXz HFULcLMfgE72kZi+21QuOc4l87QeMxx219vtZb1cz+BBkqCgNePCLMJONq+uabHCNsTG n991XB16D/D7EsL9/zEDeq9VLnd+Jg0mtNDn4P8yGhPYqk86jA0VnNY0hupKQQvexsPg p7Po8FCqy21hQXBM8aosuGcs5HoB6HvISzZjGykdxs8FW60SZY1WHCe1zrImoddJl/6z gA5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KB7YHJmY; 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 z2si8849107ejr.360.2019.09.10.03.38.55; Tue, 10 Sep 2019 03:38:56 -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=KB7YHJmY; 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 S2406224AbfIJKiv (ORCPT + 27 others); Tue, 10 Sep 2019 06:38:51 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:39196 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436565AbfIJKit (ORCPT ); Tue, 10 Sep 2019 06:38:49 -0400 Received: by mail-lf1-f66.google.com with SMTP id l11so13021804lfk.6 for ; Tue, 10 Sep 2019 03:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IxZ/+fqqCuVj1pULMKRHJJXa1zIHgEU0C4IiN6cmJWE=; b=KB7YHJmYJoMM4nqzRtlQbzNwWev5PHKeBldEwrvgPRLnEWN5lqWj+oIUQhxh9maD/y JvU/MvDwKEpJCLZYjXvI2kN9KxUUDOZvl4ITYgSokrM1Xe2KiAY4Fp56VGVQgdB1jpjI oTuNyZykUQmT05ei/x4WOmPeDa6Yq6trQKbJS9CjANuwL7G5912LFVrbFAy+ILt6Z6gZ u2C8OUf/QxFGYRKl4dQW5wY+OYGHR2f7ZD+vcbt6Y/eBVh7Z7suN1lsDeTYZvQWeDacM VsgQJ5yqaAUV8gRmywLm96Nm3lZ9/tCqgOM7A0nX/WkA43ZkIJA9qnPcK8b4y0UuhnXa YynA== 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=IxZ/+fqqCuVj1pULMKRHJJXa1zIHgEU0C4IiN6cmJWE=; b=FpMOKj2JiE/ntI7w81ZQb1XGqI6j/q5MCEAVDXVcKkyO8EqutsMqV+45zPFf3VhfDj +epgHMJy96mV1MpChFjY4G/AMu1lVjBKYuofxSUpPZkfjBOPV5mM7O/qnC8FTiU5FpQV GgLRq/7TY+e4JDhPM/xNoabB/RdshB4Nyvze4RuCDsj6IcALcdHSNi0pGbx2Kn/dHE04 pNoi/lgurnMGuH3V8OV+7FbgwrJwURlvu13CSfY9EbTPTUjZtNIFC/4rQ0o4VuZTRlQr /JaS0QD5OTmz08f4m+jPJUVLYcoT2qCI/EhTaKF1pwl3YnOvONTWLDf1LhdsRi1MbKtv WJFg== X-Gm-Message-State: APjAAAVM2Jeonz6yxH5QsLYoFip/umbOUxmUMP1jzYIae84xeHst5zCh eD0A8TvtSenearm6xEfOEkR8lQ== X-Received: by 2002:ac2:50c5:: with SMTP id h5mr1193865lfm.105.1568111926190; Tue, 10 Sep 2019 03:38: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 g5sm4005563lfh.2.2019.09.10.03.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 03:38:45 -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 07/11] samples: bpf: add makefile.prog for separate CC build Date: Tue, 10 Sep 2019 13:38:26 +0300 Message-Id: <20190910103830.20794-8-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190910103830.20794-1-ivan.khoronzhuk@linaro.org> References: <20190910103830.20794-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.prog is added only, will be used in sample/bpf/Makefile later in order to switch cross-compiling on CC from HOSTCC. 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. This 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..3781999b9193 --- /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 := xsk_example +# Will compile xdpsock_example.c and create an executable named xsk_example +# +# progs-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 +# +__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) From patchwork Tue Sep 10 10:38:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173502 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp5609819ilq; Tue, 10 Sep 2019 03:38:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxdCwDJ1AKdpTYDL6eyYdtzqneLKLAdBoV5Ufa1qZ5ZnA/oeqVpVYt0UrgHMe3gVE0yuGa X-Received: by 2002:a17:906:2458:: with SMTP id a24mr24093324ejb.69.1568111936964; Tue, 10 Sep 2019 03:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568111936; cv=none; d=google.com; s=arc-20160816; b=NlzqvMF5hLsNzcgi7H7Br9Rg/53F2iQ3uWWT4XoZf9bb3Tf7kpEsiwC9V4ohR48tCN IrpdAsO8SzD7lPNN9lwD1aoiWerb6kQ4Cckci0tv46RTkRxtImWYoNYb4iPawikBXtSv QsyUqTg9UUbOGHwStghnHtvdoH48zpT/4dfFWmBcr3xx27sYARH0IxuLu09wc9CjWaOY ibX4dBNlSflRVVIZCfNgV6UQ/iAYvbzCCMkwg6VNRFmcGqreK+f677MSZ8PpILo2RO+G PRfc0U0rUJDQL3tbXHCVjW1N9fcRlezHoXItcvZpltU24R6i6Ec/CSHboIrPy7FbjTWM B27w== 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=IcR+D/TfWuQwurL66TOSsrqC7LoAB4pm/OhhtcjezUY=; b=cg0rilFylNWM3t1/rIPfdEWFqFq9iOC4gwycmkrMxugQeIw1pG2Rs5WebMi7/01M8X oiFdsZhavbnsUjx8Bcsa+WxMFiMnOiqRBaDsPegEZuhbeUcZb1NvAbRLe0cctNdltau5 ZJMhG3uZPOOhb6GhsGWZCHiPobb93bRhzeQPELzRoAINRYXdZUFyFwFT7On/zl+QUU43 wSPaLlgVq0NjFXS0BvRlTagSsVrfEnvGGErQzqXr/wHzcMx3n6xVqroCGGTgWa5jc3vl njpRmm1Rxv9eN/EsJlF0xSy5K8Qzx80/pAhZAH33GswNsKAujFsG9xWkgo8PRCOa+L0J 9pxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=esLNerhV; 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 z2si8849107ejr.360.2019.09.10.03.38.56; Tue, 10 Sep 2019 03:38:56 -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=esLNerhV; 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 S2406252AbfIJKix (ORCPT + 27 others); Tue, 10 Sep 2019 06:38:53 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40628 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436560AbfIJKiu (ORCPT ); Tue, 10 Sep 2019 06:38:50 -0400 Received: by mail-lf1-f66.google.com with SMTP id w18so1118498lfk.7 for ; Tue, 10 Sep 2019 03:38: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=IcR+D/TfWuQwurL66TOSsrqC7LoAB4pm/OhhtcjezUY=; b=esLNerhVdr5vtjvVHS8bWaix+dE3PWsOm6T6wTywoSK/3we/bCYyAzUb4Jdi1v49ZD oUlaahWQN+7ncBEoaAaphHNKdA58/hqNebCWaFXZpq8TWyMnL1WfYOE3TpHj4c5s7HLn kkrOAYp80qsQ9yv2YpiJrGvsMCHf9rwR2YMTOe3lyZCc1uAGo1OuR9Ye98T0xImsneWj ALWFkBiTKIColYZ/O4dw/ZLaPx2lQ0UD1KzrlP4p3HBZiRI3d/fTp3VD1ksM07RnqciR mSTaSkwGbOLGl/BkvE92ZHjqXpjhBgn7iBpEx1twTjneUgPJIQqhxczZmU8l8UtuL3cO /ccw== 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=IcR+D/TfWuQwurL66TOSsrqC7LoAB4pm/OhhtcjezUY=; b=ddViB86fM6tr8OLkJK4ZJIQ1GGb+pNegW/uauafiLlHTDoJqh493EB7mXtLA+myNho 9LXt3Fmowi9h6IWmqUlvg8ikRY8zovbPMMGPE/u9T58+UJM9Mmc/XjH1MFDeR19S/r+h ZWQ/sePNzS5uwI29BotcpRrUHKU9Ih2YU17Ue/t3x9Zv1oVQwIvVV8FadEJWtvCu/N3F Gffeg165WHSCVOaPUcLipTyfTfTxlgNv5L3yl4f8gR9wapp++X8Ph++2E8S9Ah5DSsxN vcroxPClcCGZQrVyzs1VsGjjifXYunxsqwxNsVZ6C4pWQzjG3KJ/6NIgVD8Rg8sdyiNb Qfmw== X-Gm-Message-State: APjAAAUI1eh3KDqZnNlA81jKm6FwgPdncdosz+krfofl8tMVsP7/oqys 8c0a8o2No17Cfb5Jhof4CtjDQA== X-Received: by 2002:a19:5f55:: with SMTP id a21mr20651781lfj.56.1568111927326; Tue, 10 Sep 2019 03:38:47 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id g5sm4005563lfh.2.2019.09.10.03.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 03:38: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, Ivan Khoronzhuk Subject: [PATCH bpf-next 08/11] samples: bpf: makefile: base progs build on makefile.progs Date: Tue, 10 Sep 2019 13:38:27 +0300 Message-Id: <20190910103830.20794-9-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190910103830.20794-1-ivan.khoronzhuk@linaro.org> References: <20190910103830.20794-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. It was tested for arm cross compilation, based on linaro toolchain, but should work for others. In order to split cross compilation (CC) with host build (HOSTCC), lets base bpf samples on Makefile.progs. It allows to cross-compile samples/bpf progs with CC while auxialry tools running on host built with HOSTCC. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 138 +++++++++++++++++++++++-------------------- 1 file changed, 73 insertions(+), 65 deletions(-) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index f5dbf3d0c5f3..625a71f2e9d2 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 +progs-y := test_lru_dist +progs-y += sock_example +progs-y += fds_example +progs-y += sockex1 +progs-y += sockex2 +progs-y += sockex3 +progs-y += tracex1 +progs-y += tracex2 +progs-y += tracex3 +progs-y += tracex4 +progs-y += tracex5 +progs-y += tracex6 +progs-y += tracex7 +progs-y += test_probe_write_user +progs-y += trace_output +progs-y += lathist +progs-y += offwaketime +progs-y += spintest +progs-y += map_perf_test +progs-y += test_overhead +progs-y += test_cgrp2_array_pin +progs-y += test_cgrp2_attach +progs-y += test_cgrp2_sock +progs-y += test_cgrp2_sock2 +progs-y += xdp1 +progs-y += xdp2 +progs-y += xdp_router_ipv4 +progs-y += test_current_task_under_cgroup +progs-y += trace_event +progs-y += sampleip +progs-y += tc_l2_redirect +progs-y += lwt_len_hist +progs-y += xdp_tx_iptunnel +progs-y += test_map_in_map +progs-y += xdp_redirect_map +progs-y += xdp_redirect_cpu +progs-y += xdp_monitor +progs-y += xdp_rxq_info +progs-y += syscall_tp +progs-y += cpustat +progs-y += xdp_adjust_tail +progs-y += xdpsock +progs-y += xdp_fwd +progs-y += task_fd_query +progs-y += xdp_sample_pkts +progs-y += ibumad +progs-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 := $(progs-y) always += sockex1_kern.o always += sockex2_kern.o always += sockex3_kern.o @@ -170,21 +168,6 @@ 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 - # 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' | \ @@ -194,6 +177,29 @@ ifeq ($(ARCH), arm) CLANG_EXTRA_CFLAGS := $(D_OPTIONS) endif +ccflags-y += -I$(objtree)/usr/include +ccflags-y += -I$(srctree)/tools/lib/bpf/ +ccflags-y += -I$(srctree)/tools/testing/selftests/bpf/ +ccflags-y += -I$(srctree)/tools/lib/ +ccflags-y += -I$(srctree)/tools/include +ccflags-y += -I$(srctree)/tools/perf +ccflags-y += $(D_OPTIONS) +ccflags-y += -Wall +ccflags-y += -fomit-frame-pointer +ccflags-y += -Wmissing-prototypes +ccflags-y += -Wstrict-prototypes + +PROGS_CFLAGS := $(ccflags-y) + +PROGCFLAGS_bpf_load.o += -Wno-unused-variable + +PROGS_LDLIBS := $(LIBBPF) -lelf +PROGLDLIBS_tracex4 += -lrt +PROGLDLIBS_trace_output += -lrt +PROGLDLIBS_map_perf_test += -lrt +PROGLDLIBS_test_overhead += -lrt +PROGLDLIBS_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 @@ -284,6 +290,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.prog + # 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.