Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp25903ybe; Wed, 4 Sep 2019 14:25:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQgJaSQ/vN/y0Beb0YoLiJPwdwZ7how6C2hdwCPf/eicnKaYFYbwQmB6blEjAEBEx+KJnv X-Received: by 2002:a17:902:e605:: with SMTP id cm5mr6168911plb.226.1567632358051; Wed, 04 Sep 2019 14:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567632358; cv=none; d=google.com; s=arc-20160816; b=j96Sn4MsCkrZvsiaN9wQonz8f85KE9JSlThGFpjDchBJTeO8sztugoifUQe2sHE/hD M01+80+gApQGgLG9fRVBPhytKgCxYAz1EmsQoWOGoK+Y//xYftnSq5Haykp0t0pMvFfd iwt/hqP4H2xQSuOEXHcfzmeoBy9L6yQBDliFEOnGDBtBDUSQ+6y0K3Xnn776QbyATSxY 0Lpu/Z2QjPS6amDHlsupmdGFON61NgQXSkeDLFEMyPejT0UsVXxBu+NtOn2dy27NrNMq 3gjMBUKKEfP8KYqvcVZFAQPDr5YKfq77Y8uAR/yqON2GPtPwMCDjTa/BGyCJUOM6iVHa zdQw== 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=rJJFMMmG68X47I0ISucIdy7XD0xnnXrJUuYXZ1f9SdBAila5t/Q9MHi/wpBAayluhz TcPrWsG2akm+FZC1qgPne+ry7Ogps5udHQWgiiof2Fib0Z323RNiIuYCFIR1d/I3n90O 24ne72mysOPtWwGrzAZ2WLgk0vEHR2xH2ldO9DJNfNeGWwwBMgdd/zTW6egWmCSZFHmf vTSeSUXv1Ka3SdGJJLk5+XpKF/OxrrytOBPlhd3y4xSEN5JKek2rZuVPLZydLIRVmnGE jN1FFsU/vM/IgDjCbY+uND0jYe3bv2vSo+43767NNRhQ6QfCU9pGU1odqMDLWKi7Xrv5 1+vw== 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 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 s23si17641421pgm.345.2019.09.04.14.25.42; Wed, 04 Sep 2019 14:25:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qrn6kZhS; 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 S1730800AbfIDVX1 (ORCPT + 99 others); Wed, 4 Sep 2019 17:23:27 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:44687 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730435AbfIDVXJ (ORCPT ); Wed, 4 Sep 2019 17:23:09 -0400 Received: by mail-lj1-f196.google.com with SMTP id u14so158401ljj.11 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=XLmJtx1uwf1ZMqp+KHlQHkVzvEjq5YogDiy9E/laODYyr/I6cromg1IOoKIx+L0MCH 1sNCPaVELaVP9P7ocDAVI20xziNt0KM3phKnXNgu7NN5QsNR89UFZxCfnO0mdl9DJYS1 MRTgDcKodkt0rxZdAFIH/XWXfw6GHfYLMaWpVY+UIPm5uYmGNH83YtEVoFDA7MEalj+s AehONhSuKchSqdaxJ8clS+PP0nDk1uYkCGoAtlExhmMInOiPwTQYr5VcAgoTwgP/rRWM Kz7DkfIEpOj8TavIZ4cZ1mX7QkDhLkEXsZmGuQiEVPiVdvuTva+uHtBIyF296MgMre5j mdTw== X-Gm-Message-State: APjAAAXzHnmk4IYnZBGOAMX5BBFjSKMUNNmLyhQd/HQgiYxes/aqgraw 7tPIDhdkarOk/yiB3Pf8CA0r9w== 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: 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 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(+) 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 -- 2.17.1