Commit 92c94e7df230dd86eb46e8edf8e9d92531d5f6ef
1 parent
81fc5943
Add symbol versioning
For ELF systems, turn on versioned symbols by default, and add a configure option to enable or disable them.
Showing
6 changed files
with
57 additions
and
48 deletions
TODO
| @@ -4,6 +4,13 @@ Next | @@ -4,6 +4,13 @@ Next | ||
| 4 | * Get rid of off_t. size_t is okay. Use autoconf to figure out what | 4 | * Get rid of off_t. size_t is okay. Use autoconf to figure out what |
| 5 | type to use for offsets. | 5 | type to use for offsets. |
| 6 | 6 | ||
| 7 | + * Get rid of int/size_t/off_t inconsistencies. MSVC 2010 can find | ||
| 8 | + these if you add /w14267 to the compilation. We might want to do | ||
| 9 | + this by default. The easiest way to fix this on Windows is to | ||
| 10 | + modify msvc.mk to add this to both cl /c lines and run | ||
| 11 | + | ||
| 12 | + make 2>&1 | tee build.log | ||
| 13 | + | ||
| 7 | * Deal with portability issues from gcc 4.7. See portability.patch | 14 | * Deal with portability issues from gcc 4.7. See portability.patch |
| 8 | from debian package. | 15 | from debian package. |
| 9 | 16 | ||
| @@ -11,52 +18,6 @@ Next | @@ -11,52 +18,6 @@ Next | ||
| 11 | to build and test cleanly in 2.3.1. Hopefully the next release | 18 | to build and test cleanly in 2.3.1. Hopefully the next release |
| 12 | will include 64-bit binary distributions and external libraries. | 19 | will include 64-bit binary distributions and external libraries. |
| 13 | 20 | ||
| 14 | - * Add versioned symbols. Fix below to not use AM_CONDITIONAL. Just | ||
| 15 | - set some variable that can be part of LDFLAGS, like | ||
| 16 | - LD_VERSION_SCRIPT, instead. | ||
| 17 | - | ||
| 18 | -# Check if LD supports linker scripts, and define conditional | ||
| 19 | -# HAVE_LD_VERSION_SCRIPT if so. This functionality is currently | ||
| 20 | -# constrained to compilers using GNU ld on ELF systems or systems | ||
| 21 | -# which provide an adequate emulation thereof. | ||
| 22 | -AC_ARG_ENABLE([ld-version-script], | ||
| 23 | - AS_HELP_STRING([--enable-ld-version-script], | ||
| 24 | - [enable linker version script (default is disabled)]), | ||
| 25 | - [have_ld_version_script=$enableval], [have_ld_version_script=no]) | ||
| 26 | -if test "$have_ld_version_script" != no; then | ||
| 27 | - AC_MSG_CHECKING([if LD -Wl,--version-script works]) | ||
| 28 | - save_LDFLAGS="$LDFLAGS" | ||
| 29 | - LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" | ||
| 30 | - cat > conftest.map <<EOF | ||
| 31 | -VERS_1 { | ||
| 32 | - global: sym; | ||
| 33 | -}; | ||
| 34 | - | ||
| 35 | -VERS_2 { | ||
| 36 | - global: sym; | ||
| 37 | -} VERS_1; | ||
| 38 | -EOF | ||
| 39 | - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], | ||
| 40 | - [have_ld_version_script=yes], [have_ld_version_script=no]) | ||
| 41 | - rm -f conftest.map | ||
| 42 | - LDFLAGS="$save_LDFLAGS" | ||
| 43 | - AC_MSG_RESULT($have_ld_version_script) | ||
| 44 | -fi | ||
| 45 | -AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") | ||
| 46 | - | ||
| 47 | ----- | ||
| 48 | - | ||
| 49 | -if HAVE_LD_VERSION_SCRIPT | ||
| 50 | -libtiff_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libtiff.map | ||
| 51 | -endif | ||
| 52 | - | ||
| 53 | ----- | ||
| 54 | - | ||
| 55 | -LIBQPDF_3 { | ||
| 56 | - global: | ||
| 57 | - *; | ||
| 58 | -}; | ||
| 59 | - | ||
| 60 | * Provide an option to copy encryption parameters from another file. | 21 | * Provide an option to copy encryption parameters from another file. |
| 61 | This would make it possible to decrypt a file, manually work with | 22 | This would make it possible to decrypt a file, manually work with |
| 62 | it, and then re-encrypt it using the original encryption parameters | 23 | it, and then re-encrypt it using the original encryption parameters |
autoconf.mk.in
| @@ -31,3 +31,4 @@ BUILD_PDF=@BUILD_PDF@ | @@ -31,3 +31,4 @@ BUILD_PDF=@BUILD_PDF@ | ||
| 31 | VALIDATE_DOC=@VALIDATE_DOC@ | 31 | VALIDATE_DOC=@VALIDATE_DOC@ |
| 32 | SKIP_TEST_COMPARE_IMAGES=@SKIP_TEST_COMPARE_IMAGES@ | 32 | SKIP_TEST_COMPARE_IMAGES=@SKIP_TEST_COMPARE_IMAGES@ |
| 33 | BUILDRULES=@BUILDRULES@ | 33 | BUILDRULES=@BUILDRULES@ |
| 34 | +HAVE_LD_VERSION_SCRIPT=@HAVE_LD_VERSION_SCRIPT@ |
configure.ac
| @@ -41,6 +41,40 @@ AC_TYPE_UINT16_T | @@ -41,6 +41,40 @@ AC_TYPE_UINT16_T | ||
| 41 | AC_TYPE_UINT32_T | 41 | AC_TYPE_UINT32_T |
| 42 | AC_CHECK_FUNCS(random) | 42 | AC_CHECK_FUNCS(random) |
| 43 | 43 | ||
| 44 | +# Check if LD supports linker scripts, and define conditional | ||
| 45 | +# HAVE_LD_VERSION_SCRIPT if so. This functionality is currently | ||
| 46 | +# constrained to compilers using GNU ld on ELF systems or systems | ||
| 47 | +# which provide an adequate emulation thereof. | ||
| 48 | +AC_ARG_ENABLE([ld-version-script], | ||
| 49 | + AS_HELP_STRING([--enable-ld-version-script], | ||
| 50 | + [enable linker version script (default is disabled)]), | ||
| 51 | + [have_ld_version_script=$enableval], [have_ld_version_script=yes]) | ||
| 52 | +if test "$have_ld_version_script" != no; then | ||
| 53 | + AC_MSG_CHECKING([if LD -Wl,--version-script works]) | ||
| 54 | + save_LDFLAGS="$LDFLAGS" | ||
| 55 | + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" | ||
| 56 | + cat > conftest.map <<EOF | ||
| 57 | +VERS_1 { | ||
| 58 | + global: sym; | ||
| 59 | +}; | ||
| 60 | + | ||
| 61 | +VERS_2 { | ||
| 62 | + global: sym; | ||
| 63 | +} VERS_1; | ||
| 64 | +EOF | ||
| 65 | + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], | ||
| 66 | + [have_ld_version_script=yes], [have_ld_version_script=no]) | ||
| 67 | + rm -f conftest.map | ||
| 68 | + LDFLAGS="$save_LDFLAGS" | ||
| 69 | + AC_MSG_RESULT($have_ld_version_script) | ||
| 70 | +fi | ||
| 71 | +if test "$have_ld_version_script" = "yes"; then | ||
| 72 | + HAVE_LD_VERSION_SCRIPT=1 | ||
| 73 | +else | ||
| 74 | + HAVE_LD_VERSION_SCRIPT=0 | ||
| 75 | +fi | ||
| 76 | +AC_SUBST(HAVE_LD_VERSION_SCRIPT) | ||
| 77 | + | ||
| 44 | AC_MSG_CHECKING(for gnu make >= 3.81) | 78 | AC_MSG_CHECKING(for gnu make >= 3.81) |
| 45 | make_okay=0 | 79 | make_okay=0 |
| 46 | if make --version >/dev/null 2>&1; then | 80 | if make --version >/dev/null 2>&1; then |
libqpdf.map
0 → 100644
libqpdf/build.mk
| @@ -64,6 +64,8 @@ $(OBJS_libqpdf): libqpdf/$(OUTPUT_DIR)/%.$(LOBJ): libqpdf/%.cc | @@ -64,6 +64,8 @@ $(OBJS_libqpdf): libqpdf/$(OUTPUT_DIR)/%.$(LOBJ): libqpdf/%.cc | ||
| 64 | # | 64 | # |
| 65 | # * If any interfaces have been removed or changed, we are not binary | 65 | # * If any interfaces have been removed or changed, we are not binary |
| 66 | # compatible. Increment CURRENT, and set AGE and REVISION to 0. | 66 | # compatible. Increment CURRENT, and set AGE and REVISION to 0. |
| 67 | +# Also update libqpdf.map, changing the numeric portion to match | ||
| 68 | +# CURRENT. | ||
| 67 | # | 69 | # |
| 68 | # * Otherwise, if any interfaces have been added since the last | 70 | # * Otherwise, if any interfaces have been added since the last |
| 69 | # public release, then increment CURRENT and AGE, and set REVISION | 71 | # public release, then increment CURRENT and AGE, and set REVISION |
| @@ -72,4 +74,4 @@ $(OBJS_libqpdf): libqpdf/$(OUTPUT_DIR)/%.$(LOBJ): libqpdf/%.cc | @@ -72,4 +74,4 @@ $(OBJS_libqpdf): libqpdf/$(OUTPUT_DIR)/%.$(LOBJ): libqpdf/%.cc | ||
| 72 | # * Otherwise, increment REVISION | 74 | # * Otherwise, increment REVISION |
| 73 | 75 | ||
| 74 | $(TARGETS_libqpdf): $(OBJS_libqpdf) | 76 | $(TARGETS_libqpdf): $(OBJS_libqpdf) |
| 75 | - $(call makelib,$(OBJS_libqpdf),$@,$(LDFLAGS),$(LIBS),7,1,4) | 77 | + $(call makelib,$(OBJS_libqpdf),$@,$(LDFLAGS),$(LIBS),8,0,0) |
make/libtool.mk
| @@ -18,6 +18,12 @@ endef | @@ -18,6 +18,12 @@ endef | ||
| 18 | 18 | ||
| 19 | # --- Private definitions --- | 19 | # --- Private definitions --- |
| 20 | 20 | ||
| 21 | +ifeq ($(HAVE_LD_VERSION_SCRIPT), 1) | ||
| 22 | +LD_VERSION_FLAGS=-Wl,--version-script=libqpdf.map | ||
| 23 | +else | ||
| 24 | +LD_VERSION_FLAGS= | ||
| 25 | +endif | ||
| 26 | + | ||
| 21 | # Usage: $(call libdepflags,$(basename obj)) | 27 | # Usage: $(call libdepflags,$(basename obj)) |
| 22 | # Usage: $(call fixdeps,$(basename obj)) | 28 | # Usage: $(call fixdeps,$(basename obj)) |
| 23 | ifeq ($(GENDEPS),1) | 29 | ifeq ($(GENDEPS),1) |
| @@ -83,7 +89,8 @@ endef | @@ -83,7 +89,8 @@ endef | ||
| 83 | # Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age) | 89 | # Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age) |
| 84 | define makelib | 90 | define makelib |
| 85 | $(LIBTOOL) --mode=link \ | 91 | $(LIBTOOL) --mode=link \ |
| 86 | - $(CXX) $(CXXFLAGS) -o $(2) $(1) $(3) $(4) \ | 92 | + $(CXX) $(CXXFLAGS) $(LD_VERSION_FLAGS) \ |
| 93 | + -o $(2) $(1) $(3) $(4) \ | ||
| 87 | -rpath $(libdir) -version-info $(5):$(6):$(7) | 94 | -rpath $(libdir) -version-info $(5):$(6):$(7) |
| 88 | endef | 95 | endef |
| 89 | 96 |