Add exports file and abi checker for talloc talloc-1.3.1
authorSimo Sorce <ssorce@redhat.com>
Sun, 7 Jun 2009 18:20:36 +0000 (14:20 -0400)
committerSimo Sorce <idra@samba.org>
Mon, 15 Jun 2009 20:31:12 +0000 (16:31 -0400)
This is a first attempt at exporting symbols only for public functions
We also provide a rudimentary ABI checker that tries to check that
function signatures are not changed by mistake.
Given our use of macros this is not an API checker.
It's all based on talloc.h contents and the gcc -aux-info option

lib/talloc/Makefile.in
lib/talloc/abi_checks.sh [new file with mode: 0755]
lib/talloc/configure.ac
lib/talloc/libtalloc.m4
lib/talloc/rules.mk
lib/talloc/talloc.exports [new file with mode: 0644]
lib/talloc/talloc.mk
lib/talloc/talloc.signatures [new file with mode: 0644]

index c28693e2db93ca7209b8622c137422f167d5d01d..a45f72bedeb9ad8f269198d1fb6dd99b36fa0439 100644 (file)
@@ -24,13 +24,17 @@ tallocdir = @tallocdir@
 
 LIBOBJ = $(TALLOC_OBJ) @LIBREPLACEOBJ@
 
+SONAMEFLAG = @SONAMEFLAG@
+VERSIONSCRIPT = @VERSIONSCRIPT@
+EXPORTSFILE = @EXPORTSFILE@
+
 all:: showflags $(EXTRA_TARGETS)
 
 include $(tallocdir)/rules.mk
 include $(tallocdir)/talloc.mk
 
 $(TALLOC_SOLIB): $(LIBOBJ)
-       $(SHLD) $(SHLD_FLAGS) -o $@ $(LIBOBJ) @SONAMEFLAG@$(TALLOC_SONAME)
+       $(SHLD) $(SHLD_FLAGS) -o $@ $(LIBOBJ) $(VERSIONSCRIPT) $(EXPORTSFILE) $(SONAMEFLAG)$(TALLOC_SONAME)
 
 shared-build: all
        ${INSTALLCMD} -d $(sharedbuilddir)/lib
diff --git a/lib/talloc/abi_checks.sh b/lib/talloc/abi_checks.sh
new file mode 100755 (executable)
index 0000000..432cc87
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+make clean
+
+mkdir abi
+ABI_CHECKS="-aux-info abi/\$@.X"
+make ABI_CHECK="$ABI_CHECKS"
+
+for i in abi/*.X; do cat $i | grep 'talloc\.h'; done | sort | uniq | awk -F "extern " '{ print $2 }' > abi/signatures
+
+cat > abi/exports << EOF
+{
+    global:
+EOF
+cat abi/signatures | awk -F '(' '{ print $1 }' | awk -F ' ' '{ print "           "$NF";" }' | tr -d '*' | sort >> abi/exports
+cat >> abi/exports << EOF
+
+    local: *;
+};
+EOF
+
+rm -fr abi/*.X
+
+diff -u talloc.signatures abi/signatures
+if [ "$?" != "0" ]; then
+    echo "WARNING: Possible ABI Change!!"
+fi
+
+diff -u talloc.exports abi/exports
+if [ "$?" != "0" ]; then
+    echo "WARNING: Export file may be outdated!!"
+fi
index 00e8242d4ef073d326a46c211ce9210a06cafb6a..a644f6d80091580ecebcbc753ed762fcbbeb237c 100644 (file)
@@ -1,11 +1,18 @@
 AC_PREREQ(2.50)
-AC_INIT(talloc, 1.3.0)
+AC_INIT(talloc, 1.3.1)
 AC_CONFIG_SRCDIR([talloc.c])
 AC_SUBST(datarootdir)
 AC_CONFIG_HEADER(config.h)
 
 AC_LIBREPLACE_ALL_CHECKS
 
+AC_LD_PICFLAG
+AC_LD_SHLIBEXT
+AC_LD_SONAMEFLAG
+AC_LD_VERSIONSCRIPT
+AC_LIBREPLACE_SHLD
+AC_LIBREPLACE_SHLD_FLAGS
+
 m4_include(libtalloc.m4)
 
 AC_PATH_PROG(XSLTPROC,xsltproc)
@@ -15,12 +22,6 @@ if test -n "$XSLTPROC"; then
 fi
 AC_SUBST(DOC_TARGET)
 
-AC_LD_PICFLAG
-AC_LD_SHLIBEXT
-AC_LD_SONAMEFLAG
-AC_LIBREPLACE_SHLD
-AC_LIBREPLACE_SHLD_FLAGS
-
 m4_include(build_macros.m4)
 BUILD_WITH_SHARED_BUILD_DIR
 
index e6830fbef680c8db31aef664af8a476d30731895..4b22c8e41a9f1c50d9b09614c9d53de389fea8c2 100644 (file)
@@ -31,3 +31,8 @@ if test $ac_cv_sizeof_size_t -lt $ac_cv_sizeof_void_p; then
        AC_WARN([sizeof(void *) = $ac_cv_sizeof_void_p])
        AC_ERROR([sizeof(size_t) < sizeof(void *)])
 fi
+
+if test x"$VERSIONSCRIPT" != "x"; then
+    EXPORTSFILE=talloc.exports
+    AC_SUBST(EXPORTSFILE)
+fi
index 1c83e7b63fda79c90cba3fedd8e5a3254b26f233..00c909ee2bad9d2d52313824ff0af4c05c5c4cf2 100644 (file)
@@ -6,7 +6,7 @@ showflags::
        @echo '  LIBS = $(LIBS)'
 
 .c.o:
-       $(CC) $(PICFLAG) -o $@ -c $< $(CFLAGS)
+       $(CC) $(PICFLAG) $(ABI_CHECK) -o $@ -c $< $(CFLAGS)
 
 .3.xml.3:
        -test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
diff --git a/lib/talloc/talloc.exports b/lib/talloc/talloc.exports
new file mode 100644 (file)
index 0000000..b787845
--- /dev/null
@@ -0,0 +1,61 @@
+{
+    global:
+           _talloc;
+           _talloc_array;
+           talloc_asprintf;
+           talloc_asprintf_append;
+           talloc_asprintf_append_buffer;
+           talloc_autofree_context;
+           talloc_check_name;
+           talloc_disable_null_tracking;
+           talloc_enable_leak_report;
+           talloc_enable_leak_report_full;
+           talloc_enable_null_tracking;
+           talloc_find_parent_byname;
+           talloc_free;
+           talloc_free_children;
+           talloc_get_name;
+           talloc_get_size;
+           _talloc_get_type_abort;
+           talloc_increase_ref_count;
+           talloc_init;
+           talloc_is_parent;
+           _talloc_memdup;
+           _talloc_move;
+           talloc_named;
+           talloc_named_const;
+           talloc_parent;
+           talloc_parent_name;
+           talloc_pool;
+           _talloc_realloc;
+           _talloc_realloc_array;
+           talloc_realloc_fn;
+           _talloc_reference;
+           talloc_reference_count;
+           talloc_report;
+           talloc_report_depth_cb;
+           talloc_report_depth_file;
+           talloc_report_full;
+           talloc_set_abort_fn;
+           _talloc_set_destructor;
+           talloc_set_name;
+           talloc_set_name_const;
+           talloc_show_parents;
+           _talloc_steal;
+           talloc_strdup;
+           talloc_strdup_append;
+           talloc_strdup_append_buffer;
+           talloc_strndup;
+           talloc_strndup_append;
+           talloc_strndup_append_buffer;
+           talloc_total_blocks;
+           talloc_total_size;
+           talloc_unlink;
+           talloc_vasprintf;
+           talloc_vasprintf_append;
+           talloc_vasprintf_append_buffer;
+           _talloc_zero;
+           _talloc_zero_array;
+
+    local: *;
+};
index ce7784c8a224bed224a73070ccc053a9789ace15..fb57e44c4b6accb39839b31a26ccc211e63ac71a 100644 (file)
@@ -30,6 +30,7 @@ doc:: talloc.3 talloc.3.html
 
 clean::
        rm -f *~ $(LIBOBJ) $(TALLOC_SOLIB) $(TALLOC_STLIB) testsuite testsuite.o testsuite_main.o *.gc?? talloc.3 talloc.3.html
+       rm -fr abi
 
 test:: testsuite
        ./testsuite
diff --git a/lib/talloc/talloc.signatures b/lib/talloc/talloc.signatures
new file mode 100644 (file)
index 0000000..e2fc8ae
--- /dev/null
@@ -0,0 +1,56 @@
+void *_talloc (const void *, size_t);
+void *talloc_pool (const void *, size_t);
+void _talloc_set_destructor (const void *, int (*) (void *));
+int talloc_increase_ref_count (const void *);
+size_t talloc_reference_count (const void *);
+void *_talloc_reference (const void *, const void *);
+int talloc_unlink (const void *, void *);
+const char *talloc_set_name (const void *, const char *, ...);
+void talloc_set_name_const (const void *, const char *);
+void *talloc_named (const void *, size_t, const char *, ...);
+void *talloc_named_const (const void *, size_t, const char *);
+const char *talloc_get_name (const void *);
+void *talloc_check_name (const void *, const char *);
+void *_talloc_get_type_abort (const void *, const char *, const char *);
+void *talloc_parent (const void *);
+const char *talloc_parent_name (const void *);
+void *talloc_init (const char *, ...);
+int talloc_free (void *);
+void talloc_free_children (void *);
+void *_talloc_realloc (const void *, void *, size_t, const char *);
+void *_talloc_steal (const void *, const void *);
+void *_talloc_move (const void *, const void *);
+size_t talloc_total_size (const void *);
+size_t talloc_total_blocks (const void *);
+void talloc_report_depth_cb (const void *, int, int, void (*) (const void *, int, int, int, void *), void *);
+void talloc_report_depth_file (const void *, int, int, FILE *);
+void talloc_report_full (const void *, FILE *);
+void talloc_report (const void *, FILE *);
+void talloc_enable_null_tracking (void);
+void talloc_disable_null_tracking (void);
+void talloc_enable_leak_report (void);
+void talloc_enable_leak_report_full (void);
+void *_talloc_zero (const void *, size_t, const char *);
+void *_talloc_memdup (const void *, const void *, size_t, const char *);
+void *_talloc_array (const void *, size_t, unsigned int, const char *);
+void *_talloc_zero_array (const void *, size_t, unsigned int, const char *);
+void *_talloc_realloc_array (const void *, void *, size_t, unsigned int, const char *);
+void *talloc_realloc_fn (const void *, void *, size_t);
+void *talloc_autofree_context (void);
+size_t talloc_get_size (const void *);
+void *talloc_find_parent_byname (const void *, const char *);
+void talloc_show_parents (const void *, FILE *);
+int talloc_is_parent (const void *, const void *);
+char *talloc_strdup (const void *, const char *);
+char *talloc_strdup_append (char *, const char *);
+char *talloc_strdup_append_buffer (char *, const char *);
+char *talloc_strndup (const void *, const char *, size_t);
+char *talloc_strndup_append (char *, const char *, size_t);
+char *talloc_strndup_append_buffer (char *, const char *, size_t);
+char *talloc_vasprintf (const void *, const char *, __va_list_tag *);
+char *talloc_vasprintf_append (char *, const char *, __va_list_tag *);
+char *talloc_vasprintf_append_buffer (char *, const char *, __va_list_tag *);
+char *talloc_asprintf (const void *, const char *, ...);
+char *talloc_asprintf_append (char *, const char *, ...);
+char *talloc_asprintf_append_buffer (char *, const char *, ...);
+void talloc_set_abort_fn (void (*) (const char *));