From a297dd7fae6c689ade89919e5adb97a1ed8f21bc Mon Sep 17 00:00:00 2001 From: Bjarne von Horn Date: Fri, 2 Feb 2024 11:52:09 +0100 Subject: [PATCH] add symbol version check target --- .gitlab-ci.yml | 1 + lib/Makefile.am | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0257dd08..47f1478f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,7 @@ build: - ./bootstrap - ./configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --enable-tty --with-devices=2 --enable-ccat - make -j8 all modules + - make -C lib symbol-version-check - make DISTCHECK_CONFIGURE_FLAGS="--with-linux-dir=/usr/src/linux-obj/$(uname -i)/default" distcheck - make dist - mkdir test_dist && cd test_dist && tar xzf ../ethercat-*.tar.gz && cd ethercat-*/ diff --git a/lib/Makefile.am b/lib/Makefile.am index d0eaf6b0..6780a453 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -114,3 +114,17 @@ endif ethercat-config.cmake: $(srcdir)/ethercat-config.cmake.in Makefile $(SED) -e 's,%libdir%,$(libdir),' -e 's,%includedir%,$(includedir),' $< > $@ + + +#----------------------------------------------------------------------------- + +.PHONY: symbol-version-check + +# check whether all symbols marked with EC_PUBLIC_API are listed in +# libethercat.map + +symbol-version-check: libethercat.la + readelf --dyn-syms --wide $(builddir)/.libs/libethercat.so | \ + awk '$$4 == "FUNC" && $$7 != "UND" && $$8 !~ /@LIBETHERCAT/ { print "Unversioned symbol: " $$8; err = 1; } END { exit err; }' + +#-----------------------------------------------------------------------------