From patchwork Wed Dec 11 18:21:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 63779 X-Patchwork-Delegate: david.marchand@redhat.com 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 75041A04F5; Wed, 11 Dec 2019 19:22:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4B1021BE82; Wed, 11 Dec 2019 19:22:23 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 09FDE1BE3D for ; Wed, 11 Dec 2019 19:22:21 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2019 10:22:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,302,1571727600"; d="scan'208";a="203655545" Received: from silpixa00399838.ir.intel.com (HELO silpixa00399838.ger.corp.intel.com) ([10.237.222.157]) by orsmga007.jf.intel.com with ESMTP; 11 Dec 2019 10:22:19 -0800 From: Kevin Laatz To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, bruce.richardson@intel.com, ray.kinsella@intel.com, Kevin Laatz Date: Wed, 11 Dec 2019 18:21:46 +0000 Message-Id: <20191211182147.19355-3-kevin.laatz@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211182147.19355-1-kevin.laatz@intel.com> References: <20191129210905.1865-1-kevin.laatz@intel.com> <20191211182147.19355-1-kevin.laatz@intel.com> Subject: [dpdk-dev] [PATCH v4 2/3] build: add abi 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 a script to generate ABI dump files. These files will be required to perform ABI compatibility checks during the build later in the patchset. This script should be run on a DPDK version with a stable ABI. Since this is a tool designed for human use, we simplify it to just work off a whole build directory, taking the parameter of the builddir and generating the lib|drivers/abi dir. This is hardcoded into the script since the meson build expects the .dump files in these directories. The running of the scripts can be enabled/disabled using the new meson option added in this patch. If enabled, the lib and drivers .so files will be compared against any existing ABI dump files in lib|drivers/abi of the source directory. If there are any incompatibilities, the build will fail and display the incompatibility. Signed-off-by: Kevin Laatz Signed-off-by: Bruce Richardson --- v2: - fixed conditional around abi check custom target v3: - fix typo in meson option name v4: - squash commits 3,4,5,6 into a single commit - changes meson option from type boolean to feature - update travis packages - move check for windows to earlier in build - add abignore file to suppress experimental functions - make the directories we store dump files in hidden --- .travis.yml | 9 +++++++-- buildtools/dpdk.abignore | 2 ++ buildtools/meson.build | 3 +++ config/meson.build | 10 ++++++++++ devtools/gen-abi-dump.sh | 24 ++++++++++++++++++++++++ drivers/meson.build | 13 +++++++++++++ lib/meson.build | 13 +++++++++++++ meson.build | 4 ++++ meson_options.txt | 2 ++ 9 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 buildtools/dpdk.abignore create mode 100755 devtools/gen-abi-dump.sh diff --git a/.travis.yml b/.travis.yml index 8f90d06f2..c5654a530 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ aarch64_packages: &aarch64_packages extra_packages: &extra_packages - *required_packages - - [libbsd-dev, libpcap-dev, libcrypto++-dev, libjansson4] + - [libbsd-dev, libpcap-dev, libcrypto++-dev, libjansson4, abigail-tools] build_32b_packages: &build_32b_packages - *required_packages @@ -115,6 +115,11 @@ matrix: apt: packages: - *extra_packages - + - env: DEF_LIB="static" OPTS="-Dcompat_checks=enabled -Dbuildtype=debug" EXTRA_PACKAGES=1 + compiler: gcc + addons: + apt: + packages: + - *extra_packages script: ./.ci/${TRAVIS_OS_NAME}-build.sh diff --git a/buildtools/dpdk.abignore b/buildtools/dpdk.abignore new file mode 100644 index 000000000..b866b7f26 --- /dev/null +++ b/buildtools/dpdk.abignore @@ -0,0 +1,2 @@ +[suppress_function] + symbol_version = EXPERIMENTAL diff --git a/buildtools/meson.build b/buildtools/meson.build index 6ef2c5721..378f8d07e 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -7,6 +7,9 @@ pmdinfo = find_program('gen-pmdinfo-cfile.sh') check_experimental_syms = find_program('check-experimental-syms.sh') +abidiff = find_program('abidiff', required: compat_checks) +abignore = files('dpdk.abignore') + # set up map-to-def script using python, either built-in or external python3 = import('python').find_installation(required: false) if python3.found() diff --git a/config/meson.build b/config/meson.build index 01911ecf9..ea680af33 100644 --- a/config/meson.build +++ b/config/meson.build @@ -34,6 +34,16 @@ stable_so_version = abi_va.length() == 2 ? abi_va[0] : abi_va[0] + '.' + abi_va[ experimental_abi_version = '0.' + ''.join(abi_va) experimental_so_version = '0.' + ''.join(stable_so_version.split('.')) +# compatibility checks not available on windows +compat_checks = disabler() +if not is_windows + compat_checks = get_option('compat_checks') +endif + +if not get_option('debug') and compat_checks.enabled() + error('Build type must have debug symbols when compat_checks=enabled') +endif + # extract all version information into the build configuration dpdk_conf.set('RTE_VER_YEAR', pver.get(0).to_int()) dpdk_conf.set('RTE_VER_MONTH', pver.get(1).to_int()) diff --git a/devtools/gen-abi-dump.sh b/devtools/gen-abi-dump.sh new file mode 100755 index 000000000..bc6eac8c8 --- /dev/null +++ b/devtools/gen-abi-dump.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +builddir=$1 + +if [ -z "$builddir" ] ; then + echo "Usage: $(basename $0) build_dir" + exit 1 +fi + +if [ ! -d "$builddir" ] ; then + echo "Error: build directory, '$builddir', doesn't exist" + exit 1 +fi + +for d in lib drivers ; do + mkdir -p $d/.abi + + for f in $builddir/$d/*.so* ; do + test -L "$f" && continue + + libname=$(basename $f) + abidw --out-file $d/.abi/${libname%.so*}.dump $f || exit 1 + done +done diff --git a/drivers/meson.build b/drivers/meson.build index 4b17662b7..db58a67b9 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -196,6 +196,19 @@ foreach class:dpdk_driver_classes include_directories: includes, dependencies: static_deps) + if abidiff.found() + custom_target('lib' + lib_name + '.abi_chk', + command: [abidiff, '--no-added-syms', + '--suppr', abignore, + files('.abi/lib' + lib_name + '.dump'), + '@INPUT@'], + input: shared_lib, + output: 'lib' + lib_name + '.abi_chk', + capture: true, + install: false, + build_by_default: is_experimental == 0) + 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 0af3efab2..f0aba6635 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -180,6 +180,19 @@ foreach l:libraries include_directories: includes, dependencies: shared_deps) + if abidiff.found() + custom_target(dir_name + '.abi_chk', + command: [abidiff, '--no-added-syms', + '--suppr', abignore, + files('.abi/' + dir_name + '.dump'), + '@INPUT@'], + input: shared_lib, + output: dir_name + '.abi_chk', + capture: true, + install: false, + build_by_default: is_experimental == 0) + endif + dpdk_libraries = [shared_lib] + dpdk_libraries dpdk_static_libraries = [static_lib] + dpdk_static_libraries endif # sources.length() > 0 diff --git a/meson.build b/meson.build index b7ae9c8d9..e840ccea7 100644 --- a/meson.build +++ b/meson.build @@ -128,3 +128,7 @@ foreach drv:dpdk_drvs_disabled output_message += drv + ':\t' + reason + '\n\t' endforeach message(output_message + '\n') + +if compat_checks.auto() and not get_option('debug') + warning('Build type must be have debug symbols to run compatibility checks!\n') +endif diff --git a/meson_options.txt b/meson_options.txt index bc369d06c..0c651cef3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,7 @@ # Please keep these options sorted alphabetically. +option('compat_checks', type: 'feature', value: 'auto', + description: 'Enable abi compatibility checks and experimental syms checks to run during the build. This requires debug build to be enabled.') option('disable_drivers', type: 'string', value: '', description: 'Comma-separated list of drivers to explicitly disable.') option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-', From patchwork Wed Dec 11 18:21:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 63780 X-Patchwork-Delegate: david.marchand@redhat.com 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 92F83A04F5; Wed, 11 Dec 2019 19:22:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A184E1BF31; Wed, 11 Dec 2019 19:22:25 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 0DE681BE3D for ; Wed, 11 Dec 2019 19:22:22 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2019 10:22:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,302,1571727600"; d="scan'208";a="203655561" Received: from silpixa00399838.ir.intel.com (HELO silpixa00399838.ger.corp.intel.com) ([10.237.222.157]) by orsmga007.jf.intel.com with ESMTP; 11 Dec 2019 10:22:20 -0800 From: Kevin Laatz To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, bruce.richardson@intel.com, ray.kinsella@intel.com, Kevin Laatz Date: Wed, 11 Dec 2019 18:21:47 +0000 Message-Id: <20191211182147.19355-4-kevin.laatz@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211182147.19355-1-kevin.laatz@intel.com> References: <20191129210905.1865-1-kevin.laatz@intel.com> <20191211182147.19355-1-kevin.laatz@intel.com> Subject: [dpdk-dev] [PATCH v4 3/3] build: clean up experimental syms check 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 cleans up the meson build files in lib and drivers by moving the custom target for checking the experimental syms next to the abi compat checks. This also removes the dependency on the check for the shared build, which was not required by anything, but was only added to force the experimental syms check run. Signed-off-by: Kevin Laatz --- drivers/meson.build | 21 +++++++++++---------- lib/meson.build | 21 +++++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/meson.build b/drivers/meson.build index db58a67b9..4f4c93b73 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -163,15 +163,6 @@ foreach class:dpdk_driver_classes '-Wl,/implib:lib\\' + implib] else lk_args = ['-Wl,--version-script=' + version_map] - # on unix systems check the output of the - # experimental syms script, using it as a - # dependency of the .so build - lk_deps += custom_target(lib_name + '.exp_chk', - command: [check_experimental_syms, - version_map, '@INPUT@'], - capture: true, - input: static_lib, - output: lib_name + '.exp_chk') endif shared_lib = shared_library(lib_name, @@ -181,7 +172,6 @@ foreach class:dpdk_driver_classes dependencies: shared_deps, c_args: cflags, link_args: lk_args, - link_depends: lk_deps, version: lib_version, soversion: so_version, install: true, @@ -197,6 +187,17 @@ foreach class:dpdk_driver_classes dependencies: static_deps) if abidiff.found() + # on unix systems check the output of the + # experimental syms script + custom_target(lib_name + '.exp_chk', + command: [check_experimental_syms, + version_map, '@INPUT@'], + capture: true, + input: static_lib, + output: lib_name + '.exp_chk', + install: false, + build_by_default: true) + custom_target('lib' + lib_name + '.abi_chk', command: [abidiff, '--no-added-syms', '--suppr', abignore, diff --git a/lib/meson.build b/lib/meson.build index f0aba6635..b0f915969 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -154,15 +154,6 @@ foreach l:libraries '-Wl,/implib:lib\\' + implib] else lk_args = ['-Wl,--version-script=' + version_map] - # on unix systems check the output of the - # experimental syms script, using it as a - # dependency of the .so build - lk_deps += custom_target(name + '.exp_chk', - command: [check_experimental_syms, - version_map, '@INPUT@'], - capture: true, - input: static_lib, - output: name + '.exp_chk') endif shared_lib = shared_library(libname, @@ -172,7 +163,6 @@ foreach l:libraries dependencies: shared_deps, include_directories: includes, link_args: lk_args, - link_depends: lk_deps, version: lib_version, soversion: so_version, install: true) @@ -181,6 +171,17 @@ foreach l:libraries dependencies: shared_deps) if abidiff.found() + # on unix systems check the output of the + # experimental syms script + custom_target(name + '.exp_chk', + command: [check_experimental_syms, + version_map, '@INPUT@'], + capture: true, + input: static_lib, + output: name + '.exp_chk', + install: false, + build_by_default: true) + custom_target(dir_name + '.abi_chk', command: [abidiff, '--no-added-syms', '--suppr', abignore,