From patchwork Fri Dec 11 15:51:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 85016 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EDC77A09E0; Fri, 11 Dec 2020 16:51:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E44ADC950; Fri, 11 Dec 2020 16:51:35 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6D8D8BC86 for ; Fri, 11 Dec 2020 16:51:34 +0100 (CET) IronPort-SDR: +OrZBkxeTnKGvz1nwvBfc03SluAJBtF38hYhKdbOI5o+3J83DhuARk1hT/S5iLo2BtGuNpZsnN zWbcsJJa0hJQ== X-IronPort-AV: E=McAfee;i="6000,8403,9832"; a="170945271" X-IronPort-AV: E=Sophos;i="5.78,411,1599548400"; d="scan'208";a="170945271" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Dec 2020 07:51:32 -0800 IronPort-SDR: KmzgNfA83ym6lLFC/3iFO+9WHmjxQfVbeYtQ0yKvEuAU92ZLU2PF2qTShJ8t6MV3tDLTBnzqNc MOc71N1O9Syw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,411,1599548400"; d="scan'208";a="545869203" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by fmsmga005.fm.intel.com with ESMTP; 11 Dec 2020 07:51:30 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: bluca@debian.org, david.marchand@redhat.com, ian.stokes@intel.com, Ilya Maximets , Bruce Richardson , Jerin Jacob , Ruifeng Wang , Honnappa Nagarahalli , David Christensen Date: Fri, 11 Dec 2020 15:51:11 +0000 Message-Id: <20201211155111.145279-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [dpdk-dev] [RFC PATCH] build/pkg-config: remove machine arch flag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson for app build correctness the "-march=" flag was included in the pkg-config cflags output. However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures - x86, arm and ppc - can choose if and how to override this value themselves. For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-msse4" for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation. Signed-off-by: Bruce Richardson --- CC: Jerin Jacob CC: Ruifeng Wang CC: Honnappa Nagarahalli CC: David Christensen Feedback requested from ARM and PPC maintainers as to this change and what flags, if any, need to be in the .pc file for DPDK on such platforms. For example - is setting 'pkg_config_machine_args' to 'machine_args' by default necessary behaviour? --- buildtools/pkg-config/meson.build | 2 +- config/meson.build | 1 + config/x86/meson.build | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) -- 2.27.0 diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build index 5f1930428..8e2e24681 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -2,7 +2,7 @@ # Copyright(c) 2020 Intel Corporation pkg = import('pkgconfig') -pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args +pkg_extra_cflags = ['-include', 'rte_config.h'] + pkg_config_machine_args if is_freebsd pkg_extra_cflags += ['-D__BSD_VISIBLE'] endif diff --git a/config/meson.build b/config/meson.build index 3ddcc3539..d58ff781d 100644 --- a/config/meson.build +++ b/config/meson.build @@ -100,6 +100,7 @@ if host_machine.cpu_family().startswith('ppc') else machine_args += '-march=' + machine endif +pkg_config_machine_args = machine_args # may be overriden late per arch toolchain = cc.get_id() dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain) diff --git a/config/x86/meson.build b/config/x86/meson.build index 31bfa63b1..fcd75502e 100644 --- a/config/x86/meson.build +++ b/config/x86/meson.build @@ -16,6 +16,9 @@ if cc.get_define('__SSE4_2__', args: machine_args) == '' machine_args += '-msse4' endif +# require SSE4.2 in pkg-config file - don't use -march +pkg_config_machine_args = ['-msse4'] + base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2'] foreach f:base_flags compile_time_cpuflags += ['RTE_CPUFLAG_' + f]