linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
To: linux@armlinux.org.uk, 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-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, clang-built-linux@googlegroups.com,
	Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Subject: [PATCH RFC bpf-next 05/10] samples: bpf: Makefile: use vars from KBUILD_CFLAGS to handle linux headers
Date: Fri, 30 Aug 2019 03:50:32 +0300	[thread overview]
Message-ID: <20190830005037.24004-6-ivan.khoronzhuk@linaro.org> (raw)
In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.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


  parent reply	other threads:[~2019-08-30  0:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30  0:50 [PATCH RFC bpf-next 00/10] improve/fix cross-compilation for bpf samples Ivan Khoronzhuk
2019-08-30  0:50 ` [PATCH RFC bpf-next 01/10] samples: bpf: Makefile: use --target from cross-compile Ivan Khoronzhuk
2019-08-30  0:50 ` [PATCH RFC bpf-next 02/10] samples: bpf: Makefile: remove target for native build Ivan Khoronzhuk
2019-08-30  0:50 ` [PATCH RFC bpf-next 03/10] libbpf: Makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets Ivan Khoronzhuk
2019-08-30  0:50 ` [PATCH RFC bpf-next 04/10] samples: bpf: use own EXTRA_CFLAGS for clang commands Ivan Khoronzhuk
2019-08-30  0:50 ` Ivan Khoronzhuk [this message]
2019-08-30  0:50 ` [PATCH RFC bpf-next 06/10] samples: bpf: makefile: fix HDR_PROBE Ivan Khoronzhuk
2019-08-30  0:50 ` [PATCH RFC bpf-next 07/10] samples: bpf: add makefile.prog for separate CC build Ivan Khoronzhuk
2019-08-30  0:50 ` [PATCH RFC bpf-next 08/10] samples: bpf: Makefile: base progs build on Makefile.progs Ivan Khoronzhuk
2019-08-30  0:50 ` [PATCH RFC bpf-next 09/10] arm: include: asm: swab: mask rev16 instruction for clang Ivan Khoronzhuk
2019-08-30  0:50 ` [PATCH RFC bpf-next 10/10] arm: include: asm: unified: mask .syntax unified " Ivan Khoronzhuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190830005037.24004-6-ivan.khoronzhuk@linaro.org \
    --to=ivan.khoronzhuk@linaro.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=john.fastabend@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).