Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759291AbcDAOjf (ORCPT ); Fri, 1 Apr 2016 10:39:35 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:59635 "EHLO e23smtp08.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758815AbcDAOjc (ORCPT ); Fri, 1 Apr 2016 10:39:32 -0400 X-IBM-Helo: d23dlp01.au.ibm.com X-IBM-MailFrom: naveen.n.rao@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;netdev@vger.kernel.org Date: Fri, 1 Apr 2016 20:07:51 +0530 From: "Naveen N. Rao" To: Daniel Borkmann Cc: Alexei Starovoitov , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, "David S . Miller" Subject: Re: [PATCH 2/4] samples/bpf: Use llc in PATH, rather than a hardcoded value Message-ID: <20160401143751.GF17907@naverao1-tp.ibm.com> References: <922f95fb5d16686367a66d2d4bd176149a87e9ad.1459423412.git.naveen.n.rao@linux.vnet.ibm.com> <56FD627D.5080405@fb.com> <56FD6A2C.2010506@iogearbox.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56FD6A2C.2010506@iogearbox.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16040114-0029-0000-0000-0000453598E0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2874 Lines: 60 On 2016/03/31 08:19PM, Daniel Borkmann wrote: > On 03/31/2016 07:46 PM, Alexei Starovoitov wrote: > >On 3/31/16 4:25 AM, Naveen N. Rao wrote: > >> clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ > >> -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ > >>- -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ > >>+ -O2 -emit-llvm -c $< -o -| llc -march=bpf -filetype=obj -o $@ > >> clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ > >> -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ > >>- -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=asm -o $@.s > >>+ -O2 -emit-llvm -c $< -o -| llc -march=bpf -filetype=asm -o $@.s > > > >that was a workaround when clang/llvm didn't have bpf support. > >Now clang 3.7 and 3.8 have bpf built-in, so make sense to remove > >manual calls to llc completely. > >Just use 'clang -target bpf -O2 -D... -c $< -o $@' > > +1, the clang part in that Makefile should also more correctly be called > with '-target bpf' as it turns out (despite llc with '-march=bpf' ...). > Better to use clang directly as suggested by Alexei. I'm likely missing something obvious, but I cannot get this to work. With this diff: $(obj)/%.o: $(src)/%.c clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ - -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ - clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ - -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ - -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=asm -o $@.s + -O2 -target bpf -c $< -o $@ I see far too many errors thrown starting with: clang -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ -O2 -target bpf -c samples/bpf/map_perf_test_kern.c -o samples/bpf/map_perf_test_kern.o In file included from samples/bpf/map_perf_test_kern.c:7: In file included from include/linux/skbuff.h:17: In file included from include/linux/kernel.h:10: In file included from include/linux/bitops.h:36: In file included from ./arch/x86/include/asm/bitops.h:500: ./arch/x86/include/asm/arch_hweight.h:31:10: error: invalid output constraint '=a' in asm : "="REG_OUT (res) ^ ./arch/x86/include/asm/arch_hweight.h:59:10: error: invalid output constraint '=a' in asm : "="REG_OUT (res) What am I missing? - Naveen