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 C4309A00C2; Wed, 22 Apr 2020 18:43:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 956741D55B; Wed, 22 Apr 2020 18:43:43 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 4CCFA1D554 for ; Wed, 22 Apr 2020 18:43:41 +0200 (CEST) IronPort-SDR: yGVfNS1XeTH+49iAgLS2KZR9nYaiL0rpxZggzIeT0UKF29PJ2f9DkR9YdiZUEvwHMvsOmbiitf 22xWzpNT9sfw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2020 09:43:40 -0700 IronPort-SDR: tcn8t0Dbmj3ET6O0XbNXWWAvTkI4exukMmnQNIz5Tis2L5tu5Eq8XWb/DL5uXVStxuwQpRS9M8 F19w0FTkZtYA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,304,1583222400"; d="scan'208";a="402608643" Received: from npg-dpdk-haiyue-3.sh.intel.com ([10.67.119.46]) by orsmga004.jf.intel.com with ESMTP; 22 Apr 2020 09:43:38 -0700 From: Haiyue Wang To: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com, bruce.richardson@intel.com, ferruh.yigit@intel.com, nhorman@tuxdriver.com, mdr@ashroe.eu Cc: Haiyue Wang Date: Thu, 23 Apr 2020 00:37:56 +0800 Message-Id: <20200422163756.2738-2-haiyue.wang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200422163756.2738-1-haiyue.wang@intel.com> References: <20190613142344.9188-1-nhorman@tuxdriver.com> <20200422163756.2738-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 1/1] eal: add internal ABI mark support 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" Introduce __rte_internal tag to mark internal ABI function, this kind of function can't be called by external application. Signed-off-by: Haiyue Wang --- buildtools/check-internal-syms.sh | 57 +++++++++++++++++++++++++++++ devtools/check-symbol-change.sh | 7 ++++ devtools/libabigail.abignore | 5 +++ drivers/meson.build | 2 +- lib/librte_eal/include/rte_compat.h | 13 +++++++ lib/meson.build | 2 +- mk/internal/rte.compile-pre.mk | 3 ++ mk/target/generic/rte.vars.mk | 1 + 8 files changed, 88 insertions(+), 2 deletions(-) create mode 100755 buildtools/check-internal-syms.sh diff --git a/buildtools/check-internal-syms.sh b/buildtools/check-internal-syms.sh new file mode 100755 index 000000000..5043acf87 --- /dev/null +++ b/buildtools/check-internal-syms.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +# SPDX-License-Identifier: BSD-3-Clause + +MAPFILE=$1 +OBJFILE=$2 + +LIST_SYMBOL=$(dirname $(readlink -f $0))/map-list-symbol.sh + +# added check for "make -C test/" usage +if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ] +then + exit 0 +fi + +if [ -d $MAPFILE ] +then + exit 0 +fi + +DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump) +trap 'rm -f "$DUMPFILE"' EXIT +objdump -t $OBJFILE >$DUMPFILE + +ret=0 +for SYM in `$LIST_SYMBOL -S INTERNAL $MAPFILE |cut -d ' ' -f 3` +do + if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE && + ! grep -q "\.text\.internal.*[[:space:]]$SYM$" $DUMPFILE + then + cat >&2 <<- END_OF_MESSAGE + $SYM is not flagged as internal + but is listed in version map + Please add __rte_internal to the definition of $SYM + END_OF_MESSAGE + ret=1 + fi +done + +# Filter out symbols suffixed with a . for icc +for SYM in `awk '{ + if ($2 != "l" && $4 == ".text.internal" && !($NF ~ /\.$/)) { + print $NF + } +}' $DUMPFILE` +do + $LIST_SYMBOL -S INTERNAL -s $SYM -q $MAPFILE || { + cat >&2 <<- END_OF_MESSAGE + $SYM is flagged as internal + but is not listed in version map + Please add $SYM to the version map + END_OF_MESSAGE + ret=1 + } +done + +exit $ret diff --git a/devtools/check-symbol-change.sh b/devtools/check-symbol-change.sh index ed2178e36..978979077 100755 --- a/devtools/check-symbol-change.sh +++ b/devtools/check-symbol-change.sh @@ -91,6 +91,13 @@ check_for_rule_violations() if [ "$ar" = "add" ] then + if [ "$secname" = "INTERNAL" ] + then + # these are absolved from any further checking + echo "Skipping symbol $symname in INTERNAL" + continue + fi + if [ "$secname" = "unknown" ] then # Just inform the user of this occurrence, but diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore index cd86d89ca..3e8e2ea74 100644 --- a/devtools/libabigail.abignore +++ b/devtools/libabigail.abignore @@ -3,6 +3,11 @@ [suppress_variable] symbol_version = EXPERIMENTAL +[suppress_function] + symbol_version = INTERNAL +[suppress_variable] + symbol_version = INTERNAL + ; Explicit ignore for driver-only ABI [suppress_type] name = rte_cryptodev_ops diff --git a/drivers/meson.build b/drivers/meson.build index 4d8f842ab..cac07161f 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -20,7 +20,7 @@ dpdk_driver_classes = ['common', disabled_drivers = run_command(list_dir_globs, get_option('disable_drivers'), ).stdout().split() -default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API'] +default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API'] + ['-DALLOW_INTERNAL_API'] if cc.has_argument('-Wno-format-truncation') default_cflags += '-Wno-format-truncation' endif diff --git a/lib/librte_eal/include/rte_compat.h b/lib/librte_eal/include/rte_compat.h index 3eb33784b..4cd8f68d6 100644 --- a/lib/librte_eal/include/rte_compat.h +++ b/lib/librte_eal/include/rte_compat.h @@ -19,4 +19,17 @@ __attribute__((section(".text.experimental"))) #endif +#ifndef ALLOW_INTERNAL_API + +#define __rte_internal \ +__attribute__((error("Symbol is not public ABI"), \ +section(".text.internal"))) + +#else + +#define __rte_internal \ +__attribute__((section(".text.internal"))) + +#endif + #endif /* _RTE_COMPAT_H_ */ diff --git a/lib/meson.build b/lib/meson.build index 63c17ee75..981c2e397 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -36,7 +36,7 @@ if is_windows libraries = ['kvargs','eal'] # only supported libraries for windows endif -default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API'] +default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API'] + ['-DALLOW_INTERNAL_API'] if cc.has_argument('-Wno-format-truncation') default_cflags += '-Wno-format-truncation' endif diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk index 82fe098f7..0369786a5 100644 --- a/mk/internal/rte.compile-pre.mk +++ b/mk/internal/rte.compile-pre.mk @@ -58,6 +58,8 @@ C_TO_O_DISP = $(if $(V),"$(C_TO_O_STR)"," CC $(@)") endif EXPERIMENTAL_CHECK = $(RTE_SDK)/buildtools/check-experimental-syms.sh CHECK_EXPERIMENTAL = $(EXPERIMENTAL_CHECK) $(SRCDIR)/$(EXPORT_MAP) $@ +INTERNAL_CHECK = $(RTE_SDK)/buildtools/check-internal-syms.sh +CHECK_INTERNAL = $(INTERNAL_CHECK) $(SRCDIR)/$(EXPORT_MAP) $@ PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@.pmd.o $@.pmd.c @@ -76,6 +78,7 @@ C_TO_O_DO = @set -e; \ $(C_TO_O) && \ $(PMDINFO_TO_O) && \ $(CHECK_EXPERIMENTAL) && \ + $(CHECK_INTERNAL) && \ echo $(C_TO_O_CMD) > $(call obj2cmd,$(@)) && \ sed 's,'$@':,dep_'$@' =,' $(call obj2dep,$(@)).tmp > $(call obj2dep,$(@)) && \ rm -f $(call obj2dep,$(@)).tmp diff --git a/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk index ec2672897..11b0418e5 100644 --- a/mk/target/generic/rte.vars.mk +++ b/mk/target/generic/rte.vars.mk @@ -106,6 +106,7 @@ ifeq ($(BUILDING_RTE_SDK),1) # building sdk CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -DALLOW_INTERNAL_API else # if we are building an external application, include SDK's lib and # includes too -- 2.26.2