summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2012-06-20 18:48:27 +0200
committerJay Berkenbilt <ejb@ql.org>2012-06-20 21:18:12 +0200
commit92c94e7df230dd86eb46e8edf8e9d92531d5f6ef (patch)
treec64e1c979f910884bddd47d42cf9a7913cb56cc4
parent81fc594342925137b55b3decb4992b283a52967f (diff)
downloadqpdf-92c94e7df230dd86eb46e8edf8e9d92531d5f6ef.tar.zst
Add symbol versioning
For ELF systems, turn on versioned symbols by default, and add a configure option to enable or disable them.
-rw-r--r--TODO53
-rw-r--r--autoconf.mk.in1
-rw-r--r--configure.ac34
-rw-r--r--libqpdf.map4
-rw-r--r--libqpdf/build.mk4
-rw-r--r--make/libtool.mk9
6 files changed, 57 insertions, 48 deletions
diff --git a/TODO b/TODO
index 9ca8b858..0083c89f 100644
--- a/TODO
+++ b/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
diff --git a/autoconf.mk.in b/autoconf.mk.in
index 693a06f1..9112bad0 100644
--- a/autoconf.mk.in
+++ b/autoconf.mk.in
@@ -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@
diff --git a/configure.ac b/configure.ac
index 9cccec81..05082956 100644
--- a/configure.ac
+++ b/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
diff --git a/libqpdf.map b/libqpdf.map
new file mode 100644
index 00000000..857f56cb
--- /dev/null
+++ b/libqpdf.map
@@ -0,0 +1,4 @@
+LIBQPDF_8 {
+ global:
+ *;
+};
diff --git a/libqpdf/build.mk b/libqpdf/build.mk
index ec770c23..c5549202 100644
--- a/libqpdf/build.mk
+++ b/libqpdf/build.mk
@@ -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)
diff --git a/make/libtool.mk b/make/libtool.mk
index 8cd94325..e23ed246 100644
--- a/make/libtool.mk
+++ b/make/libtool.mk
@@ -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