From patchwork Mon Sep 16 10:54:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162743 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="LYey3wmg"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X37r43Dlz9sQm for ; Mon, 16 Sep 2019 20:56:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732448AbfIPK4H (ORCPT ); Mon, 16 Sep 2019 06:56:07 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:33723 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728347AbfIPKyn (ORCPT ); Mon, 16 Sep 2019 06:54:43 -0400 Received: by mail-lf1-f65.google.com with SMTP id y127so3853414lfc.0 for ; Mon, 16 Sep 2019 03:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6kzj0QUIRS1sDUroHtM76x4Sw0PaH661mS2z6H9lrYY=; b=LYey3wmgdmHy2NTiQkVRdiP/+xWiXr7/VhQu0JvCqcUIAToMMaoYBOM6JFuBqaxkZ1 JfYQeW6MTnVu/A2LKmVE2hLug+wszlySKPK3lLmm5cC6B8YCZTCUrLGdZnxzx1ACnH70 UB4kW6+0PoqV7L3+af21M7FxoqOZMXAUDxZSKtf5Wwlpf/fPZeNLIS3PaJbluIKMIsao zeKD032jBuH34HlHMsQ2ZAaBWHjzEdEuE2cwW2q876Uoe+JjqzWdVvHCsWaR/4ByQm/a uhSDh/DlVgXPaV80sBavReU3gg/Ek+7zUMmJllxUFjANBPZRlVHU2OI0ORj/g+vLAgMn Ac7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6kzj0QUIRS1sDUroHtM76x4Sw0PaH661mS2z6H9lrYY=; b=GhscWFrKbf7w4gFumS7yWQYVfIX4SmaxqqOSHadVVgYBWQuf2Jcl+LiLIA1hZvpQBV KorgFeSBNeJ4TOK9ecld7gSRCe4jLdpL7DRSmMbb/LVHQ9/xeZZ+kQ78dqBfBNXraSW1 /HCtY0jPjpyBciFP+HvoXE/AA5pANWf7qJsAtZsUCvoBPWf9wKG+u/s8iRG9an/0i2oc cZ78RJr23YxQUNk3tIaAOtAQPFMeuYiU/ngaTJV6pbDVn+RAgVdEq/zAzMkoeLj6V++J O1T7whWqy8QhmQWag3mvOE1MzQKNwL6i8N169FgmxX2sObXSLB/E1ec+YKXdcH0nXzn4 RM5A== X-Gm-Message-State: APjAAAVWBkBJUanmRklKaNJto/bo+yGeeM6Ez9VaksyZdfmdDzcZoVMV U1RhGSAxw2GgqUwevUewAJZ8tA== X-Google-Smtp-Source: APXvYqyJD8dqwWln86DwqzCKKtbka3vRqFxZgcxtBQ23F33WqEha0eXVuyLZUBHVuwzHF7MjlDRyUQ== X-Received: by 2002:ac2:4ad9:: with SMTP id m25mr11489559lfp.89.1568631281688; Mon, 16 Sep 2019 03:54:41 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:41 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 01/14] samples: bpf: makefile: fix HDR_PROBE "echo" Date: Mon, 16 Sep 2019 13:54:20 +0300 Message-Id: <20190916105433.11404-2-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org echo should be replaced with echo -e to handle '\n' correctly, but instead, replace it with printf as some systems can't handle echo -e. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 1d9be26b4edd..f50ca852c2a8 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -201,7 +201,7 @@ endif # Don't evaluate probes and warnings if we need to run make recursively ifneq ($(src),) -HDR_PROBE := $(shell echo "\#include \n struct list_head { int a; }; int main() { return 0; }" | \ +HDR_PROBE := $(shell printf "\#include \n struct list_head { int a; }; int main() { return 0; }" | \ $(HOSTCC) $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \ echo okay) From patchwork Mon Sep 16 10:54:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162738 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zqzL4Jzw"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X37d3nXYz9sQm for ; Mon, 16 Sep 2019 20:55:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732703AbfIPKz4 (ORCPT ); Mon, 16 Sep 2019 06:55:56 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:38387 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbfIPKyq (ORCPT ); Mon, 16 Sep 2019 06:54:46 -0400 Received: by mail-lj1-f195.google.com with SMTP id y23so32915605ljn.5 for ; Mon, 16 Sep 2019 03:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=myQi7tUoXKWvWu2Otr2cMzZrUikwx9p5w927Z5U7K18=; b=zqzL4JzwdgYet7wSFB53zjRItWpS1hdeN0ygAfE9AmPl/tgeJ6oyvRLjQXycdwZXvW 0LkJJSRAf4imSOLOE29XGY2MZ3eqllofQcObiDHWP0n70jafz5Etprt2/18so9bAoNTR PAxrU/Zo2hoAsOPF39JndhObn/PUwZAIGsIAbIudvGDm7SINJLoGj6UWh+CSx6AR54CG cqRWHQ/B4qTgGzo7uNYmgSSKMEPe9rgAJFIAtbz5BnbBBB1x1PXd9E9GZFdPz3dzbqwH 8ftOXF8bhIMPmwb3IKjgxhtoyYYyFPxole8xysIfutsFzMyg7yF01NS6KpCla5EtW1LM 4LFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=myQi7tUoXKWvWu2Otr2cMzZrUikwx9p5w927Z5U7K18=; b=I0ti/0V2/IsMYuw2KdV8E9P/RupeI2Cx/huDldtwv5a8zSSagaNK1NmcoqQYfkJYtr DgJh024U/izZCRVIsXOiGBbJJ+Ix42ErKrqbb8qRnMWQ20BbZzLkiIp4nGq95G1A4ur1 HovUvyzpKuuneoLCSvm7CsAeQ6fnIKFhLGi580UyLBl4XaEWABQOFFTNnly+VC5M0dIE wE0NcOjEFTLKaD8M2Sn4FBUHErgA8A3ofKtdAi/F3AMCQzOhBzmQIH8hSjxsjH8nO93t xgnkl5mXjD1/ogjIBtQ99o2Dk0zTSs1iwP4+YcvNgHjSDFA5EPBKhPZeAQbRX/1lJ6CD YqNw== X-Gm-Message-State: APjAAAVbw4/6jL4QkD6RjonoA0L2rRuWkDfH6vb2pCqNCFOuiX3sMM/Q lAUGbiZC1quKbhVAlG0qUGlNeQ== X-Google-Smtp-Source: APXvYqzNr13KKv1AIr7OpHjlQSQcSa/f7Y9MYJkeX7w54sCZf3/vtF9w89HiJUF4vYPD+fo2fgIN4g== X-Received: by 2002:a2e:b0c2:: with SMTP id g2mr1900577ljl.217.1568631282996; Mon, 16 Sep 2019 03:54:42 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:42 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 02/14] samples: bpf: makefile: fix cookie_uid_helper_example obj build Date: Mon, 16 Sep 2019 13:54:21 +0300 Message-Id: <20190916105433.11404-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Don't list userspace "cookie_uid_helper_example" object in list for bpf objects. 'always' target is used for listing bpf programs, but 'cookie_uid_helper_example.o' is a user space ELF file, and covered by rule `per_socket_stats_example`, so shouldn't be in 'always'. Let us remove `always += cookie_uid_helper_example.o`, which avoids breaking cross compilation due to mismatched includes. Signed-off-by: Ivan Khoronzhuk Acked-by: Andrii Nakryiko --- samples/bpf/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index f50ca852c2a8..43dee90dffa4 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -145,7 +145,6 @@ always += sampleip_kern.o always += lwt_len_hist_kern.o always += xdp_tx_iptunnel_kern.o always += test_map_in_map_kern.o -always += cookie_uid_helper_example.o always += tcp_synrto_kern.o always += tcp_rwnd_kern.o always += tcp_bufs_kern.o From patchwork Mon Sep 16 10:54: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: 1162740 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="pNYUSbIS"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X37g0cGhz9sR1 for ; Mon, 16 Sep 2019 20:55:59 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732474AbfIPKzz (ORCPT ); Mon, 16 Sep 2019 06:55:55 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41132 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732451AbfIPKyq (ORCPT ); Mon, 16 Sep 2019 06:54:46 -0400 Received: by mail-lj1-f196.google.com with SMTP id f5so1272176ljg.8 for ; Mon, 16 Sep 2019 03:54:45 -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=pNYUSbISKlAVLelxCU1TU78GP/FlR+e7TlMVVNr+WQfkvrUyOQytDZ1zL1iVg/OgZe 6p6VltOKoWLDC/bPlR07+PqlPVKShLC8jd3pdogkkTiie7b6Q6qbewuXTyHcmiDnXpI9 nexFhZb6QkDjPMIgqjqoAenm82Eo5FSyqbzu2mVY2gkxjWC6rA3RJouf7eW9/956lUwo n3ujW3x/Y0Utc6zd+V/GzPWYnPD5jAs+aoniDRHjpYyQyNDBZcy8WMo8xx8v4czDr4/y wSRreUWlENL/nESYpqKX4+K4UeYnvtu6ZqfqWthcs5MXxnIME71OVkCZMJ/i342wY9xE /9Qw== 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=RSfEh30DtETp31ndXS6g1ul4oO4FBK8qqETpzr+BvX0VdRds5bahbgeD2Q1a2w1qtD FG7yPjXPggtSDHUqDbjPcsdFqizLvmZOkATrxladT/mIjzaEpuXYu9Lz0bCD/RO9KhyF Z44uJBHWeIBsVc941+UxBZuwdTlIwkkqCBP1OOPytphdFlTq6w0Sa1o3vPskNAQfl0Ef pxtfBCItPavRVgpZ1Avwpfu7nwi3KfcsoFi3XMZTfWG0L5FLcxfId+T9SJ3vab7EOKzV Mornlhznfp/R2hPP1m05roOUCBFxhwW28kOWLZtFFchRThRbeZGTT+AlW71/02O8GV/q dGew== X-Gm-Message-State: APjAAAWFJ8CusZ2OBZiDdFDdPI8+KWDwhaiZOvbsaysEikc3wvW80vHU 6fcjgFxvm14Di7dj1XyN4lkRKA== X-Google-Smtp-Source: APXvYqx/A2fPKX099Lb1d4EObHCdvUw6KNT4rOt0p0xKK+1FDVo7yE677tG2x5n4sDmWFNFZZiiWsQ== X-Received: by 2002:a2e:9b43:: with SMTP id o3mr13477947ljj.214.1568631284266; Mon, 16 Sep 2019 03:54:44 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54: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, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 03/14] samples: bpf: makefile: use --target from cross-compile Date: Mon, 16 Sep 2019 13:54:22 +0300 Message-Id: <20190916105433.11404-4-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@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 Acked-by: Andrii Nakryiko --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 Mon Sep 16 10:54:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162717 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="g/BAdg0U"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X36L2Gqrz9sPw for ; Mon, 16 Sep 2019 20:54:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732490AbfIPKyt (ORCPT ); Mon, 16 Sep 2019 06:54:49 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:34901 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732462AbfIPKys (ORCPT ); Mon, 16 Sep 2019 06:54:48 -0400 Received: by mail-lf1-f65.google.com with SMTP id w6so27101016lfl.2 for ; Mon, 16 Sep 2019 03:54: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=4FRJ5Ph8qMbMU6/W3VLuGrqprbT0bDHz0d1WvLmMb4M=; b=g/BAdg0UimHeaUICEhjEtr4KxeDpY3VrRM+S2Z5GVOPRjc288L3c92wXp0NENhu5ZG SVF1bEXuZoCRXflIqRO8ftu3gBiqprEwR3nlJWXBVvgk1qHQyjzdjDXnKz08VQh2gsLa 0C5RaVzyQ/Lq2tJP6QdWJx7RY7WyTyjvsjXnHIcA2zyhsx8zB0FVzByiOO+TZ0Jg74TR 9Yf697+zDIr/nGnizNYyFhZloRMFYJlZYkYVnFK2KODhnMLe7dvoUhvgx3MpOosxicSF cOoNOupkXaFXHIWPDAdLb71YsQEqxdw5ZL/A3ipVUT/acTMFAY7YPn2FvXecNkxjF8Xa KngQ== 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=4FRJ5Ph8qMbMU6/W3VLuGrqprbT0bDHz0d1WvLmMb4M=; b=CKCm7Ql095bDp4eY1BWlfKReCg/7+bLjdD/DG0te4HB8R4JIkf+OJW2aU1hpFT8QWh ipERlSOd5B+B9pMquioPuQbK8jQcCWt6w2YWhmSlXoFuEC2wLxXDpnvtHftZG22rlmw8 ABe4vZkj24vM5eW2DnM6fdcaizMgE7E0SXZx/B381hEj9/XUXlMBHjldfjWKIbiBIFZz LZgvdAPPrEFxzr+KCsJjTCL4TnsTL40q9LWNHm3bnCc3kRWND1TK42Y1ZOrrH5zLOYCe 9Q4uoIMX2MM+lg7ws20BdBpYm6o+QncsmlWH+QaZfConrHTb1E1fpT6G3nu3gExc/JL5 MsXw== X-Gm-Message-State: APjAAAWetvHdSDvhBBgwlnpDf76mtqJOADCVa+TgrQ8d7WnYsscJalPb BzD6AzOzN6DTkPaWM71OBPd/pg== X-Google-Smtp-Source: APXvYqxMVl+Re8IbPRj8nExAl9rt/a6wXvbqrWxum/fSucJNAbGUW3bKzTceRGfaIintAYnHkoXUTw== X-Received: by 2002:ac2:4552:: with SMTP id j18mr12491200lfm.120.1568631285526; Mon, 16 Sep 2019 03:54:45 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:44 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 04/14] samples: bpf: use own EXTRA_CFLAGS for clang commands Date: Mon, 16 Sep 2019 13:54:23 +0300 Message-Id: <20190916105433.11404-5-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It can overlap with CFLAGS used for libraries built with gcc if not now then in next patches. Correct it here for simplicity. Signed-off-by: Ivan Khoronzhuk Acked-by: Andrii Nakryiko --- samples/bpf/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index b59e77e2250e..8ecc5d0c2d5b 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 + CLANG_EXTRA_CFLAGS += -g else ifneq ($(and $(BTF_LLC_PROBE),$(BTF_PAHOLE_PROBE),$(BTF_OBJCOPY_PROBE)),) - EXTRA_CFLAGS += -g + CLANG_EXTRA_CFLAGS += -g LLC_FLAGS += -mattr=dwarfris DWARF2BTF = y endif @@ -280,8 +280,8 @@ $(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/ \ + $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(CLANG_EXTRA_CFLAGS) \ + -I$(obj) -I$(srctree)/tools/testing/selftests/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 Mon Sep 16 10:54:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162736 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="UrB84xhN"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X37V6VQXz9sQm for ; Mon, 16 Sep 2019 20:55:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730059AbfIPKzs (ORCPT ); Mon, 16 Sep 2019 06:55:48 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:40152 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732488AbfIPKyu (ORCPT ); Mon, 16 Sep 2019 06:54:50 -0400 Received: by mail-lj1-f195.google.com with SMTP id 7so33236967ljw.7 for ; Mon, 16 Sep 2019 03:54:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H+Oq4KltqpOb9wzu+L9OzY4bSDO7cEMe/MUjYdSZoPU=; b=UrB84xhNOOGhDmRHN4tEy21BxZte/v8W4CZVHuwaeoMKZensFssyvROhnk9udXZAWz JReS0yZSuYH5mPKKBCWNIaMerRcfSF+DPnCTQVKPlPwrFyp5Oe8NoO4Y9InriRYX05eg QrgslNhgph2Jw9DXJ5YHj96hldOtquP1+z33zTZKJDg+32Gxz59xznVRAdUl+l7//C2/ eatPjrGBSFUM3gi0Ov7oJ1/yjdBVMoMGc38yUqD6zyZH446H0JDswC/cboiHLROsjxj2 MaiWKvwY0xGH+DLg6A40H0Ta+e6uQZ9fGECdAQkuo2REdw7Cn/aEzLOnuAzM66wputxt 6IAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H+Oq4KltqpOb9wzu+L9OzY4bSDO7cEMe/MUjYdSZoPU=; b=qmSR5HC+6t/P+USg4aZ4Pu1gpMJ939/jkkKtDGgelGFWFw7n5MifyOc0lwLTpdeX98 X2T75ulo3p81d922RdPyVV4mhwhNaZORDm3SbdsaIBzIb2gflLkkbp2q74le8X8QfMAW q4axKxOW1u6k7dWBHCdjqyZW9DNJuU8FPgVU8hQJRmJXLcB5y8IcDJj+yLLRilX2cdVm FVUHzpzL3GP07QU1Rv8ldDsW8jI9tkC/gAOTW23eKO88d0nn7fuIaogXr8zVuXO2ilbw cGoJ31A2ZVAEj6/8AoL8BX+2Cmtf/NCxjiQPIgRFFmJBaGQ0bnnV4TIBPXyg5o8cN+R+ GmrA== X-Gm-Message-State: APjAAAVpD7futL0hfXUqdA1u+UIcRLxf/MasiuikFSzzBohDVKh/zyfX sTcEsjqr9VjG+CCO1oJ2i6w/Mw== X-Google-Smtp-Source: APXvYqzehclWxfpO6zGFERHqTFpvyu1X5/iPG4IUz0R9DZwRIntmp9r0WOUCcHs2ED3kNz6p/LBsig== X-Received: by 2002:a2e:2bdb:: with SMTP id r88mr36236050ljr.82.1568631286844; Mon, 16 Sep 2019 03:54:46 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:46 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 05/14] samples: bpf: makefile: use __LINUX_ARM_ARCH__ selector for arm Date: Mon, 16 Sep 2019 13:54:24 +0300 Message-Id: <20190916105433.11404-6-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org For arm, -D__LINUX_ARM_ARCH__=X is min version used as instruction set selector and is absolutely required while parsing some parts of headers. It's present in KBUILD_CFLAGS but not in autoconf.h, so let's retrieve it from and add to programs cflags. In another case errors like "SMP is not supported" for armv7 and bunch of other errors are issued resulting to incorrect final object. --- samples/bpf/Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 8ecc5d0c2d5b..d3c8db3df560 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -185,6 +185,16 @@ HOSTLDLIBS_map_perf_test += -lrt HOSTLDLIBS_test_overhead += -lrt HOSTLDLIBS_xdpsock += -pthread +ifeq ($(ARCH), arm) +# Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux +# headers when arm instruction set identification is requested. +ARM_ARCH_SELECTOR = $(shell echo "$(KBUILD_CFLAGS) " | \ + sed 's/[[:blank:]]/\n/g' | sed '/^-D__LINUX_ARM_ARCH__/!d') + +CLANG_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) +KBUILD_HOSTCFLAGS := $(ARM_ARCH_SELECTOR) +endif + # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang LLC ?= llc From patchwork Mon Sep 16 10:54:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162734 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="renlPhv6"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X37T758jz9sPw for ; Mon, 16 Sep 2019 20:55:49 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730913AbfIPKzs (ORCPT ); Mon, 16 Sep 2019 06:55:48 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35685 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732486AbfIPKyu (ORCPT ); Mon, 16 Sep 2019 06:54:50 -0400 Received: by mail-lj1-f196.google.com with SMTP id f1so1762940ljc.2 for ; Mon, 16 Sep 2019 03:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ICv/vY4XAwe136r6/MDdnRXmmJJ1JFeohZKBWO948JI=; b=renlPhv6Vx5CNHYksA5WzO20FVIYXEGpjJn5/YGtCgnC0BCwjUvLBlAbeS2QWSwpah jcbI6KeCWf9WpTaXKqzoATiWjCG2prOysrOtXjGAuLCXoTntdh4Qt/9m80BBL8QN4pzD XadY611DPWHua3DwZGOlRJTNUpZN6TrPk0Qwv6sDmublMKNGDX/eMekRKEEMHAPLynHN 5myrlSfFkSMecyixXnfJtcPFSkWkbeUOkkzmZn0e084lNX5MEANYr1m0mJB052RjofTA cKvGdlGjvGxXUcAUQef27FEQY1g72gk+N/QCID6XsEJxukpv5MfPHG1nANwRFzRONI4R ysPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ICv/vY4XAwe136r6/MDdnRXmmJJ1JFeohZKBWO948JI=; b=dlghcmYKXJmJasOE20No3JB3xfUe28KMlTI11yGYRvJEV4AY1RTE//Jxln5I24rX98 ccDa68kLEYV7A8ypXtzL7iSzqL7aIQMc8qx34mteo3Uf6dCxtrDIXGb9aEKLjg2D8Da6 Xw6NgAp43f4xbISELXhUp6MKILYLtG+3QNktGXU8GQQ7GfsOHBn0umCa06iUjnyPacMi Ef3miQpeWHhNQapjlVAWkywqrM8NHpn53ykMq9ZJ3EEypaUuCeECvjdejfxw8b0xx2YC Un9sS4ANokrjVYgjP9uL7qTeHJ798HVU3TlPXmAsMNuPz03rKv27eRcB534lrjcZqyno m4AQ== X-Gm-Message-State: APjAAAUpnuNucP45XwU19b93FLr36WGYlHQHHfi2aihtKai+tqHLypj3 U78jc7PlxyF9ng13HFPafua6+A== X-Google-Smtp-Source: APXvYqxSBkjyrfAdAo3XLVu9mwgNU46b8BtP9TI1G+SDVPq/GRexV8qvD6bjRrTR9lMP98abCOCLiQ== X-Received: by 2002:a2e:9881:: with SMTP id b1mr19271028ljj.134.1568631288103; Mon, 16 Sep 2019 03:54:48 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:47 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 06/14] samples: bpf: makefile: drop unnecessarily inclusion for bpf_load Date: Mon, 16 Sep 2019 13:54:25 +0300 Message-Id: <20190916105433.11404-7-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Drop inclusion for bpf_load -I$(objtree)/usr/include as it is included for all objects anyway, with above line: KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include Signed-off-by: Ivan Khoronzhuk Acked-by: Andrii Nakryiko --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index d3c8db3df560..9d923546e087 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -176,7 +176,7 @@ KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf -HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable +HOSTCFLAGS_bpf_load.o += -Wno-unused-variable KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf HOSTLDLIBS_tracex4 += -lrt From patchwork Mon Sep 16 10:54:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162718 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Tp5OvP8r"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X36R3R08z9sQm for ; Mon, 16 Sep 2019 20:54:55 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726327AbfIPKyx (ORCPT ); Mon, 16 Sep 2019 06:54:53 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:43448 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732510AbfIPKyx (ORCPT ); Mon, 16 Sep 2019 06:54:53 -0400 Received: by mail-lf1-f65.google.com with SMTP id u3so11952607lfl.10 for ; Mon, 16 Sep 2019 03:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qALJbnp9FTLPJAoGDKJIaiGyevgs6xsdVhuDmgFkzac=; b=Tp5OvP8rCaZb13D4ww3vj2mw2PWVAqGybOa6fUs/oIVw5T7/73Nqpmo57DltCqgBmW W/9ysUCIVjTtDUmMneoWsxRoIIm7/1ZmqNsLJ+HjEvvkOOIiQYjOkchVu5eqKs/Mqt1X VjfxITukqZHlV1t0Rqp7NNolwQVY8JYuqJ9aTg8QvAEanrhVhyRBlUtWCC2xv0LResJy TDMAy3NvtfKh5oTRrkwcPoMTpDX87g8TjD24bYIbVovX1/Wj9J6d5+Ri38Y1b0NWoLst CHjgzSYJCQAkhWGFdxr3rIBRjCkEgXHxMGQFp+nj7h4J2kMn6KpOxmGFCXE87IoRKeWc 23Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qALJbnp9FTLPJAoGDKJIaiGyevgs6xsdVhuDmgFkzac=; b=SOD/uVgCSAy2r/LgXFmp/kp33mkfIHsREXKGbvLK5KedSc7N7I7dnHwUNKFSxvR8c+ g/keS6wKDzZUbOX8u5BPQa4zBYUIxd7TUMv/Fo75ny1Tq3cUzmg5/ARCXTNoOaLTSYpi lrCbR9GAA5hfjO+mCoKoc+eRKewZV5VsPV+zVgFeMf763TBlC85hRQJ7cPIpYR84jFmA g3qRDrtdXyZZdES9WwttYysNyAuyOlxkp9f5TfLSIbWAzYVRq4LqkhFE/z99NtkteYpz 0ohP5IqYvjEJ3aM+0wBWItga6ifO3OpCvWIotfZFeVtE3nJz0FiATe5XSHsXVexpJ0Ce 3saw== X-Gm-Message-State: APjAAAU/AqLYRsyC2DNsmlPFZQqnrVPBJn8+ohcTajZy6oPCOO/+kK3J OQ0Wdfcuss8dkAOA7+Z5RR1uxA== X-Google-Smtp-Source: APXvYqzllcvzn3zCr2/UXmKKBqQnnGjipxHPlSqink4eIoGTL2UlV4EM6dmS/RiJ2HlREaZdmF9AnQ== X-Received: by 2002:ac2:5451:: with SMTP id d17mr37030113lfn.77.1568631289427; Mon, 16 Sep 2019 03:54:49 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:48 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 07/14] samples: bpf: add makefile.target for separate CC target build Date: Mon, 16 Sep 2019 13:54:26 +0300 Message-Id: <20190916105433.11404-8-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org The makefile.target is added only and will be used in sample/bpf/Makefile later in order to switch cross-compiling on CC from HOSTCC environment. The HOSTCC is supposed to build binaries and tools running on the host afterwards, in order to simplify build or so, like "fixdep" or else. In case of cross compiling "fixdep" is executed on host when the rest samples should run on target arch. In order to build binaries for target arch with CC and tools running on host with HOSTCC, lets add Makefile.target for simplicity, having definition and routines similar to ones, used in script/Makefile.host. This allows later add cross-compilation to samples/bpf with minimum changes. The tprog stands for target programs built with CC. Makefile.target contains only stuff needed for samples/bpf, potentially can be reused later and now needed only for unblocking tricky samples/bpf cross compilation. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile.target | 75 +++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 samples/bpf/Makefile.target diff --git a/samples/bpf/Makefile.target b/samples/bpf/Makefile.target new file mode 100644 index 000000000000..fb6de63f7d2f --- /dev/null +++ b/samples/bpf/Makefile.target @@ -0,0 +1,75 @@ +# SPDX-License-Identifier: GPL-2.0 +# ========================================================================== +# Building binaries on the host system +# Binaries are not used during the compilation of the kernel, and intendent +# to be build for target board, target board can be host ofc. Added to build +# binaries to run not on host system. +# +# Sample syntax (see Documentation/kbuild/makefiles.rst for reference) +# tprogs-y := xsk_example +# Will compile xdpsock_example.c and create an executable named xsk_example +# +# tprogs-y := xdpsock +# xdpsock-objs := xdpsock_1.o xdpsock_2.o +# Will compile xdpsock_1.c and xdpsock_2.c, and then link the executable +# xdpsock, based on xdpsock_1.o and xdpsock_2.o +# +# Inherited from scripts/Makefile.host +# +__tprogs := $(sort $(tprogs-y)) + +# C code +# Executables compiled from a single .c file +tprog-csingle := $(foreach m,$(__tprogs), \ + $(if $($(m)-objs),,$(m))) + +# C executables linked based on several .o files +tprog-cmulti := $(foreach m,$(__tprogs),\ + $(if $($(m)-objs),$(m))) + +# Object (.o) files compiled from .c files +tprog-cobjs := $(sort $(foreach m,$(__tprogs),$($(m)-objs))) + +tprog-csingle := $(addprefix $(obj)/,$(tprog-csingle)) +tprog-cmulti := $(addprefix $(obj)/,$(tprog-cmulti)) +tprog-cobjs := $(addprefix $(obj)/,$(tprog-cobjs)) + +##### +# Handle options to gcc. Support building with separate output directory + +_tprogc_flags = $(TPROGS_CFLAGS) \ + $(TPROGCFLAGS_$(basetarget).o) + +# $(objtree)/$(obj) for including generated headers from checkin source files +ifeq ($(KBUILD_EXTMOD),) +ifdef building_out_of_srctree +_tprogc_flags += -I $(objtree)/$(obj) +endif +endif + +tprogc_flags = -Wp,-MD,$(depfile) $(_tprogc_flags) + +# Create executable from a single .c file +# tprog-csingle -> Executable +quiet_cmd_tprog-csingle = CC $@ + cmd_tprog-csingle = $(CC) $(tprogc_flags) $(TPROGS_LDFLAGS) -o $@ $< \ + $(TPROGS_LDLIBS) $(TPROGLDLIBS_$(@F)) +$(tprog-csingle): $(obj)/%: $(src)/%.c FORCE + $(call if_changed_dep,tprog-csingle) + +# Link an executable based on list of .o files, all plain c +# tprog-cmulti -> executable +quiet_cmd_tprog-cmulti = LD $@ + cmd_tprog-cmulti = $(CC) $(tprogc_flags) $(TPROGS_LDFLAGS) -o $@ \ + $(addprefix $(obj)/,$($(@F)-objs)) \ + $(TPROGS_LDLIBS) $(TPROGLDLIBS_$(@F)) +$(tprog-cmulti): $(tprog-cobjs) FORCE + $(call if_changed,tprog-cmulti) +$(call multi_depend, $(tprog-cmulti), , -objs) + +# Create .o file from a single .c file +# tprog-cobjs -> .o +quiet_cmd_tprog-cobjs = CC $@ + cmd_tprog-cobjs = $(CC) $(tprogc_flags) -c -o $@ $< +$(tprog-cobjs): $(obj)/%.o: $(src)/%.c FORCE + $(call if_changed_dep,tprog-cobjs) From patchwork Mon Sep 16 10:54: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: 1162719 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VnA52KFS"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X36S31gSz9sPw for ; Mon, 16 Sep 2019 20:54:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732543AbfIPKyz (ORCPT ); Mon, 16 Sep 2019 06:54:55 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42235 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732442AbfIPKyy (ORCPT ); Mon, 16 Sep 2019 06:54:54 -0400 Received: by mail-lj1-f195.google.com with SMTP id y23so33248836lje.9 for ; Mon, 16 Sep 2019 03:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QxDLxAts+okFnGMG90FFtyZRtrZ/DaW/PKK2HTvYn5U=; b=VnA52KFSIyWMQb3/Iooa7EUs1aAXC0kYjZ0Il4q+2f33ttNnkrwJCJS5cIhuSV/8L+ JGGb5BMD2HXDU26gIyZm1rdD9CayW+BRe6usHa2bHSpJRsZ2uOB91FuQazlfqrZCRxrS v8EPFdm6HoxVpoByWOnjxnuejb+O0rGAtiqrh6wEVPImF/i8ca2RS7Q8g8B2xm/a5+fL 6094aS40v6CdjQecIi2vX8r2PPJpIeeYXClUuX9jK151mMz6LlgZvQtAEijqvEZcZYaZ KFjxLLsFntLvICjxu8Eiz+ff2wgGgl02YeZrhRni6ZM0sECdmJysWa2IaxK2MVUslDDV gHyg== 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=QxDLxAts+okFnGMG90FFtyZRtrZ/DaW/PKK2HTvYn5U=; b=RiNbgAWOunMxnrGrLHZV+MZYzctmjvM01XVRUOixLx2LPvogT26ZGcrmFXvHk7tOPt 0OksED3r2Vf0Y5kqu0Sz2+4wGaduOgUoXpKJ9shoBDAgqjCO5tg+U2Nn+FUngn6QMOIJ aReuEK+or0n47IofERnoq0kgG5gxLfSy9vtfimZtguT2T4oP7qU/WX9qVxgpMP/3cKXB yGu2KHKd13O4D60wzJcCb8sVLuVkfeyEqU3YiOZq5o8oevBy9c9QotHLzZEOYva5O8VZ dYh5YP/1SMQdhoePQokY++eWYOUeux2JNnJN7cTvTXy0+QEEW7wxE2WNfiO/6RkgKuY1 LiEA== X-Gm-Message-State: APjAAAXnOvZiAYKTR4oNbUw4tkOcLBB80OoXfLEfRDY6vXtHVnSJTZ4m 4wQ3WF2BnDppFLxH90qyYSWM5w== X-Google-Smtp-Source: APXvYqycY7MqcGjp+xy4kIsJJVzPM0VW6WttxNc1etM/2VY/78Ibe6TaKuc7H+pwUkYOqtrpS8rbZg== X-Received: by 2002:a2e:b16b:: with SMTP id a11mr23700854ljm.83.1568631290649; Mon, 16 Sep 2019 03:54:50 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:50 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 08/14] samples: bpf: makefile: base target programs rules on Makefile.target Date: Mon, 16 Sep 2019 13:54:27 +0300 Message-Id: <20190916105433.11404-9-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The main reason for that - HOSTCC and CC have different aims. HOSTCC is used to build programs running on host, that can cross-comple target programs with CC. It was tested for arm and arm64 cross compilation, based on linaro toolchain, but should work for others. So, in order to split cross compilation (CC) with host build (HOSTCC), lets base samples on Makefile.target. It allows to cross-compile samples/bpf programs with CC while auxialry tools running on host built with HOSTCC. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 135 ++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 66 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 9d923546e087..1579cc16a1c2 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,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 - ifeq ($(ARCH), arm) # Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux # headers when arm instruction set identification is requested. @@ -192,9 +175,27 @@ ARM_ARCH_SELECTOR = $(shell echo "$(KBUILD_CFLAGS) " | \ sed 's/[[:blank:]]/\n/g' | sed '/^-D__LINUX_ARM_ARCH__/!d') CLANG_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) -KBUILD_HOSTCFLAGS := $(ARM_ARCH_SELECTOR) +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 @@ -285,6 +286,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 Mon Sep 16 10:54:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162721 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="fA1ZBPhj"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X36W6bXnz9sPl for ; Mon, 16 Sep 2019 20:54:59 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732581AbfIPKy6 (ORCPT ); Mon, 16 Sep 2019 06:54:58 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37605 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732510AbfIPKyz (ORCPT ); Mon, 16 Sep 2019 06:54:55 -0400 Received: by mail-lj1-f195.google.com with SMTP id c22so5455809ljj.4 for ; Mon, 16 Sep 2019 03:54:52 -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=awMC2NNgYQwIhWG3qRO8zKuB3GE6M/09XFXZ6Czatbc=; b=fA1ZBPhjkBsytlESQk6kpCQlXY2ePyrNVBUlN9vF9PL4a+tBgZiDhVywUcbg19c3Bt AFVvZR1wfpLJcovFqZU/aQsKJXekdUri03k6Na1iWOGfp6K6Dp58O6CN7NSB6SPDLpfg GXozVCNmNMDLClTQ87gCKyH9LKAUpqI+k+Kbnp0FZ2PA94mpFRY1q5zyGP+aXEbwImgB OFvOewfBoSVb3rMrGhZmnr3GGZ/Ajob3fWyYwb1F8nLz6YwfPnoTqeH9KHRQvED/7xCu AUV1acvpatip1LNApKO+AX58CTgYVBaSdpoGIR9HXyn994giZy6+fdPsNDCYKKXBskWH 9zdw== 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=awMC2NNgYQwIhWG3qRO8zKuB3GE6M/09XFXZ6Czatbc=; b=bUlminGbHj82mIDS8WJ1F9OEZ8jtaNytI06kgDMT+bgLaqV0tp8QA8mYPimwsEPM9t q5gt4PEmsr3UU8Xt0LiNbjJsjWZhJWpoPL7meDKakirrDS3HWURPqkBxowCK8ENYd/Dj tw3HaZnN5/wCLezaZd+sh4aZAlWdNv+gmvpmFmj4erhGktQ9BXRiuTo5xBkCwdwwf41+ kACdR8vnBfi+JwW3iTotbl1qSrlVEpQqh59hrAyHdWfm1zJyJp6eKThE4xD3kZRMfyOg zIzwitT7g5M9xp+ITW9NiwSJun+gfo0f48Bz1pIaKqyRPdU8L8SkUrgd0w8vxW2RUJGv yGNw== X-Gm-Message-State: APjAAAVhGpkDsexGrAgH2lY/loNeu3OqOfD5GI0y4RJSGIxqUkuNP+ie bqqsUqlSZ0w4cOYSakLhrL5QwQ== X-Google-Smtp-Source: APXvYqxFe+l0B6DF4Vp4tbNkF7b9m5dt3qevx/stJMvJalGS+zpGTiuxgMApQNLetSWeV53H0vtR9w== X-Received: by 2002:a2e:98d2:: with SMTP id s18mr5649688ljj.68.1568631292008; Mon, 16 Sep 2019 03:54:52 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:51 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 09/14] samples: bpf: makefile: use own flags but not host when cross compile Date: Mon, 16 Sep 2019 13:54:28 +0300 Message-Id: <20190916105433.11404-10-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org While compile natively, the hosts 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 alsways: -Wall -O2 -fomit-frame-pointer -Wmissing-prototypes -Wstrict-prototypes So, add them as they were verified and used before adding Makefile.target, but anyway limit it only for cross compile options as for host can be some configurations when another options can be used, So, for host arch samples left all as is, it allows to avoid potential option mistmatches for existent environments. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 1579cc16a1c2..b5c87a8b8b51 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -178,8 +178,17 @@ CLANG_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) TPROGS_CFLAGS += $(ARM_ARCH_SELECTOR) endif +ifdef CROSS_COMPILE +TPROGS_CFLAGS += -Wall +TPROGS_CFLAGS += -O2 +TPROGS_CFLAGS += -fomit-frame-pointer +TPROGS_CFLAGS += -Wmissing-prototypes +TPROGS_CFLAGS += -Wstrict-prototypes +else TPROGS_LDLIBS := $(KBUILD_HOSTLDLIBS) TPROGS_CFLAGS += $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) +endif + TPROGS_CFLAGS += -I$(objtree)/usr/include TPROGS_CFLAGS += -I$(srctree)/tools/lib/bpf/ TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ From patchwork Mon Sep 16 10:54:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162720 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="cgMjU9Vg"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X36V2S8Bz9sPw for ; Mon, 16 Sep 2019 20:54:58 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732502AbfIPKy4 (ORCPT ); Mon, 16 Sep 2019 06:54:56 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:37542 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732536AbfIPKyz (ORCPT ); Mon, 16 Sep 2019 06:54:55 -0400 Received: by mail-lf1-f68.google.com with SMTP id w67so27072530lff.4 for ; Mon, 16 Sep 2019 03:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9NLfs5AbYJF7ESK5xuIslXoD/IqVsX2Fckqfe1g6VEo=; b=cgMjU9VgF66MpK+7cYVgFwTXHUUXY3RP+fbPS5mQhKXJebmvwfYOjylIzcce/vVR2v S+Q2ARJDsEjUmMLBvWPgyIemeej5MAEsmwCTWAXgyiGhlec/IcmFIuHE2w4MGODPMnAL bgDdARhEqXqiXSVKGttt9Ic2kiDIxJTYWpr2QZ7eq3Kq+vb+xaaUiKWqbP9RCl+1FVGm wfSdI25syQcaHAndrFmcwKOMieb7zGLpuNLod/Jgak9EvgP2vCbT3KakYeCI222YAi3Q rIJRdyU1aAK7zl8igzE+e9wcGVBm2kmpvFM6x9RBSAu1gfp0/WZI11dbglu9eIbMMPe8 0n0Q== 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=9NLfs5AbYJF7ESK5xuIslXoD/IqVsX2Fckqfe1g6VEo=; b=WKtMsMoQvv1Llp9uxNlHHKdgsGeapjLRtj6tK4oeGxjZHJudlomjo2HgbU4YGtfouz 7LF5ksyOW/fs3XpFjVT664dkK3cZWqQir/NGEHxkqtPEYwSEiiprRA+9urLJoeCSKQfB lZE8A9026k+n1e3bJ77kLuEGGOTyz13ZK1rSzArgetcQhWVAjyfTb1hCynLrAPoz3bLS kTCFePCJNiVXNjvHLOSx8JU6ZGoWavUx46ql4cooy4+D7hwktUJkpNNmM0q9JtZ5PCMX C1HuT/eXPU0vZ4vWcNKY0crvn1VTcfFfS2JueFjl7/MYoEyEHpeKGYARJh7MDyrYZdK8 W45A== X-Gm-Message-State: APjAAAXNDAvfdaA7YmOiFadMSkNropt0JXIFq+kAPA95z7wBccnu+jZW ZaeNtTu/hKtEbjvMMgeeSu4+mQ== X-Google-Smtp-Source: APXvYqy5rXpPGbBIsS2Xs24nn7pskO84cmqAOdnBucJG9wzJR6f8tLHNvHsrmbiR8vWLgF0rsAnH1w== X-Received: by 2002:ac2:5a19:: with SMTP id q25mr15112277lfn.178.1568631293376; Mon, 16 Sep 2019 03:54:53 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:52 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 10/14] samples: bpf: makefile: use target CC environment for HDR_PROBE Date: Mon, 16 Sep 2019 13:54:29 +0300 Message-Id: <20190916105433.11404-11-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org No need in hacking HOSTCC to be cross-compiler any more, so drop this trick and use target CC for HDR_PROBE. Signed-off-by: Ivan Khoronzhuk Acked-by: Andrii Nakryiko --- samples/bpf/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index b5c87a8b8b51..18ec22e7b444 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -214,15 +214,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 Mon Sep 16 10:54:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162729 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="E9WHFu0T"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X3753jVwz9sPn for ; Mon, 16 Sep 2019 20:55:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732659AbfIPKz2 (ORCPT ); Mon, 16 Sep 2019 06:55:28 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:46252 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732548AbfIPKy4 (ORCPT ); Mon, 16 Sep 2019 06:54:56 -0400 Received: by mail-lj1-f195.google.com with SMTP id e17so33223128ljf.13 for ; Mon, 16 Sep 2019 03:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MLJcNNJZkagwGK0zIyaqmigCmuc2QO9sJ0CkQCG94a8=; b=E9WHFu0TVM9YPIg7e9FZQRJiw7GUUX46qDnJ7XJhp3tzqNkGIEkdZ/VfJkd5CiXCIu soL1+mGe5drovecAMdpE93IRIhgR5mqv5Inm7FMZtz3sR+ufpAD/Vj+CYguj9jaX979F eFqpi/6RF90/XKCxiwnqHbTubyY2+/Q2q7UmsEzAUVdYX0iubLOvOOMtNb6rLhLftlI8 LGDNDWirLx7qPTGiEj+xYJs+l+TAonQmkRLwyJcjWSOCrpnM1a9qakwXyDalWaCOcOpj avbgMt/cu6EWydrCF+LYQy6vWHBc6xfHcI6HCINSXEg03CYbhAha+4hat/DwPB08BSH0 IXoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MLJcNNJZkagwGK0zIyaqmigCmuc2QO9sJ0CkQCG94a8=; b=dZ8p5Qkp9iOsr1gD3wppxd/xexzNHesbQo5HtDSj8YEp59dq/Q4e32EQAbxErSVpiV +qTnewWg0eQG98w6CXhiTfTgFmD3+D7FGv3rN9ndgmEz7Mw4HJSsoT43fV2UkeennQpe zAUKQKLYZikpmxklvrxsNNX3nZoiwmD1QKzif5+Xl8AQAYgViRE6j/CdYBOFL8Ov6X9M UevQJXqx/fRQfeMDYgLaLQ9VDsFZYoRxk49wDTBpBcXEcfa57CFh6M/JGDC5A1u54rmV 2+jwi06J6380TklvmP8DY6BaU6ivMoLOEE5b2tymllBVRcm7V4MVdxrp9et4KWYEaY6H i6yA== X-Gm-Message-State: APjAAAXE6Nxn/x90yArb1rG7fgSh/ff9Scg6+PD1UIOGtILmM2N7uDNx Qz8PEf7EtCbpyJ8t6rirRiA5KA== X-Google-Smtp-Source: APXvYqwG3Sc5PdJ1BDI/ndJboxqwuppsJ0jjMTGaqjlVv0sD9MuujWpRu2ErqSb6ATwnfxiTcaiRgQ== X-Received: by 2002:a2e:9f17:: with SMTP id u23mr2122827ljk.241.1568631294682; Mon, 16 Sep 2019 03:54:54 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:54 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 11/14] libbpf: makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets Date: Mon, 16 Sep 2019 13:54:30 +0300 Message-Id: <20190916105433.11404-12-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In case of LDFLAGS and EXTRA_CC/CXX flags there is no way to pass them correctly to build command, for instance when --sysroot is used or external libraries are used, like -lelf, wich can be absent in toolchain. This can be used for samples/bpf cross-compiling allowing to get elf lib from sysroot. Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index c6f94cffe06e..bccfa556ef4e 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -94,6 +94,10 @@ else CFLAGS := -g -Wall endif +ifdef EXTRA_CXXFLAGS + CXXFLAGS := $(EXTRA_CXXFLAGS) +endif + ifeq ($(feature-libelf-mmap), 1) override CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT endif @@ -176,8 +180,9 @@ $(BPF_IN): force elfdep bpfdep $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) $(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN) - $(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \ - -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@ + $(QUIET_LINK)$(CC) $(LDFLAGS) \ + --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \ + -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@ @ln -sf $(@F) $(OUTPUT)libbpf.so @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION) @@ -185,7 +190,7 @@ $(OUTPUT)libbpf.a: $(BPF_IN) $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a - $(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@ + $(QUIET_LINK)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $^ -lelf -o $@ $(OUTPUT)libbpf.pc: $(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \ From patchwork Mon Sep 16 10:54:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162724 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kBKPwGq0"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X36m1crrz9sQt for ; Mon, 16 Sep 2019 20:55:11 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732605AbfIPKzB (ORCPT ); Mon, 16 Sep 2019 06:55:01 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:40620 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732564AbfIPKy6 (ORCPT ); Mon, 16 Sep 2019 06:54:58 -0400 Received: by mail-lf1-f65.google.com with SMTP id d17so9214935lfa.7 for ; Mon, 16 Sep 2019 03:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GxawIQ/MKoaOi42wOtzkwYPMR5CVbDtqJel19jnEoB8=; b=kBKPwGq0mxxasnUu8ZX4K5BUyfdUDK4at7rwgKR0KzP3udeJcRypxl6J6mXwSYptEI GTvX/Y9iRzZddsykOu7Nlc8Pw/gKhZd+iad9pzVoqIiGe8rjSNE+J2mVt23GFITZ+Zy1 ENpShtY9dvkl0TIxofqTrkdzjwgILVAW6GT1zul5j6yyGWB56wXx34c7J7RUYINRpTdl cu7B1+uzv1Nz4WWCL4UcKSvh8ShMCvcLzxr4WZSRinLS7NDUSri7YzJM1k6fvRn5p3+n 3Naodq56EveQzQ5cGR1+YAil3F1aalEHLr4w0rRvTpue+DuT6rfDoAYi0+8uPQ0+a3t9 utlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GxawIQ/MKoaOi42wOtzkwYPMR5CVbDtqJel19jnEoB8=; b=caV6yHaUaMidlFRMgY0/L3Py6+fPHeZqkuLCyMpvuc1rHcm2MarzXzyBnDtMPFHwBS BuTCAAUNaX4fUzajrzXombue2TImef8kJs9G1eI4XwlMwuq08O/89vQPwXAXtu6gRVqN ji/o1/6AiIE7kCtL5CNWmXwpPFuxw4Wn7VUC6UjedWAR4A2q0VrY3MXUwjPlM+i6BLLM S4yQHdLCfgQu+BVIgl99RuxDTGKHwyfPKMCy3Utnkqs9/XYRHLxyC2/dg4bL+Qa+fuv7 jCd9XZBdTWBLhqINESAmtI3IP8ATyySW9YP+yH7N31POoiGOaEDx8iYVCKqu88hGOLRL QMfg== X-Gm-Message-State: APjAAAV8UaIsljOpBHpNWpNGnQAVvjeW7mPwfkWSi0MgXyotjKDDce/J 6AtpTYfgs2pjcsQF0+6NnN5ZiA== X-Google-Smtp-Source: APXvYqybDDXo4hm0aSUXkdMe63uO/eDR7vCuhBu9UXylhlta4Tq7LeJLlEG5S6mxBfSUaSqbl6/OHg== X-Received: by 2002:ac2:5090:: with SMTP id f16mr39613241lfm.66.1568631295949; Mon, 16 Sep 2019 03:54:55 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:55 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 12/14] samples: bpf: makefile: provide C/CXX/LD flags to libbpf Date: Mon, 16 Sep 2019 13:54:31 +0300 Message-Id: <20190916105433.11404-13-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In order to build libs using C/CXX/LD flags of target arch, provide them to libbpf make. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 18ec22e7b444..133123d4c7d7 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -182,8 +182,6 @@ ifdef CROSS_COMPILE TPROGS_CFLAGS += -Wall TPROGS_CFLAGS += -O2 TPROGS_CFLAGS += -fomit-frame-pointer -TPROGS_CFLAGS += -Wmissing-prototypes -TPROGS_CFLAGS += -Wstrict-prototypes else TPROGS_LDLIBS := $(KBUILD_HOSTLDLIBS) TPROGS_CFLAGS += $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) @@ -196,6 +194,14 @@ TPROGS_CFLAGS += -I$(srctree)/tools/lib/ TPROGS_CFLAGS += -I$(srctree)/tools/include TPROGS_CFLAGS += -I$(srctree)/tools/perf +EXTRA_CXXFLAGS := $(TPROGS_CFLAGS) + +# options not valid for C++ +ifdef CROSS_COMPILE +$(TPROGS_CFLAGS) += -Wmissing-prototypes +$(TPROGS_CFLAGS) += -Wstrict-prototypes +endif + TPROGCFLAGS_bpf_load.o += -Wno-unused-variable TPROGS_LDLIBS += $(LIBBPF) -lelf @@ -257,7 +263,9 @@ clean: $(LIBBPF): FORCE # Fix up variables inherited from Kbuild that tools/ build system won't like - $(MAKE) -C $(dir $@) RM='rm -rf' LDFLAGS= srctree=$(BPF_SAMPLES_PATH)/../../ O= + $(MAKE) -C $(dir $@) RM='rm -rf' EXTRA_CFLAGS="$(TPROGS_CFLAGS)" \ + EXTRA_CXXFLAGS="$(EXTRA_CXXFLAGS)" LDFLAGS=$(TPROGS_LDFLAGS) \ + srctree=$(BPF_SAMPLES_PATH)/../../ O= $(obj)/syscall_nrs.h: $(obj)/syscall_nrs.s FORCE $(call filechk,offsets,__SYSCALL_NRS_H__) From patchwork Mon Sep 16 10:54:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162725 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="o+zzeQpt"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X36x55wvz9sPn for ; Mon, 16 Sep 2019 20:55:21 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728662AbfIPKzP (ORCPT ); Mon, 16 Sep 2019 06:55:15 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:44809 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732535AbfIPKzA (ORCPT ); Mon, 16 Sep 2019 06:55:00 -0400 Received: by mail-lf1-f66.google.com with SMTP id q11so12131147lfc.11 for ; Mon, 16 Sep 2019 03:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L1rbvOW+wQJfkI127ZZlgGnuYj2RYmEzxNGLFnF8DNQ=; b=o+zzeQpt0mAYpx6mc2RIjYCWYyOjhTHqnHHulW/RKWFhLKUdVgrqTTPr3iHy5E374v gG4cPe1wWsiBBnufog5HnjOQF5rH/3ruhSqJGzFNCB3Tx7RBfcMe458xx/vcOVqdU4ts H/5JFK4Mt4r8nE+O035eNaJztJhlPuKngB+tr//LANN79yG1GKmd28Rk5SiJlpiZykoJ V2B4/S10B+jsSXXcJqch1uNJyQ2ORizv9Nrw2rUMutmDleyxOSRakaDYiVvDKRcMHhej Po+om1loSyc7BuoEjEhiDxDFLDwFH2Zx5+OY39T98MmR5JOB2iRCiX+TxdT2sBk1zq5o cVYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L1rbvOW+wQJfkI127ZZlgGnuYj2RYmEzxNGLFnF8DNQ=; b=q4i32XxEwbOusTtZboqQQE8QsyGxu7o4vQpGxkOWuOOEuhEskC3Aa5BIzQ430JcRTt 7LTS4EV/zMidaRHOVwjdKB6KEiygQgupIDR9zG6bdsDGi37CYUgULN2v82sGXaxzII0L MbwBTHgrceE5tTl0rmfOW5F0yQsstW9kHAOAmscfHmN482Q0zY10LxPTmaZIx6zUtLLs Laq+YqI4LnIdso4zZqiAWMPlL6VbRw1nABMQGYAgQi2xn6EzYm+N8D3Cx4BKRNjTGsNk kaQm1HqHVDHWMzvEcJvrHttWLRbomxtPQqZgbw5ZecADb5B8bcOPNSdvQoz1N6IwWfrH WN/A== X-Gm-Message-State: APjAAAX5G8rCcZM3bFi1KBMurorRZot8PAuuIeNHZ+/fusYfZs9v2r5c DWmiRJHYJU0XQJX5jeNAetjQOQ== X-Google-Smtp-Source: APXvYqw+IShRYsfCy6UuVP1nv9ec7UYDVaoYikIxgQwnNQBgJGl+EwStDh+PySmzILReJ/PEBeHdIQ== X-Received: by 2002:a05:6512:251:: with SMTP id b17mr16802393lfo.35.1568631297220; Mon, 16 Sep 2019 03:54:57 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:56 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 13/14] samples: bpf: makefile: add sysroot support Date: Mon, 16 Sep 2019 13:54:32 +0300 Message-Id: <20190916105433.11404-14-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Basically it only enables that was added by previous couple fixes. Sysroot contains correct libs installed and its headers ofc. Useful when working with NFC or virtual machine. Usage: clean (on demand) make ARCH=arm -C samples/bpf clean make ARCH=arm -C tools clean make ARCH=arm clean configure and install headers: make ARCH=arm defconfig make ARCH=arm headers_install build samples/bpf: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- samples/bpf/ \ SYSROOT="path/to/sysroot" Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 133123d4c7d7..57ddf055d6c3 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -194,6 +194,11 @@ TPROGS_CFLAGS += -I$(srctree)/tools/lib/ TPROGS_CFLAGS += -I$(srctree)/tools/include TPROGS_CFLAGS += -I$(srctree)/tools/perf +ifdef SYSROOT +TPROGS_CFLAGS += --sysroot=${SYSROOT} +TPROGS_LDFLAGS := -L${SYSROOT}/usr/lib +endif + EXTRA_CXXFLAGS := $(TPROGS_CFLAGS) # options not valid for C++ From patchwork Mon Sep 16 10:54:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1162723 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="MhheypW2"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46X36h71QLz9sPn for ; Mon, 16 Sep 2019 20:55:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726369AbfIPKzH (ORCPT ); Mon, 16 Sep 2019 06:55:07 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:46679 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732585AbfIPKzC (ORCPT ); Mon, 16 Sep 2019 06:55:02 -0400 Received: by mail-lf1-f67.google.com with SMTP id t8so27019134lfc.13 for ; Mon, 16 Sep 2019 03:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sLN8PEIzdXJ4vyRQJpg4LVfYYRixS2x0Ts7jhtzHOWM=; b=MhheypW2XDysOKktHNsxSG7LxAVuj81gvn1nIXQCjY3ZjEOWVw64CWPx+TsC7e8i/L N3aTKRxdyURBfnZY8cnxzthB0q06sfJEdgrJndGnTTm5DkQ05sqC18szpQVvwPI205JM FD5UbVZfrw17pax6P2aNxvYr0kPjRThua9mL+vYGNNZLqWM5aAc2R1FBXyERvpvxhH9Y sO3McigyojSgOHI03jFVLTIjTnYlbMcahGt86azSZyWWNsHChJFWikNBqpHmK10qnbhD MUjWVDOpY59AA0cDjDtsDASxXF5BF6kAI1VLiq/RWUSorKaA/C3Pq9jt+rQKiEq3xjlk 8fRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sLN8PEIzdXJ4vyRQJpg4LVfYYRixS2x0Ts7jhtzHOWM=; b=EdKTInn+iQxSQkxrgr+FGZDeihYHAsxJgvtGdWbINaVKJdz4FnBf8H9wkMOXBsJU/6 BRrhpiU/cujl2M5CPST3bm16NeW9f3Rmm7PbLIM8p6H3wE5PdoAhwWB7LaP1vzFsor3/ w17DSWC93Nmf5bSBhxD7hOedSZ2WvffYDchX7Ye0Bp5JrbBnRmH1K1lYcViK34XRlPhF jrol/queTdiXB6Vtn0jE8f8nbwGwZjEfZAt+f78MwzxbI/K3B6GHP967RjEwaa5dIYMV rS9zr7Y/1gNYZM079h32mRsA5nifO/eCLyNvjLZ69LCF8GQOTzNpx2wOrpjxL0UkCm/N ZUfA== X-Gm-Message-State: APjAAAX1ZZqxozAnfCVp3XY7FebIAs1x7d5MLAn08MPh/zY0nXw22FGr qwiyKaDZukUoIY4VqAhNeKbd8A== X-Google-Smtp-Source: APXvYqy4XqmgKre21JjPHCrnRIiHAk6YzQKm/zoD14WloikJ/3u32TM1a02cS68ct/GlCIZU/MCNQQ== X-Received: by 2002:a19:4f5a:: with SMTP id a26mr37493210lfk.116.1568631298482; Mon, 16 Sep 2019 03:54:58 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:57 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 14/14] samples: bpf: README: add preparation steps and sysroot info Date: Mon, 16 Sep 2019 13:54:33 +0300 Message-Id: <20190916105433.11404-15-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Add couple preparation steps: clean and configuration. Also add newly added sysroot support info to cross-compile section. --- samples/bpf/README.rst | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/samples/bpf/README.rst b/samples/bpf/README.rst index 5f27e4faca50..d5845d73ab7d 100644 --- a/samples/bpf/README.rst +++ b/samples/bpf/README.rst @@ -14,6 +14,20 @@ Compiling requires having installed: Note that LLVM's tool 'llc' must support target 'bpf', list version and supported targets with command: ``llc --version`` +Clean and configuration +----------------------- + +It can be needed to clean tools, samples or kernel before trying new arch or +after some changes (on demand):: + + make -C tools clean + make -C samples/bpf clean + make clean + +Configure kernel, defconfig for instance:: + + make defconfig + Kernel headers -------------- @@ -68,9 +82,26 @@ It is also possible to point make to the newly compiled 'llc' or Cross compiling samples ----------------------- In order to cross-compile, say for arm64 targets, export CROSS_COMPILE and ARCH -environment variables before calling make. This will direct make to build -samples for the cross target. +environment variables before calling make. But do this before clean, +cofiguration and header install steps described above. This will direct make to +build samples for the cross target:: + + export ARCH=arm64 + export CROSS_COMPILE="aarch64-linux-gnu-" + +Headers can be also installed on RFC of target board if need to keep them in +sync (not necessarily and it creates a local "usr/include" directory also):: + + make INSTALL_HDR_PATH=~/some_sysroot/usr headers_install + +Pointing LLC and CLANG is not necessarily if it's installed on HOST and have +in its targets appropriate arm64 arch (usually it has several arches). +Build samples:: + + make samples/bpf/ + +Or build samples with SYSROOT if some header or library is absent in toolchain, +say libelf, providing address to file system containing headers and libs, +can be RFS of target board:: -export ARCH=arm64 -export CROSS_COMPILE="aarch64-linux-gnu-" -make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang + make samples/bpf/ SYSROOT=~/some_sysroot