From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DCE7AA04C0; Fri, 11 Sep 2020 18:04:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DC8AB1C119; Fri, 11 Sep 2020 18:03:58 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 25A721C0DC for ; Fri, 11 Sep 2020 18:03:53 +0200 (CEST) IronPort-SDR: uNmMspW7fnIfN0QQmK+E8crlSm12EMbgK5ukkCDbwm29zcduY8bUVhuDCs2VMNtV0EyNvx3SZf wRB6RFKVjTGg== X-IronPort-AV: E=McAfee;i="6000,8403,9741"; a="220343481" X-IronPort-AV: E=Sophos;i="5.76,416,1592895600"; d="scan'208";a="220343481" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 09:03:53 -0700 IronPort-SDR: V3IduwRAD3QBl2j5nrU2CtsjuzPe4Ik6xp4pCFbuRCd2KXS3b/DdZiLi3+HmJUSAcURMzirenF xllDnUJWJcJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,416,1592895600"; d="scan'208";a="318321590" Received: from silpixa00400466.ir.intel.com ([10.237.213.195]) by orsmga002.jf.intel.com with ESMTP; 11 Sep 2020 09:03:51 -0700 From: Conor Walsh To: dev@dpdk.org Cc: david.marchand@redhat.com, ray.kinsella@intel.com, nhorman@tuxdriver.com, aconole@redhat.com, maicolgabriel@hotmail.com, thomas@monjalon.net, bruce.richardson@intel.com, Conor Walsh Date: Fri, 11 Sep 2020 16:03:32 +0000 Message-Id: <20200911160332.256343-5-conor.walsh@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200911160332.256343-1-conor.walsh@intel.com> References: <20200910142121.3995680-1-conor.walsh@intel.com> <20200911160332.256343-1-conor.walsh@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 4/4] build: add abi breakage checks to meson 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" This patch adds the ability to run ABI breakage checks to meson. To do this the developer needs to set the meson build type to debug and set the version of DPDK that they want to check the ABI against. The option "abi_checks" has been added to meson for this, the option accepts DPDK tags e.g. "latest" or "v20.11". Example meson command: "meson -Dbuildtype=debug -Dabi_checks=v20.11 build" When the build is done using ninja the ABI checks will be performed if any breakages are present the build will fail. Signed-off-by: Conor Walsh --- buildtools/meson.build | 18 ++++++++++++++++++ config/meson.build | 15 +++++++++++++++ drivers/meson.build | 14 ++++++++++++++ lib/meson.build | 14 ++++++++++++++ meson_options.txt | 2 ++ 5 files changed, 63 insertions(+) diff --git a/buildtools/meson.build b/buildtools/meson.build index 04808dabc..c3ee69a44 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -17,3 +17,21 @@ else endif map_to_win_cmd = py3 + files('map_to_win.py') sphinx_wrapper = py3 + files('call-sphinx-build.py') + +abi_check_version = get_option('abi_checks') +check_abi = (abi_check_version != '') + +abi_dir = '' +# If abi checks enabled setup abi dump directory +if check_abi + message('ABI checks are being setup. This could take several minutes') + setup_run = run_command('abi-setup.py', '-t', abi_check_version, '-d', meson.source_root()) + # Check if error returned from script + if setup_run.returncode() != 0 + setup_err = setup_run.stderr().strip() + error('ABI checks setup script returned an error: ' + setup_err) + endif + abi_dir = setup_run.stdout().strip() +endif +abidiff = find_program('abidiff', required: check_abi) +abignore = files('../devtools/libabigail.abignore') diff --git a/config/meson.build b/config/meson.build index 6996e5cbe..79b90f2cc 100644 --- a/config/meson.build +++ b/config/meson.build @@ -47,6 +47,21 @@ else dpdk_conf.set('RTE_VER_RELEASE', 99) endif +# abi checks cannot be run on windows +if is_windows and check_abi + error('ABI checks cannot be run on windows') +endif +# abi checks can only be run on a debug build +# meson <0.48 does not support get_option('debug') +if meson.version().version_compare('>=0.48') + debug_enabled = get_option('debug') +else + debug_enabled = get_option('buildtype').startswith('debug') +endif +if check_abi and not debug_enabled + error('Build type must have debug symbols when abi_checks are enabled') +endif + pmd_subdir_opt = get_option('drivers_install_subdir') if pmd_subdir_opt.contains('') pmd_subdir_opt = abi_version.join(pmd_subdir_opt.split('')) diff --git a/drivers/meson.build b/drivers/meson.build index 5f9526557..b24a875da 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -208,6 +208,20 @@ foreach subpath:subdirs include_directories: includes, dependencies: static_deps) + # If abidiff found, abi checks are enabled and the abi dump files for the library are available run abi check + dump_name = abi_dir+'/lib' + lib_name + '.dump' + if check_abi and run_command('[', '-f', dump_name, ']').returncode() == 0 + custom_target('lib' + lib_name + '.abi_chk', + command: [abidiff, '--no-added-syms', + '--suppr', abignore, + '@INPUT@'], + input: [dump_name, shared_lib], + output: 'lib' + lib_name + '.abi_chk', + capture: true, + install: false, + build_by_default: true) + endif + dpdk_drivers += static_lib set_variable('shared_@0@'.format(lib_name), shared_dep) diff --git a/lib/meson.build b/lib/meson.build index 3852c0156..0d9325b90 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -190,6 +190,20 @@ foreach l:libraries include_directories: includes, dependencies: shared_deps) + # If abidiff found, abi checks are enabled and the abi dump files for the library are available run abi check + dump_name = abi_dir+'/' + dir_name + '.dump' + if check_abi and run_command('[', '-f', dump_name, ']').returncode() == 0 + custom_target(dir_name + '.abi_chk', + command: [abidiff, '--no-added-syms', + '--suppr', abignore, + '@INPUT@'], + input: [dump_name, shared_lib], + output: dir_name + '.abi_chk', + capture: true, + install: false, + build_by_default: true) + endif + dpdk_libraries = [shared_lib] + dpdk_libraries dpdk_static_libraries = [static_lib] + dpdk_static_libraries endif # sources.length() > 0 diff --git a/meson_options.txt b/meson_options.txt index 9bf18ab6b..26ac48f45 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,7 @@ # Please keep these options sorted alphabetically. +option('abi_checks', type: 'string', value: '', + description: 'Enable abi compatibility checks to run during the build. This requires debug build to be enabled. Input is latest or git tag e.g. v20.11') option('armv8_crypto_dir', type: 'string', value: '', description: 'path to the armv8_crypto library installation directory') option('disable_drivers', type: 'string', value: '', -- 2.25.1