summaryrefslogtreecommitdiff
path: root/jurt
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-09-04 11:51:22 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-09-04 11:51:54 +0200
commitddc7bb629ade15b3341f2e3c347652c7b8925037 (patch)
treecd3df424eaf6905eec6ac3d182f8621b0209cf21 /jurt
parent0ba251fb2b176df7712b9e7c5ef67ff709c022e0 (diff)
Poor hack for libjpipe.so under Clang -fsanitize=*
Change-Id: I5c1036448cfc543f55cf1aa303abcfda6a64f64e
Diffstat (limited to 'jurt')
-rw-r--r--jurt/Library_jpipe.mk45
-rw-r--r--jurt/source/pipe/staticsalhack.h16
-rw-r--r--jurt/source/pipe/staticsalhack_c.c19
-rw-r--r--jurt/source/pipe/staticsalhack_cxx.cxx57
4 files changed, 136 insertions, 1 deletions
diff --git a/jurt/Library_jpipe.mk b/jurt/Library_jpipe.mk
index 44d502499eca..2ca6cb7b019b 100644
--- a/jurt/Library_jpipe.mk
+++ b/jurt/Library_jpipe.mk
@@ -21,7 +21,7 @@ $(eval $(call gb_Library_add_cobjects,jpipe,\
jurt/source/pipe/wrapper/wrapper \
))
-else
+else ifeq ($(COM_GCC_IS_CLANG)$(filter -fsanitize=%,%(gb_CC)),)
$(eval $(call gb_Library_use_libraries,jpipe,\
sal \
@@ -31,6 +31,49 @@ $(eval $(call gb_Library_add_cobjects,jpipe,\
jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection \
))
+else
+
+# HACK for Clang -fsanitize=address etc. to build libjpipe.so (dlopen'ed from
+# java executable) without dependence on __asan_* etc. symbols (expected to be
+# provided by the executable), incl. statically linking in the relevant parts of
+# sal:
+
+$(eval $(call gb_Library_add_cobjects,jpipe, \
+ jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection \
+ jurt/source/pipe/staticsalhack_c \
+))
+
+$(eval $(call gb_Library_add_exception_objects,jpipe, \
+ jurt/source/pipe/staticsalhack_cxx \
+))
+
+$(eval $(call gb_Library_add_defs,jpipe, \
+ -DRTL_OS="\"$(RTL_OS)"\" \
+ -DRTL_ARCH="\"$(RTL_ARCH)"\" \
+))
+
+$(eval $(call gb_Library_set_include,jpipe, \
+ $$(INCLUDE) \
+ -I$(SRCDIR) \
+ -I$(SRCDIR)/sal/inc \
+ -I$(SRCDIR)/sal/osl/unx \
+ -I$(SRCDIR)/sal/rtl \
+ -I$(SRCDIR)/sal/textenc \
+))
+
+$(eval $(call gb_Library_use_externals,jpipe, \
+ boost_headers \
+))
+
+$(eval $(call gb_Library_add_libs,jpipe, \
+ $(if $(filter-out $(OS),ANDROID),-lpthread) \
+))
+
+$(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,jpipe)): \
+ gb_CC := $(filter-out -fsanitize=%,$(gb_CC))
+$(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,jpipe)): \
+ gb_CXX := $(filter-out -fsanitize=%,$(gb_CXX))
+
endif
# vim:set noet sw=4 ts=4:
diff --git a/jurt/source/pipe/staticsalhack.h b/jurt/source/pipe/staticsalhack.h
new file mode 100644
index 000000000000..f1dc08332353
--- /dev/null
+++ b/jurt/source/pipe/staticsalhack.h
@@ -0,0 +1,16 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#define DISABLE_DYNLOADING
+#define FORCE_SYSALLOC
+#define NO_CHILD_PROCESSES
+#undef SAL_LOG_INFO
+#undef SAL_LOG_WARN
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/jurt/source/pipe/staticsalhack_c.c b/jurt/source/pipe/staticsalhack_c.c
new file mode 100644
index 000000000000..77c42919c1de
--- /dev/null
+++ b/jurt/source/pipe/staticsalhack_c.c
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <staticsalhack.h>
+
+#include <sal/osl/unx/memory.c>
+#include <sal/osl/unx/mutex.c>
+#include <sal/osl/unx/nlsupport.c>
+#include <sal/osl/unx/pipe.c>
+#include <sal/osl/unx/readwrite_helper.c>
+#include <sal/osl/unx/thread.c>
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/jurt/source/pipe/staticsalhack_cxx.cxx b/jurt/source/pipe/staticsalhack_cxx.cxx
new file mode 100644
index 000000000000..f3a5e5d9ec21
--- /dev/null
+++ b/jurt/source/pipe/staticsalhack_cxx.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <staticsalhack.h>
+
+#include <sal/rtl/string.cxx>
+#undef IMPL_RTL_EMPTYSTRING
+#undef IMPL_RTL_STRCODE
+#undef IMPL_RTL_STRINGDATA
+#undef IMPL_RTL_STRINGNAME
+#undef IMPL_RTL_STRNAME
+#undef IMPL_RTL_USTRCODE
+#undef RTL_LOG_STRING_BITS
+#include <sal/rtl/ustring.cxx>
+
+#include <sal/osl/unx/conditn.cxx>
+#include <sal/osl/unx/file.cxx>
+#include <sal/osl/unx/file_error_transl.cxx>
+#include <sal/osl/unx/file_misc.cxx>
+#include <sal/osl/unx/file_path_helper.cxx>
+#include <sal/osl/unx/file_stat.cxx>
+#include <sal/osl/unx/file_url.cxx>
+#include <sal/osl/unx/module.cxx>
+#include <sal/osl/unx/process.cxx>
+#include <sal/osl/unx/process_impl.cxx>
+#include <sal/osl/unx/profile.cxx>
+#include <sal/osl/unx/security.cxx>
+#include <sal/osl/unx/uunxapi.cxx>
+#include <sal/rtl/alloc_arena.cxx>
+#include <sal/rtl/alloc_cache.cxx>
+#include <sal/rtl/alloc_fini.cxx>
+#include <sal/rtl/alloc_global.cxx>
+#include <sal/rtl/bootstrap.cxx>
+#include <sal/rtl/byteseq.cxx>
+#include <sal/rtl/hash.cxx>
+#include <sal/rtl/locale.cxx>
+#include <sal/rtl/math.cxx>
+#include <sal/rtl/strbuf.cxx>
+#include <sal/rtl/strimp.cxx>
+#include <sal/rtl/uri.cxx>
+#include <sal/rtl/ustrbuf.cxx>
+#include <sal/textenc/converter.cxx>
+#include <sal/textenc/convertsimple.cxx>
+#include <sal/textenc/handleundefinedunicodetotextchar.cxx>
+#include <sal/textenc/tcvtutf8.cxx>
+#include <sal/textenc/tencinfo.cxx>
+#include <sal/textenc/textcvt.cxx>
+#include <sal/textenc/textenc.cxx>
+#include <sal/textenc/unichars.cxx>
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */