From: Abhijit Ayarekar <abhijit.ayarekar@caviumnetworks.com>
To: ast@kernel.org
Cc: daniel@iogearbox.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Abhijit Ayarekar <abhijit.ayarekar@caviumnetworks.com>
Subject: [PATCH] Add -target to clang switch while cross compiling.
Date: Fri, 13 Oct 2017 12:24:06 -0700 [thread overview]
Message-ID: <1507922646-19260-1-git-send-email-abhijit.ayarekar@caviumnetworks.com> (raw)
In-Reply-To: <20171013011359.tyhynrjghe2krxec@ast-mbp>
Update to llvm excludes assembly instructions.
llvm git revision is below
commit 65fad7c26569 ("bpf: add inline-asm support")
This change will be part of llvm release 6.0
__ASM_SYSREG_H define is not required for native compile.
-target switch includes appropriate target specific files
while cross compiling
Tested on x86 and arm64.
Signed-off-by: Abhijit Ayarekar <abhijit.ayarekar@caviumnetworks.com>
---
samples/bpf/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index ebc2ad6..81f9fcd 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -180,6 +180,7 @@ CLANG ?= clang
# Detect that we're cross compiling and use the cross compiler
ifdef CROSS_COMPILE
HOSTCC = $(CROSS_COMPILE)gcc
+CLANG_ARCH_ARGS = -target $(ARCH)
endif
# Trick to allow make to be run from this directory
@@ -229,9 +230,9 @@ $(obj)/tracex5_kern.o: $(obj)/syscall_nrs.h
$(obj)/%.o: $(src)/%.c
$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \
-I$(srctree)/tools/testing/selftests/bpf/ \
- -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \
+ -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \
-D__TARGET_ARCH_$(ARCH) -Wno-compare-distinct-pointer-types \
-Wno-gnu-variable-sized-type-not-at-end \
-Wno-address-of-packed-member -Wno-tautological-compare \
- -Wno-unknown-warning-option \
+ -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \
-O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@
--
2.7.4
next prev parent reply other threads:[~2017-10-13 19:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 20:45 [PATCH] Add -target to clang switches while cross compiling Abhijit Ayarekar
2017-10-12 22:23 ` Alexei Starovoitov
2017-10-12 22:43 ` Abhijit Ayarekar
2017-10-12 23:16 ` Alexei Starovoitov
2017-10-12 23:58 ` [PATCH] Add -target to clang switch " Abhijit Ayarekar
2017-10-13 1:14 ` Alexei Starovoitov
2017-10-13 19:24 ` Abhijit Ayarekar [this message]
2017-10-13 22:10 ` Alexei Starovoitov
2017-10-13 22:12 ` Abhijit Ayarekar
2017-10-14 23:10 ` Daniel Borkmann
2017-10-12 23:45 ` Abhijit Ayarekar
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=1507922646-19260-1-git-send-email-abhijit.ayarekar@caviumnetworks.com \
--to=abhijit.ayarekar@caviumnetworks.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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