Bug 809430 - Add symbol versions. r=glandium
authorIan Stakenvicius <axs@gentoo.org>
Thu, 25 Apr 2013 15:35:40 -0700
changeset 130004 7c536499e157ecfecdf82a0d4f1a922f4539883c
parent 130003 50878806f6f1579f1a01424f1c4c61e0f8a6b8fa
child 130005 da1921e38c6cc9be778b49101ed3f1e67ec39285
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersglandium
bugs809430
milestone23.0a1
Bug 809430 - Add symbol versions. r=glandium
js/src/Makefile.in
js/src/symverscript.in
toolkit/library/Makefile.in
toolkit/library/symverscript.in
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -525,16 +525,28 @@ ifneq (,$(CROSS_COMPILE)$(filter-out WIN
 # $(EXPORTS)
 export:: config/nsinstall$(HOST_BIN_SUFFIX)
 $(PUBLIC) $(SDK_PUBLIC): config/nsinstall$(HOST_BIN_SUFFIX)
 
 config/nsinstall$(HOST_BIN_SUFFIX): $(srcdir)/config/nsinstall.c $(srcdir)/config/pathsub.c
 	$(MAKE) -C config/ nsinstall$(HOST_BIN_SUFFIX)
 endif
 
+# Ensure symbol versions of shared library on Linux do not conflict
+# with those in libxul.
+ifeq (Linux,$(OS_TARGET))
+EXTRA_DSO_LDOPTS += -Wl,-version-script,symverscript
+
+symverscript: symverscript.in
+	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
+		-DVERSION="$(subst -,_,$(LIBRARY_NAME))" $< > $@
+
+EXTRA_DEPS += symverscript
+endif
+
 include $(topsrcdir)/config/rules.mk
 
 ifdef JS_HAS_CTYPES
 ifndef MOZ_NATIVE_FFI
 # Build libffi proper as part of the 'exports' target, so things get built
 # in the right order.
 export::
 		$(call SUBMAKE,,ctypes/libffi)
new file mode 100644
--- /dev/null
+++ b/js/src/symverscript.in
@@ -0,0 +1,4 @@
+#filter substitution
+@VERSION@ {
+    global: *;
+};
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -124,16 +124,23 @@ endif #}
 
 ifdef MOZ_IPDL_TESTS
 STATIC_LIBS += ipdlunittest_s
 endif
 
 ifeq (Linux,$(OS_ARCH))
 ifneq (Android,$(OS_TARGET))
 OS_LIBS += -lrt
+EXTRA_DSO_LDOPTS += -Wl,-version-script,symverscript
+
+symverscript: symverscript.in
+	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
+		-DVERSION="$(LIBRARY_NAME)$(MOZILLA_VERSION)" $< > $@
+
+EXTRA_DEPS += symverscript
 endif
 endif
 
 STATIC_LIBS += \
   xpcom_core \
   ucvutil_s \
   chromium_s \
   snappy_s \
new file mode 100644
--- /dev/null
+++ b/toolkit/library/symverscript.in
@@ -0,0 +1,4 @@
+#filter substitution
+@VERSION@ {
+    global: *;
+};