Library ABI tracking with abigail
Provide two make targets: checkabi and storeabi. storeabi uses libabigail to generate a reference copy of the ABI for the public libraries. checkabi compares such a reference to the compiled version, failing if they are not compatible. No ABI is generated for libzpool.so, it is only used by ztest and zdb and not external consumers. Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Antonio Russo <aerusso@aerusso.net> Closes #11144
This commit is contained in:
parent
e6c59cd171
commit
14c34c3d49
@ -136,6 +136,13 @@ shellcheck:
|
||||
echo "skipping shellcheck because shellcheck is not installed"; \
|
||||
fi
|
||||
|
||||
PHONY += checkabi storeabi
|
||||
checkabi: lib
|
||||
$(MAKE) -C lib checkabi
|
||||
|
||||
storeabi: lib
|
||||
$(MAKE) -C lib storeabi
|
||||
|
||||
PHONY += checkbashisms
|
||||
checkbashisms:
|
||||
@if type checkbashisms > /dev/null 2>&1; then \
|
||||
|
29
config/Abigail.am
Normal file
29
config/Abigail.am
Normal file
@ -0,0 +1,29 @@
|
||||
#
|
||||
# When performing an ABI check the following options are applied:
|
||||
#
|
||||
# --no-unreferenced-symbols: Exclude symbols which are not referenced by
|
||||
# any debug information. Without this _init() and _fini() are incorrectly
|
||||
# reported on CentOS7 for libuutil.so.
|
||||
#
|
||||
# --headers-dir1: Limit ABI checks to public OpenZFS headers, otherwise
|
||||
# changes in public system headers are also reported.
|
||||
#
|
||||
# --suppressions: Honor a suppressions file for each library to provide
|
||||
# a mechanism for suppressing harmless warnings.
|
||||
#
|
||||
|
||||
PHONY += checkabi storeabi
|
||||
|
||||
checkabi:
|
||||
for lib in $(lib_LTLIBRARIES) ; do \
|
||||
abidiff --no-unreferenced-symbols \
|
||||
--headers-dir1 ../../include \
|
||||
--suppressions $${lib%.la}.suppr \
|
||||
$${lib%.la}.abi .libs/$${lib%.la}.so ; \
|
||||
done
|
||||
|
||||
storeabi:
|
||||
cd .libs ; \
|
||||
for lib in $(lib_LTLIBRARIES) ; do \
|
||||
abidw $${lib%.la}.so > ../$${lib%.la}.abi ; \
|
||||
done
|
@ -15,4 +15,21 @@ SUBDIRS += libzutil libunicode
|
||||
|
||||
# These five libraries, which are installed as the final build product,
|
||||
# incorporate the eight convenience libraries given above.
|
||||
SUBDIRS += libuutil libzfs_core libzfs libzpool libzfsbootenv
|
||||
DISTLIBS = libuutil libzfs_core libzfs libzpool libzfsbootenv
|
||||
SUBDIRS += $(DISTLIBS)
|
||||
DISTLIBS += libnvpair
|
||||
|
||||
# An ABI is stored for each of these libraries. Note that libzpool.so
|
||||
# is only linked against by ztest and zdb and no stable ABI is provided.
|
||||
ABILIBS = libnvpair libuutil libzfs_core libzfs libzfsbootenv
|
||||
|
||||
PHONY = checkabi storeabi
|
||||
checkabi: $(ABILIBS)
|
||||
set -e ; for dir in $(ABILIBS) ; do \
|
||||
$(MAKE) -C $$dir checkabi ; \
|
||||
done
|
||||
|
||||
storeabi: $(ABILIBS)
|
||||
set -e ; for dir in $(ABILIBS) ; do \
|
||||
$(MAKE) -C $$dir storeabi ; \
|
||||
done
|
||||
|
@ -1,4 +1,5 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
VPATH = \
|
||||
$(top_srcdir)/module/nvpair \
|
||||
@ -10,6 +11,8 @@ AM_CFLAGS += $(FRAME_LARGER_THAN) $(LIBTIRPC_CFLAGS)
|
||||
|
||||
lib_LTLIBRARIES = libnvpair.la
|
||||
|
||||
include $(top_srcdir)/config/Abigail.am
|
||||
|
||||
USER_C = \
|
||||
libnvpair.c \
|
||||
libnvpair_json.c \
|
||||
|
2
lib/libnvpair/libnvpair.suppr
Normal file
2
lib/libnvpair/libnvpair.suppr
Normal file
@ -0,0 +1,2 @@
|
||||
[suppress_type]
|
||||
name = FILE*
|
@ -1,7 +1,10 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
lib_LTLIBRARIES = libuutil.la
|
||||
|
||||
include $(top_srcdir)/config/Abigail.am
|
||||
|
||||
USER_C = \
|
||||
uu_alloc.c \
|
||||
uu_avl.c \
|
||||
|
2
lib/libuutil/libuutil.suppr
Normal file
2
lib/libuutil/libuutil.suppr
Normal file
@ -0,0 +1,2 @@
|
||||
[suppress_type]
|
||||
name = FILE*
|
@ -1,4 +1,5 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
VPATH = \
|
||||
$(top_srcdir)/module/icp \
|
||||
@ -13,6 +14,8 @@ pkgconfig_DATA = libzfs.pc
|
||||
|
||||
lib_LTLIBRARIES = libzfs.la
|
||||
|
||||
include $(top_srcdir)/config/Abigail.am
|
||||
|
||||
USER_C = \
|
||||
libzfs_changelist.c \
|
||||
libzfs_config.c \
|
||||
|
13
lib/libzfs/libzfs.suppr
Normal file
13
lib/libzfs/libzfs.suppr
Normal file
@ -0,0 +1,13 @@
|
||||
[suppress_type]
|
||||
name = FILE*
|
||||
|
||||
[suppress_type]
|
||||
type_kind = typedef
|
||||
name = SHA256_CTX
|
||||
|
||||
[suppress_type]
|
||||
type_kind = typedef
|
||||
name = SHA2_CTX
|
||||
|
||||
[suppress_variable]
|
||||
name = zfs_deleg_perm_tab
|
@ -1,9 +1,12 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
pkgconfig_DATA = libzfs_core.pc
|
||||
|
||||
lib_LTLIBRARIES = libzfs_core.la
|
||||
|
||||
include $(top_srcdir)/config/Abigail.am
|
||||
|
||||
USER_C = \
|
||||
libzfs_core.c
|
||||
|
||||
|
5
lib/libzfs_core/libzfs_core.suppr
Normal file
5
lib/libzfs_core/libzfs_core.suppr
Normal file
@ -0,0 +1,5 @@
|
||||
[suppress_type]
|
||||
name = FILE*
|
||||
|
||||
[suppress_type]
|
||||
name = pthread_cond_t
|
@ -1,9 +1,12 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
pkgconfig_DATA = libzfsbootenv.pc
|
||||
|
||||
lib_LTLIBRARIES = libzfsbootenv.la
|
||||
|
||||
include $(top_srcdir)/config/Abigail.am
|
||||
|
||||
if BUILD_FREEBSD
|
||||
DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/freebsd/zfs
|
||||
endif
|
||||
|
2
lib/libzfsbootenv/libzfsbootenv.suppr
Normal file
2
lib/libzfsbootenv/libzfsbootenv.suppr
Normal file
@ -0,0 +1,2 @@
|
||||
[suppress_type]
|
||||
name = FILE*
|
Loading…
Reference in New Issue
Block a user