From patchwork Wed May 17 08:18:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Alemayhu X-Patchwork-Id: 763365 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wSRzy6qxfz9s82 for ; Wed, 17 May 2017 18:19:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=alemayhu-com.20150623.gappssmtp.com header.i=@alemayhu-com.20150623.gappssmtp.com header.b="DXG3RtaG"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753880AbdEQISx (ORCPT ); Wed, 17 May 2017 04:18:53 -0400 Received: from mail-wr0-f182.google.com ([209.85.128.182]:34016 "EHLO mail-wr0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752300AbdEQISt (ORCPT ); Wed, 17 May 2017 04:18:49 -0400 Received: by mail-wr0-f182.google.com with SMTP id l9so3072815wre.1 for ; Wed, 17 May 2017 01:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alemayhu-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=btgZsXWzO27Fixk74eqEuwW4+vTx4kVAR8OKldEhn0Q=; b=DXG3RtaGmWKOJJBLoFZwGfhKrM/NgMeTo1MTtM4VuCNWiE87YtzvfjMLIYbR+ghQam 2qpV2WtEbYGp68YKeos2q+f5JP+iMpa/QvImSXRs3oqXJ4jg+V0pHx6ExQB7B/2DoOD5 C39aO3+3YYAUT+h+KzQm8ZIMMSUBU0HHIhBri36MRA9KSlGmexWsihmUefE7tPcmhpKm mqsnu/l1QVEinM5dkD5bmQpTmbvrt4GgCyFsS1rPLQqIdS2yJj6WkhIEd2ymk8jPOdLx WU+MWj5i7uqfen3XDKU397ExseSpjXAMdKwsja7pe1gE9i997WH/vlsxJ8P+FjLfEHQ7 xO/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=btgZsXWzO27Fixk74eqEuwW4+vTx4kVAR8OKldEhn0Q=; b=hJeci2SL+YmA81sUDb3xmGteKXetPf+YglFWXuTrZJUATuURI7gxvuwLRKjhXaPckt 3rJWuQviS6fUfwaj6qoGYkAOOrZhBwz2PP9SBuwYU0y0vmsT6iby0AdgEX9kxwIjMOVo vqZ7ybOa++VnYMfvzYADFgTxXOYJU4WSb8L/uD1R0y7NSDkO0GfAYhgF2avXfJcAvhZI 1YDDxK/8Y3bsA/8++uyaqvxyQXr48kPyq/rRFVqMiCUMUG5+ulcDWN2Y+9JKag8MmAic BgShqDElrVhaym8L4Wm3AkkaGCACwmBISzWIhZlAD8wC/s0qP+ret8ki6soQt9Y8WCL3 kAZQ== X-Gm-Message-State: AODbwcDv2Q5TvyF0jEBxHrUQU7PI+6Tzjf8LdMSo2sn0sGt6oo60iOM+ o3kiZsq0OGx/AcA4 X-Received: by 10.223.183.16 with SMTP id l16mr1442399wre.42.1495009127738; Wed, 17 May 2017 01:18:47 -0700 (PDT) Received: from gmail.com ([2a01:4f8:121:2342::2]) by smtp.gmail.com with ESMTPSA id c37sm1173188wra.16.2017.05.17.01.18.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 May 2017 01:18:46 -0700 (PDT) Date: Wed, 17 May 2017 10:18:44 +0200 From: Alexander Alemayhu To: David Ahern Cc: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , David Ahern , Alexei Starovoitov , Daniel Borkmann , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Wang Nan , netdev@vger.kernel.org Subject: Re: [PATCH v1] samples/bpf: Add a .gitignore for binaries Message-ID: <20170517081844.GA4447@gmail.com> References: <20170212212356.11675-1-mic@digikod.net> <8277c7cc-8f44-40ec-1f7e-53c404d84292@cumulusnetworks.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, May 16, 2017 at 04:27:36PM -0700, David Ahern wrote: > > The problem stems from the fact that bpf samples do not really fall into > the 'hostprogs' category (see "4 Host Program support" in > Documentation/kbuild/makefiles.txt). Fixing samples/bpf to not rely on > it is the better long term solution. Building of tools/ for example does > not rely on it so there is an existing example of leveraging kernel > headers without the overhead. +1 I have looked into this but found it to be not easy and all attempts to change the Makefile has resulted in obscure errors :/ Getting clang to output in a different directory was easy[0], but I guess this is not the right approach either. Have you tried making the change? [0]: diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 6c7468eb3684..79268d310ba5 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -1,6 +1,13 @@ # kbuild trick to avoid linker error. Can be omitted if a module is built. obj- := dummy.o +ifndef O + OUTPUT := $(shell pwd)/samples/bpf/_build/ +else + OUTPUT := $O/ +endif +$(shell mkdir -p $(OUTPUT)) + # List of programs to build hostprogs-y := test_lru_dist hostprogs-y += sock_example @@ -190,4 +197,4 @@ $(obj)/%.o: $(src)/%.c -Wno-gnu-variable-sized-type-not-at-end \ -Wno-address-of-packed-member -Wno-tautological-compare \ -Wno-unknown-warning-option \ - -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ + -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $(OUTPUT)$(shell basename $@)