summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViktor Kutuzov <vkutuzov@accesssoftek.com>2014-07-10 09:16:58 +0000
committerViktor Kutuzov <vkutuzov@accesssoftek.com>2014-07-10 09:16:58 +0000
commitf294f25d3ab54c6a3267cd5c1c82d25d6fdbee58 (patch)
treeb71018a4949a0a03ed7647b9dd5bbc633c6415d8
parenta34a8e230d05250871047c4ab4de50a92587a35c (diff)
downloadbcm5719-llvm-f294f25d3ab54c6a3267cd5c1c82d25d6fdbee58.tar.gz
bcm5719-llvm-f294f25d3ab54c6a3267cd5c1c82d25d6fdbee58.zip
Make sanitizers' interceptors non-weak on FreeBSD
Differential Revision: http://reviews.llvm.org/D4418 llvm-svn: 212693
-rw-r--r--compiler-rt/lib/interception/interception.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler-rt/lib/interception/interception.h b/compiler-rt/lib/interception/interception.h
index ac982f71dc4..743c88dd745 100644
--- a/compiler-rt/lib/interception/interception.h
+++ b/compiler-rt/lib/interception/interception.h
@@ -135,6 +135,16 @@ const interpose_substitution substitution_##func_name[] \
extern "C" ret_type func(__VA_ARGS__);
# define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \
extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__);
+#elif defined(__FreeBSD__)
+# define WRAP(x) __interceptor_ ## x
+# define WRAPPER_NAME(x) "__interceptor_" #x
+# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default")))
+// FreeBSD's dynamic linker (incompliantly) gives non-weak symbols higher
+// priority than weak ones so weak aliases won't work for indirect calls
+// in position-independent (-fPIC / -fPIE) mode.
+# define DECLARE_WRAPPER(ret_type, func, ...) \
+ extern "C" ret_type func(__VA_ARGS__) \
+ __attribute__((alias("__interceptor_" #func), visibility("default")));
#else
# define WRAP(x) __interceptor_ ## x
# define WRAPPER_NAME(x) "__interceptor_" #x
OpenPOWER on IntegriCloud