Add checks during build to ensure that all symbols in the INTERNAL
version map section have __internal tags on their definitions, and
enable the warnings needed to announce their use.

Signed-off-by: Haiyue Wang <haiyue.w...@intel.com>
---
 MAINTAINERS                                   |  2 +-
 ...-experimental-syms.sh => check-symbols.sh} | 31 +++++++++++++++++++
 buildtools/meson.build                        |  2 +-
 mk/internal/rte.compile-pre.mk                |  6 ++--
 4 files changed, 36 insertions(+), 5 deletions(-)
 rename buildtools/{check-experimental-syms.sh => check-symbols.sh} (61%)

diff --git a/MAINTAINERS b/MAINTAINERS
index a8d24e332..85298d426 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -153,7 +153,7 @@ F: devtools/libabigail.abignore
 F: devtools/update-abi.sh
 F: devtools/update_version_map_abi.py
 F: devtools/validate-abi.sh
-F: buildtools/check-experimental-syms.sh
+F: buildtools/check-symbols.sh
 F: buildtools/map-list-symbol.sh
 
 Driver information
diff --git a/buildtools/check-experimental-syms.sh b/buildtools/check-symbols.sh
similarity index 61%
rename from buildtools/check-experimental-syms.sh
rename to buildtools/check-symbols.sh
index f3603e5ba..3df57c322 100755
--- a/buildtools/check-experimental-syms.sh
+++ b/buildtools/check-symbols.sh
@@ -54,4 +54,35 @@ do
        }
 done
 
+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/buildtools/meson.build b/buildtools/meson.build
index 9812917e5..3e8d31b0c 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -6,7 +6,7 @@ subdir('pmdinfogen')
 pkgconf = find_program('pkg-config', 'pkgconf', required: false)
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
 list_dir_globs = find_program('list-dir-globs.py')
-check_experimental_syms = find_program('check-experimental-syms.sh')
+check_experimental_syms = find_program('check-symbols.sh')
 ldflags_ibverbs_static = find_program('options-ibverbs-static.sh')
 
 # set up map-to-def script using python, either built-in or external
diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk
index 82fe098f7..df05b5576 100644
--- a/mk/internal/rte.compile-pre.mk
+++ b/mk/internal/rte.compile-pre.mk
@@ -56,8 +56,8 @@ C_TO_O = $(CC) -Wp,-MD,$(call obj2dep,$(@)).tmp $(CPPFLAGS) 
$(CFLAGS) \
 C_TO_O_STR = $(subst ','\'',$(C_TO_O)) #'# fix syntax highlight
 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) $@
+CHECK_SYMBOLS_SCRIPT = $(RTE_SDK)/buildtools/check-symbols.sh
+CHECK_SYMBOLS = $(CHECK_SYMBOLS_SCRIPT) $(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
@@ -75,7 +75,7 @@ C_TO_O_DO = @set -e; \
        echo $(C_TO_O_DISP); \
        $(C_TO_O) && \
        $(PMDINFO_TO_O) && \
-       $(CHECK_EXPERIMENTAL) && \
+       $(CHECK_SYMBOLS) && \
        echo $(C_TO_O_CMD) > $(call obj2cmd,$(@)) && \
        sed 's,'$@':,dep_'$@' =,' $(call obj2dep,$(@)).tmp > $(call 
obj2dep,$(@)) && \
        rm -f $(call obj2dep,$(@)).tmp
-- 
2.26.2

Reply via email to