From patchwork Wed Sep 4 21:22:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173075 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp454810ilq; Wed, 4 Sep 2019 14:23:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFpu8HCaqBRZTqEgjd9Qt4B+MnAt0XpdmDDI/nXKaXHpvfsqf9ahtlkW76ilqIE5hznude X-Received: by 2002:a65:64cf:: with SMTP id t15mr187995pgv.88.1567632191281; Wed, 04 Sep 2019 14:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632191; cv=none; d=google.com; s=arc-20160816; b=dg2yr817JM/s+y5Q95luhU3xgDKDRLD+34Y3R0Nr/UCEXZ2IJ6tvky/6C5TqPMItQD 7+Ffy5Pl19MwHfecu86U5NW20FY0wZf7Pqk1awUbvG1dEXDA8B0LVHfF3HVd5LU9OM1u K0/B1IyPju06pxjJr9SYgG7BAGGroOoI4n7bxEHh2orcadHFIMpgpxUR5xHbE7yE/dvi wZo1FOGsjW+WKDAKGgmQz8BETclGQNjjvUc9wZJhUxbiqhrbvxG3R7ydYaavYEe29ql5 VGQKH5IjgGT4bj43G2INzE636q7Q0FkfysvwHJa7GMtTFScFfalmK4qWo4JyDccN9EvE N0Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=XM+El1wyypVfaXfQc7FxTfECR5DYv9zUGiXmgC/VC5g=; b=j9gI/5fKJy5dPLaH3Sq1uoiyZtF6EyiX0ntVlvdAb+EMfq1xO51RhSfT8cLn97DIAV KjH4uyo0ai9tqHJybvlpA1g+W3wR/xGj+hLF34nZ07iIvMTkA/m1JZotcKyaAxdOTQYG x++AfPUz5izPnajv209qN/SwCTAW2wkunjwcLNNomYHRvX+qi7JpLPm5BmGGzchUhajc i/to5y40BCVl3B3QOux6aNZB/HmDWpaXfwP2VNU6N3P4dHOybxb2m66vXiHjq1Kaltlf OlCDv7UFI4g+kT8ArVdnfSbd/LSl0fi2OqHopkSLzHzL56fnlXlrGUNOfdCun4cmJyZr w4PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qrn6kZhS; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e79si9317051pfh.68.2019.09.04.14.23.11; Wed, 04 Sep 2019 14:23:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qrn6kZhS; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730546AbfIDVXJ (ORCPT + 8 others); Wed, 4 Sep 2019 17:23:09 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45650 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730269AbfIDVXJ (ORCPT ); Wed, 4 Sep 2019 17:23:09 -0400 Received: by mail-lj1-f193.google.com with SMTP id l1so153018lji.12 for ; Wed, 04 Sep 2019 14:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XM+El1wyypVfaXfQc7FxTfECR5DYv9zUGiXmgC/VC5g=; b=Qrn6kZhSPCRIfWPLbZQrXvK6lt7Iv2mnBJ9fLUFe1bB8d3A93TcSi0pQ7aJIbrRhRF VqBxOcqXvHmwM6B4nLPwZFInG3Lbs0ucLsOPQ7EWJ2SK5XqHUKTssZhdnQhNplsuEwSY x5Svyb5v24/nMZRgCDOGvj1X2TKa9ghB3bZt/+JUncKf7znkKi7UrsFYe2VfXlLM1Pw6 NdwK4iRuxsJnwFPInX7J5KfhCI19YZdPS/RrG1yxKH0/a/oOXRnDwEqfffdjpoAtOtZK I3CsCCXI734MGwDY9NZOTAFvNZ0ReU4TmWIEZK55u9m5rg9WFEW+C4nVp1ngSBNzeEKQ AHEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XM+El1wyypVfaXfQc7FxTfECR5DYv9zUGiXmgC/VC5g=; b=cKZfQEdF7Sac+TyWN3SC4lZHBp32t9aAdrxYOe+YPP7RqajKlDSkk4R3AbjivoPWG0 T1UMRnupGvzXCNcjpBzwtisDPdTC9RXx4dUlsBLLzLFU2GzJhDhJmPvDywMytr13JMBj rbxejg5qWqUw7aaNnM93UhRpWx53f2aTXvm1yFAgddW+lHlHdOz+bh/tJNbP5xwqSOWG UjZdrccBqoWi3SRNdDFJPmbVZK5tgsd6ui1PwYshrS408Lg1AN+skfEPvgASGIqsxlcS oOs0Tuz2WAQ8AU77kMEvkc7gY48QXTaPdbnTuVqKaWEP5x28w5STB1P32s2E6+7FPxEJ usow== X-Gm-Message-State: APjAAAXBAJS//NbzAR9IjxKfdbtag1PFjQV/eGCviiYiIrNWnB36X5Gl 6Uz3TNXHHPKrjvMOToTqva8l0Q== X-Received: by 2002:a2e:9a82:: with SMTP id p2mr24383354lji.64.1567632187076; Wed, 04 Sep 2019 14:23:07 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id s8sm3540836ljd.94.2019.09.04.14.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 14:23:06 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH bpf-next 5/8] samples: bpf: Makefile: use vars from KBUILD_CFLAGS to handle linux headers Date: Thu, 5 Sep 2019 00:22:09 +0300 Message-Id: <20190904212212.13052-6-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904212212.13052-1-ivan.khoronzhuk@linaro.org> References: <20190904212212.13052-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The kernel headers are reused from samples bpf, and autoconf.h is not enough to reflect complete configuration for clang. One of such configurations is __LINUX_ARM_ARCH__ min version used as instruction set selector. In another case an error like "SMP is not supported" for arm and others errors are issued and final object is not correct. --- samples/bpf/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index cdd742c05200..9232efa2b1b3 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -186,6 +186,13 @@ HOSTLDLIBS_map_perf_test += -lrt HOSTLDLIBS_test_overhead += -lrt HOSTLDLIBS_xdpsock += -pthread +# Strip all expet -D options needed to handle linux headers +# for arm it's __LINUX_ARM_ARCH__ and potentially others fork vars +D_OPTIONS = $(shell echo "$(KBUILD_CFLAGS) " | sed 's/[[:blank:]]/\n/g' | \ + sed '/^-D/!d' | tr '\n' ' ') + +CLANG_EXTRA_CFLAGS += $(D_OPTIONS) + # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang LLC ?= llc