summaryrefslogtreecommitdiff
path: root/external/librevenge
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-02-27 10:05:22 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-02-27 10:05:22 +0100
commitf0aa1a78fb209310e8baef53c02f365fca518d11 (patch)
tree043698b26212189e0a0baa3626e6a56c5225fa58 /external/librevenge
parentfc6f894d2211cee7b28cb93345e90297ec04fe06 (diff)
For Clang -fsanitize=vptr use -fvisibility-ms-compat, not -fvisibility=hidden
As discussed in b4f6b26b5a1a78fecfa95ec2eb7ac8b80495d8aa "SAL_DLLPUBLIC_RTTI for proper RTTI visibility for LLVM," RTTI-based -fsanitize= checks with Clang on Linux need special precautions to make RTTI symbols visible across DSOs. The approach taken there, as well as in 598d8194b0ea1a64e0ebba28a86c128bafa57c7c "Visible function type RTTI for Clang -fsanitize=function," was to add explicit SAL_DLLPUBLIC_RTTI annontations to relevant type definitions. However, for -fsanitize=vptr that would have required many more of those, so it appears easier to "misuse" -fsanitize-ms-compat in that case, which happens to give all RTTI symbols default visibility (while otherwise still honoring our SAL_DLLPUBLIC/PRIVATE annotations). The SAL_DLLPUBLIC_RTTI annotations from 598d8194b0ea1a64e0ebba28a86c128bafa57c7c "Visible function type RTTI for Clang -fsanitize=function" can likely be removed again. Change-Id: Ibeff7ab8c908111a7dc66ff0677204f112b24db8
Diffstat (limited to 'external/librevenge')
-rw-r--r--external/librevenge/UnpackedTarball_librevenge.mk10
-rw-r--r--external/librevenge/ubsan-visibility.patch11
2 files changed, 20 insertions, 1 deletions
diff --git a/external/librevenge/UnpackedTarball_librevenge.mk b/external/librevenge/UnpackedTarball_librevenge.mk
index 470f58f9d001..dabad6a8f14a 100644
--- a/external/librevenge/UnpackedTarball_librevenge.mk
+++ b/external/librevenge/UnpackedTarball_librevenge.mk
@@ -11,6 +11,14 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,librevenge))
$(eval $(call gb_UnpackedTarball_set_tarball,librevenge,$(REVENGE_TARBALL)))
-$(eval $(call gb_UnpackedTarball_set_patchlevel,librevenge,1))
+$(eval $(call gb_UnpackedTarball_set_patchlevel,librevenge,0))
+
+ifeq ($(COM_GCC_IS_CLANG),TRUE)
+ifneq ($(filter -fsanitize=%,$(CC)),)
+$(eval $(call gb_UnpackedTarball_add_patches,librevenge, \
+ external/librevenge/ubsan-visibility.patch \
+))
+endif
+endif
# vim: set noet sw=4 ts=4:
diff --git a/external/librevenge/ubsan-visibility.patch b/external/librevenge/ubsan-visibility.patch
new file mode 100644
index 000000000000..ede44d4fee7d
--- /dev/null
+++ b/external/librevenge/ubsan-visibility.patch
@@ -0,0 +1,11 @@
+--- src/lib/Makefile.in
++++ src/lib/Makefile.in
+@@ -79,7 +79,7 @@
+ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+-@HAVE_VISIBILITY_TRUE@am__append_1 = -fvisibility=hidden
++@HAVE_VISIBILITY_TRUE@am__append_1 = -fvisibility-ms-compat
+ @HAVE_VISIBILITY_TRUE@am__append_2 = -DLIBREVENGE_VISIBILITY
+ @BUILD_GENERATORS_TRUE@am__append_3 = librevenge-generators-@RVNG_MAJOR_VERSION@.@RVNG_MINOR_VERSION@.la
+ @BUILD_GENERATORS_TRUE@@HAVE_VISIBILITY_TRUE@am__append_4 = -DLIBREVENGE_GENERATORS_VISIBILITY