Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp162881ybz; Tue, 28 Apr 2020 20:49:24 -0700 (PDT) X-Google-Smtp-Source: APiQypJeEhfSVC4VJHNBhHnXUQbkOe8Xtg0kzMDWMM98awl+kSRaNLicNepeHrHotglCbZ6haEKM X-Received: by 2002:a50:d7d3:: with SMTP id m19mr810203edj.285.1588132164796; Tue, 28 Apr 2020 20:49:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588132164; cv=none; d=google.com; s=arc-20160816; b=mXVWTMvywEG87o2W/ogBAWztpp1wsAdCgi6WX0brru7i5/htgM5MlrB36FuSyVPuVj ansHeGG6/F3+3k8GdX2k+Kqfl/6GdOIxP+qWT2Q0UBtuNYzZL/JzKYQcjxVyiE9913r3 VOBy12tMAAX5f5KimHxdDWCH/cxohRD3VPb+SWPksFfP/PYaMniqHvSw8YZ7UGNfcsp6 mf+/B5JmJYaeH5mejX8zQ5UrzWZWqhG6rW1KUlSDqfZmck6OAPNsCkmmbZ+Fwb2Wk51p X9LJAiSt07NbqRmlC2FXPoC2m92lqWymXgEV9omIEPHR1dXirrCR3xWD7K0DbwBtGL0M UlVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=r0ApJvTUQqdiwCwVmjqPXR9YcqLdN3Uq3b73eGZxmw4=; b=dLh8FaWJyWg01N4eHN0cCJ8VomCtR75HL4l41mJuT74wreE0oG4M5tM0UGdU+wUMxg Ys3IkV+VIoD25OEl55KFQ0FngzSaHx3gH0T3qfo16Nj/5ElOH9ClPCMLQ5ItcLds+fwd Td8x/8684Qzn5Alecdo2oGFvQZL/6gkaKtOEg4jJYJKijmNAqas411QkdGAGQ0vCSJBf yehsN4Z8dLHtpfoy8GnvmW64j8CAXHt+m5AJEx5EWu87pujzI9dWV34pHC9rAlKY8KuT DkWkikzQna7PprUiE+5YYtxhy4WmnhXQqnDXhMiIRtHXxZWAp4eIhe1+DJDBXktsFKEh G8fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=KEqe3QK+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz15si2530904edb.381.2020.04.28.20.49.02; Tue, 28 Apr 2020 20:49:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=KEqe3QK+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726754AbgD2Dqc (ORCPT + 99 others); Tue, 28 Apr 2020 23:46:32 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:30777 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbgD2Dq3 (ORCPT ); Tue, 28 Apr 2020 23:46:29 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-12.nifty.com with ESMTP id 03T3jXlf020748; Wed, 29 Apr 2020 12:45:37 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 03T3jXlf020748 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1588131937; bh=r0ApJvTUQqdiwCwVmjqPXR9YcqLdN3Uq3b73eGZxmw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEqe3QK+R6INyBwdvUQsDfE97eXkBSzP572rVxsAkwTchj/QZAkBUC8ZPM4AFhDxa jmiNA7urCiRW+4L8+HzBOj4C502HprAKDvl2w7H8IX5gcouWiSyPVttXL9xgUpTh4t IwFNzW2D0vBc31jNeQBqEgU/d4fxDdhPvH6SjzXi7Nry+ninTc6b3eqVM/Tk39swgM Lz+c3RfavIVCfn5jEOtm2iTfuqe4ICU9raqGD1RoFLkrNur3qL1pSyoz6x7nt8/5BT oCnQMpWUYgcdNvhe3r2BWOdIw85+dE2tECFcuLFoV8Unq7/HHbDVbCRS1aX1P61fRk OIHsVEEqjJ2pg== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: bpf , Arnd Bergmann , Sam Ravnborg , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH v2 04/15] samples: seccomp: build sample programs for target architecture Date: Wed, 29 Apr 2020 12:45:16 +0900 Message-Id: <20200429034527.590520-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200429034527.590520-1-masahiroy@kernel.org> References: <20200429034527.590520-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These userspace programs include UAPI headers exported to usr/include/. 'make headers' always works for the target architecture (i.e. the same architecture as the kernel), so the sample programs should be built for the target as well. Kbuild now supports 'userprogs' for that. I also guarded the CONFIG option by 'depends on CC_CAN_LINK' because $(CC) may not provide libc. The 'ifndef CROSS_COMPILE' is no longer needed. BTW, the -m31 for s390 is left-over code. Commit 5a79859ae0f3 ("s390: remove 31 bit support") killed it. Signed-off-by: Masahiro Yamada Acked-by: Sam Ravnborg --- Changes in v2: None samples/Kconfig | 2 +- samples/seccomp/Makefile | 42 +++------------------------------------- 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/samples/Kconfig b/samples/Kconfig index 9d236c346de5..8949e9646125 100644 --- a/samples/Kconfig +++ b/samples/Kconfig @@ -126,7 +126,7 @@ config SAMPLE_PIDFD config SAMPLE_SECCOMP bool "Build seccomp sample code" - depends on SECCOMP_FILTER && HEADERS_INSTALL + depends on SECCOMP_FILTER && CC_CAN_LINK && HEADERS_INSTALL help Build samples of seccomp filters using various methods of BPF filter construction. diff --git a/samples/seccomp/Makefile b/samples/seccomp/Makefile index 89279e8b87df..75916c23e416 100644 --- a/samples/seccomp/Makefile +++ b/samples/seccomp/Makefile @@ -1,44 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef CROSS_COMPILE -hostprogs := bpf-fancy dropper bpf-direct user-trap +userprogs := bpf-fancy dropper bpf-direct user-trap -HOSTCFLAGS_bpf-fancy.o += -I$(objtree)/usr/include -HOSTCFLAGS_bpf-fancy.o += -idirafter $(objtree)/include -HOSTCFLAGS_bpf-helper.o += -I$(objtree)/usr/include -HOSTCFLAGS_bpf-helper.o += -idirafter $(objtree)/include bpf-fancy-objs := bpf-fancy.o bpf-helper.o -HOSTCFLAGS_dropper.o += -I$(objtree)/usr/include -HOSTCFLAGS_dropper.o += -idirafter $(objtree)/include -dropper-objs := dropper.o +userccflags += -I usr/include -HOSTCFLAGS_bpf-direct.o += -I$(objtree)/usr/include -HOSTCFLAGS_bpf-direct.o += -idirafter $(objtree)/include -bpf-direct-objs := bpf-direct.o - -HOSTCFLAGS_user-trap.o += -I$(objtree)/usr/include -HOSTCFLAGS_user-trap.o += -idirafter $(objtree)/include -user-trap-objs := user-trap.o - -# Try to match the kernel target. -ifndef CONFIG_64BIT - -# s390 has -m31 flag to build 31 bit binaries -ifndef CONFIG_S390 -MFLAG = -m32 -else -MFLAG = -m31 -endif - -HOSTCFLAGS_bpf-direct.o += $(MFLAG) -HOSTCFLAGS_dropper.o += $(MFLAG) -HOSTCFLAGS_bpf-helper.o += $(MFLAG) -HOSTCFLAGS_bpf-fancy.o += $(MFLAG) -HOSTCFLAGS_user-trap.o += $(MFLAG) -HOSTLDLIBS_bpf-direct += $(MFLAG) -HOSTLDLIBS_bpf-fancy += $(MFLAG) -HOSTLDLIBS_dropper += $(MFLAG) -HOSTLDLIBS_user-trap += $(MFLAG) -endif -always-y := $(hostprogs) -endif +always-y := $(userprogs) -- 2.25.1