diff --git a/doc/zstd_manual.html b/doc/zstd_manual.html index 472abad701c..05530fe40df 100644 --- a/doc/zstd_manual.html +++ b/doc/zstd_manual.html @@ -2286,7 +2286,7 @@
typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e;
int ZSTD_isDeterministicBuild(void); +ZSTDLIB_STATIC_API int ZSTD_isDeterministicBuild(void);Returns 1 if the library is built using standard compilation flags, and participates in determinism guarantees with other builds of the same version. diff --git a/lib/zstd.h b/lib/zstd.h index e1b10cb3178..8bc41f56620 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -3239,7 +3239,7 @@ ZSTDLIB_STATIC_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx); * This is mainly used for Zstd's determinism test suite, which is only * run when this function returns 1. */ -ZSTDLIB_API int ZSTD_isDeterministicBuild(void); +ZSTDLIB_STATIC_API int ZSTD_isDeterministicBuild(void); /* ========================================= */ diff --git a/tests/libzstd_builds.sh b/tests/libzstd_builds.sh index 3b019c8b85f..8cf837caa35 100755 --- a/tests/libzstd_builds.sh +++ b/tests/libzstd_builds.sh @@ -113,3 +113,26 @@ isPresent "zdict.o" isPresent "zstd_v07.o" mustBeAbsent "zbuff_compress.o" $RM $DIR/../lib/libzstd.a tmplog + +# exported symbols : the whole API by default, +# only the stable API when the experimental API is hidden. +# The API comes from the headers : -aux-info (GCC) lists their function declarations. +$ECHO "testing exported symbols" +printf '#include "zstd.h"\n#include "zdict.h"\n#include "zstd_errors.h"\n' > tmpapi.c +listDeclared() { + ${CC:-cc} -I$DIR/../lib "$@" -fsyntax-only -aux-info tmpaux tmpapi.c + sed -n 's/^\/\*[^*]*\*\/ //; s/ (.*//; s/.*[ *]//p' tmpaux | $GREP -E '^(ZSTD|ZDICT)_' | LC_ALL=C sort -u +} +listExported() { + nm -D --defined-only $DIR/../lib/libzstd.so.*.*.* | awk '{ print $NF }' | LC_ALL=C sort -u +} +listDeclared > tmpstable +listDeclared -DZSTD_STATIC_LINKING_ONLY -DZDICT_STATIC_LINKING_ONLY > tmpall +CFLAGS= make -C $DIR/../lib libzstd > $INTOVOID +listExported > tmpexported +diff tmpall tmpexported || die "libzstd.so should export the whole API" +$RM $DIR/../lib/libzstd.so* +CFLAGS= make -C $DIR/../lib libzstd MOREFLAGS="-DZSTDLIB_STATIC_API=ZSTDLIB_HIDDEN -DZDICTLIB_STATIC_API=ZDICTLIB_HIDDEN" > $INTOVOID +listExported > tmpexported +diff tmpstable tmpexported || die "with the experimental API hidden, libzstd.so should export only the stable API" +$RM $DIR/../lib/libzstd.so* tmpapi.c tmpaux tmpstable tmpall tmpexported