From fc74d67fab3c88cbd51efb0bca76004b70c7e8bc Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 13 Jan 2018 20:56:28 -0500 Subject: [PATCH] Correct handling of elf symbol versioning We were putting the value of LT_CURRENT in the versioned symbol map instead of the soname major version, which was creating binary incompatibility where none was present. Unfortunately, this bug is already out there for qpdf 7.0.0, so we'll have to work around it for now. --- README-maintainer.md | 2 +- configure.ac | 14 ++++++++++++++ libqpdf.map.in | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README-maintainer.md b/README-maintainer.md index 2f2e40ea..7b2bf99b 100644 --- a/README-maintainer.md +++ b/README-maintainer.md @@ -4,7 +4,6 @@ ``` ./configure CFLAGS="-g" CXXFLAGS="-g" --enable-werror --disable-shared ``` -* Test for binary compatibility. The easiest way to do this is to check out the last release, run the test suite, check out the new release, run `make build_libqpdf`, check out the old release, and run `make check NO_REBUILD=1`. * When making a release, always remember to run large file tests and image comparison tests (`--enable-test-compare-images` `--with-large-file-test-path=/path`). For Windows, use a Windows style path, not an MSYS path for large files. For a major release, consider running a spelling checker over the source code to catch errors in variable names, strings, and comments. Use `ispell -p ispell-words`. * Run tests with sanitize address enabled: ``` @@ -20,6 +19,7 @@ * Avoid atoi. Use QUtil::string_to_int instead. It does overflow/underflow checking. * Remember to avoid using `operator[]` with `std::string` or `std::vector`. Instead, use `at()`. See README-hardening.md for details. * Increment shared library version information as needed (`LT_*` in `configure.ac`) +* Test for binary compatibility. The easiest way to do this is to check out the last release, run the test suite, check out the new release, run `./autogen.mk; ./configure --enable-werror; make build_libqpdf`, check out the old release, and run `make check NO_REBUILD=1`. * Update release notes in manual. Look at diffs and ChangeLog. * Add a release entry to ChangeLog. * Make sure version numbers are consistent in the following locations: diff --git a/configure.ac b/configure.ac index cd395d91..c28fedc6 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,20 @@ LT_REVISION=0 AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) +LT_SONAME=$(expr $LT_CURRENT - $LT_AGE) +# BEGIN LT_SONAME WORKAROUND +# For elf versioned symbols, get the soname version. Unfortunately, +# there was a mistake at one point where we had 19 when we should have +# had 18, so make this a special case until the next ABI change. At +# that point, just remove the code deliminated by the LT_SONAME +# WORKAROUND comments. +if test $LT_SONAME = 18; then + LT_SONAME=19 +elif test $LT_SONAME -gt 18; then + AC_MSG_ERROR(Remove LT_SONAME workaround in configure.ac) +fi +# END LT_SONAME WORKAROUND +AC_SUBST(LT_SONAME) AC_ARG_ENABLE(insecure-random, AS_HELP_STRING([--enable-insecure-random], diff --git a/libqpdf.map.in b/libqpdf.map.in index 68ab12cb..9d4e8b9e 100644 --- a/libqpdf.map.in +++ b/libqpdf.map.in @@ -1,4 +1,4 @@ -LIBQPDF_@LT_CURRENT@ { +LIBQPDF_@LT_SONAME@ { global: *; };