Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4609512ybe; Mon, 16 Sep 2019 15:26:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyeu2VmoPjwUSizUzqe7wwzsBGbCy4qMS4K8RVOC//aSg6WRIymhxX1GE4gBg0VKB/zNMP8 X-Received: by 2002:a50:9e65:: with SMTP id z92mr1631872ede.49.1568672772233; Mon, 16 Sep 2019 15:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568672772; cv=none; d=google.com; s=arc-20160816; b=jv56QQMM3sq4P6KFp+MQoiBt9RzpKgFFAYW2EbX5Xy2/1TihP6CY+QMJwE7JSmW2S1 b4xt82zl7ycK/eKVAru3sfv67wGdWQ7AzSdYuBNG9VGGU2r4nVFix3BbEZzADfdxKr1q 6SB3ffYJBCWVCABsBDmfaoM9NdL6yySyCIT1DdrI44IsEiFqVp6/CBoZSqb9IZRqduP4 IPFRtETym51pxVhsc9Dz/yZD0A+JZEwcKmD2k7IoB/WJ1X1M4kD+wvJm/iWUNHRxKGrL UT8Sy1OKbPVuCrZXjVADDTX2O92bi/UnBjASziOqYnRGidnlfcg0XX8CGOjHNLp4AkGS c93A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fNQ0/77F+AwzFz6t9T1s7MhdfhD+EKvJmwBiN2PsM0A=; b=lOTR7zWWWeqRSPl/epDxbslYtSZvAZWIcvXPVDnFIpeYtJykX+nCHgsUlNT+ITj+a3 lSiuK3r8IpTkKTIx/q5z74UXAZPkwfmLzv8payNJj+cabDNPWVWFPQppO1EfRcVnZpWf GoE/QN4OCCBNCZfzLP71cQYkhuYW8A3Nm9j2ILX68/z4KNyKKGiDIMyrKe2sI/Xhpd/U MSvsCCPU3MMQF6RJZBjsvwb95SJv2mnZTjTw+fI8uM/0ZSBOjhfkYiBxnFA/+vKgG3sJ h8g+0MBIllQnFI5pBgncHdPD45B+dSiki35/oTC7NeH1QLir6aa8yqGh/eEFM+6duXcX xrMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WxF5VH3D; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by16si261213edb.30.2019.09.16.15.25.44; Mon, 16 Sep 2019 15:26:12 -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=@gmail.com header.s=20161025 header.b=WxF5VH3D; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391502AbfIPUog (ORCPT + 99 others); Mon, 16 Sep 2019 16:44:36 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:34016 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387513AbfIPUof (ORCPT ); Mon, 16 Sep 2019 16:44:35 -0400 Received: by mail-qt1-f195.google.com with SMTP id j1so1625889qth.1; Mon, 16 Sep 2019 13:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fNQ0/77F+AwzFz6t9T1s7MhdfhD+EKvJmwBiN2PsM0A=; b=WxF5VH3DkkGuMREPXNnBNs776VjAu9QvdYnof94lPdrdw+fGzg7amWLYNcVZTYVr0E PfIdvDOcGocHIpzPGEdYNNrelIItwsFKohmfRlsAGAklFkMx6av53NyNilI423DUd82r Iokta/kg02tepBP8pq4aKRETHwoWJ12atxXksAm7DYv+grOVEZ7bDeopX4hfAOeIs+H5 xqqrAkaDzPDf/uUkgyy4aldUSTi/H6LdDAW24gE6c2/9LNwl25YZO2ekp+VBb/nBP26K WTxx9bDaMjlJtQUpnDHx7M0mNCUdkpEgKWcHN1RfMw/s/4HzDZZZtIII6f4/WcMbUDtU g8ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fNQ0/77F+AwzFz6t9T1s7MhdfhD+EKvJmwBiN2PsM0A=; b=RVlorYOf2Xd6VNd8xI+CyWbxb1LdtLc4n0RI0Yf7tqq4klbo21AugdLMuGJmA+wC2N ct05oXKQonOvS3vRzTWMjq58j7YLjmMLTOSFdqWQkKHS3SKVIepfr34p8aN3sOOANDc9 e72scYyx11i30cjjPDmQAe62zETqAcm7RXEbDxiyc2Me8x8KVS4Vd//MOdxsnmvrN7Uu fb+1f1VootE1bZrw9XjWZLjO7ITGcWMwSH+WO0EixbCe/LdWgWpr9YUd4AvPvD4lqBRs nb33souAwNQmvnRDUCszYmG3BRVhiK9nB7yOzjgWm/tXXqyC5ZH82NgL8edGyb8nR24y nz4w== X-Gm-Message-State: APjAAAVioMPc8xECpIT9aB0NQrTDWKYaw4Ta9mhQOrsiD9mVOmT4I0vx qZPSoB5XG5ysvZFZoMVwoNbbuwYUH8fHedxht0g= X-Received: by 2002:a05:6214:114a:: with SMTP id b10mr201853qvt.150.1568666674518; Mon, 16 Sep 2019 13:44:34 -0700 (PDT) MIME-Version: 1.0 References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> <20190916105433.11404-6-ivan.khoronzhuk@linaro.org> In-Reply-To: <20190916105433.11404-6-ivan.khoronzhuk@linaro.org> From: Andrii Nakryiko Date: Mon, 16 Sep 2019 13:44:23 -0700 Message-ID: Subject: Re: [PATCH v3 bpf-next 05/14] samples: bpf: makefile: use __LINUX_ARM_ARCH__ selector for arm To: Ivan Khoronzhuk Cc: Alexei Starovoitov , Daniel Borkmann , Yonghong Song , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , john fastabend , open list , Networking , bpf , clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 16, 2019 at 3:59 AM Ivan Khoronzhuk wrote: > > For arm, -D__LINUX_ARM_ARCH__=X is min version used as instruction > set selector and is absolutely required while parsing some parts of > headers. It's present in KBUILD_CFLAGS but not in autoconf.h, so let's > retrieve it from and add to programs cflags. In another case errors > like "SMP is not supported" for armv7 and bunch of other errors are > issued resulting to incorrect final object. > --- > samples/bpf/Makefile | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile > index 8ecc5d0c2d5b..d3c8db3df560 100644 > --- a/samples/bpf/Makefile > +++ b/samples/bpf/Makefile > @@ -185,6 +185,16 @@ HOSTLDLIBS_map_perf_test += -lrt > HOSTLDLIBS_test_overhead += -lrt > HOSTLDLIBS_xdpsock += -pthread > > +ifeq ($(ARCH), arm) > +# Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux > +# headers when arm instruction set identification is requested. > +ARM_ARCH_SELECTOR = $(shell echo "$(KBUILD_CFLAGS) " | \ > + sed 's/[[:blank:]]/\n/g' | sed '/^-D__LINUX_ARM_ARCH__/!d') Does the following work exactly like that without shelling out (and being arguably simpler)? ARM_ARCH_SELECTOR = $(filter -D__LINUX_ARM_ARCH__%, $(KBUILD_CFLAGS)) > + > +CLANG_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) > +KBUILD_HOSTCFLAGS := $(ARM_ARCH_SELECTOR) Isn't this clearing out previous value of KBUILD_HOSTCFLAGS? Is that intentional, or it was supposed to be += here? > +endif > + > # 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 >