mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Add symbol versioning
For ELF systems, turn on versioned symbols by default, and add a configure option to enable or disable them.
This commit is contained in:
parent
81fc594342
commit
92c94e7df2
53
TODO
53
TODO
@ -4,6 +4,13 @@ Next
|
||||
* Get rid of off_t. size_t is okay. Use autoconf to figure out what
|
||||
type to use for offsets.
|
||||
|
||||
* Get rid of int/size_t/off_t inconsistencies. MSVC 2010 can find
|
||||
these if you add /w14267 to the compilation. We might want to do
|
||||
this by default. The easiest way to fix this on Windows is to
|
||||
modify msvc.mk to add this to both cl /c lines and run
|
||||
|
||||
make 2>&1 | tee build.log
|
||||
|
||||
* Deal with portability issues from gcc 4.7. See portability.patch
|
||||
from debian package.
|
||||
|
||||
@ -11,52 +18,6 @@ Next
|
||||
to build and test cleanly in 2.3.1. Hopefully the next release
|
||||
will include 64-bit binary distributions and external libraries.
|
||||
|
||||
* Add versioned symbols. Fix below to not use AM_CONDITIONAL. Just
|
||||
set some variable that can be part of LDFLAGS, like
|
||||
LD_VERSION_SCRIPT, instead.
|
||||
|
||||
# Check if LD supports linker scripts, and define conditional
|
||||
# HAVE_LD_VERSION_SCRIPT if so. This functionality is currently
|
||||
# constrained to compilers using GNU ld on ELF systems or systems
|
||||
# which provide an adequate emulation thereof.
|
||||
AC_ARG_ENABLE([ld-version-script],
|
||||
AS_HELP_STRING([--enable-ld-version-script],
|
||||
[enable linker version script (default is disabled)]),
|
||||
[have_ld_version_script=$enableval], [have_ld_version_script=no])
|
||||
if test "$have_ld_version_script" != no; then
|
||||
AC_MSG_CHECKING([if LD -Wl,--version-script works])
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
|
||||
cat > conftest.map <<EOF
|
||||
VERS_1 {
|
||||
global: sym;
|
||||
};
|
||||
|
||||
VERS_2 {
|
||||
global: sym;
|
||||
} VERS_1;
|
||||
EOF
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
|
||||
[have_ld_version_script=yes], [have_ld_version_script=no])
|
||||
rm -f conftest.map
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
AC_MSG_RESULT($have_ld_version_script)
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
||||
|
||||
----
|
||||
|
||||
if HAVE_LD_VERSION_SCRIPT
|
||||
libtiff_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libtiff.map
|
||||
endif
|
||||
|
||||
----
|
||||
|
||||
LIBQPDF_3 {
|
||||
global:
|
||||
*;
|
||||
};
|
||||
|
||||
* Provide an option to copy encryption parameters from another file.
|
||||
This would make it possible to decrypt a file, manually work with
|
||||
it, and then re-encrypt it using the original encryption parameters
|
||||
|
@ -31,3 +31,4 @@ BUILD_PDF=@BUILD_PDF@
|
||||
VALIDATE_DOC=@VALIDATE_DOC@
|
||||
SKIP_TEST_COMPARE_IMAGES=@SKIP_TEST_COMPARE_IMAGES@
|
||||
BUILDRULES=@BUILDRULES@
|
||||
HAVE_LD_VERSION_SCRIPT=@HAVE_LD_VERSION_SCRIPT@
|
||||
|
34
configure.ac
34
configure.ac
@ -41,6 +41,40 @@ AC_TYPE_UINT16_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_CHECK_FUNCS(random)
|
||||
|
||||
# Check if LD supports linker scripts, and define conditional
|
||||
# HAVE_LD_VERSION_SCRIPT if so. This functionality is currently
|
||||
# constrained to compilers using GNU ld on ELF systems or systems
|
||||
# which provide an adequate emulation thereof.
|
||||
AC_ARG_ENABLE([ld-version-script],
|
||||
AS_HELP_STRING([--enable-ld-version-script],
|
||||
[enable linker version script (default is disabled)]),
|
||||
[have_ld_version_script=$enableval], [have_ld_version_script=yes])
|
||||
if test "$have_ld_version_script" != no; then
|
||||
AC_MSG_CHECKING([if LD -Wl,--version-script works])
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
|
||||
cat > conftest.map <<EOF
|
||||
VERS_1 {
|
||||
global: sym;
|
||||
};
|
||||
|
||||
VERS_2 {
|
||||
global: sym;
|
||||
} VERS_1;
|
||||
EOF
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
|
||||
[have_ld_version_script=yes], [have_ld_version_script=no])
|
||||
rm -f conftest.map
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
AC_MSG_RESULT($have_ld_version_script)
|
||||
fi
|
||||
if test "$have_ld_version_script" = "yes"; then
|
||||
HAVE_LD_VERSION_SCRIPT=1
|
||||
else
|
||||
HAVE_LD_VERSION_SCRIPT=0
|
||||
fi
|
||||
AC_SUBST(HAVE_LD_VERSION_SCRIPT)
|
||||
|
||||
AC_MSG_CHECKING(for gnu make >= 3.81)
|
||||
make_okay=0
|
||||
if make --version >/dev/null 2>&1; then
|
||||
|
4
libqpdf.map
Normal file
4
libqpdf.map
Normal file
@ -0,0 +1,4 @@
|
||||
LIBQPDF_8 {
|
||||
global:
|
||||
*;
|
||||
};
|
@ -64,6 +64,8 @@ $(OBJS_libqpdf): libqpdf/$(OUTPUT_DIR)/%.$(LOBJ): libqpdf/%.cc
|
||||
#
|
||||
# * If any interfaces have been removed or changed, we are not binary
|
||||
# compatible. Increment CURRENT, and set AGE and REVISION to 0.
|
||||
# Also update libqpdf.map, changing the numeric portion to match
|
||||
# CURRENT.
|
||||
#
|
||||
# * Otherwise, if any interfaces have been added since the last
|
||||
# public release, then increment CURRENT and AGE, and set REVISION
|
||||
@ -72,4 +74,4 @@ $(OBJS_libqpdf): libqpdf/$(OUTPUT_DIR)/%.$(LOBJ): libqpdf/%.cc
|
||||
# * Otherwise, increment REVISION
|
||||
|
||||
$(TARGETS_libqpdf): $(OBJS_libqpdf)
|
||||
$(call makelib,$(OBJS_libqpdf),$@,$(LDFLAGS),$(LIBS),7,1,4)
|
||||
$(call makelib,$(OBJS_libqpdf),$@,$(LDFLAGS),$(LIBS),8,0,0)
|
||||
|
@ -18,6 +18,12 @@ endef
|
||||
|
||||
# --- Private definitions ---
|
||||
|
||||
ifeq ($(HAVE_LD_VERSION_SCRIPT), 1)
|
||||
LD_VERSION_FLAGS=-Wl,--version-script=libqpdf.map
|
||||
else
|
||||
LD_VERSION_FLAGS=
|
||||
endif
|
||||
|
||||
# Usage: $(call libdepflags,$(basename obj))
|
||||
# Usage: $(call fixdeps,$(basename obj))
|
||||
ifeq ($(GENDEPS),1)
|
||||
@ -83,7 +89,8 @@ endef
|
||||
# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age)
|
||||
define makelib
|
||||
$(LIBTOOL) --mode=link \
|
||||
$(CXX) $(CXXFLAGS) -o $(2) $(1) $(3) $(4) \
|
||||
$(CXX) $(CXXFLAGS) $(LD_VERSION_FLAGS) \
|
||||
-o $(2) $(1) $(3) $(4) \
|
||||
-rpath $(libdir) -version-info $(5):$(6):$(7)
|
||||
endef
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user