[compiler-rt] r212693 - Make sanitizers' interceptors non-weak on FreeBSD
Viktor Kutuzov
vkutuzov at accesssoftek.com
Thu Jul 10 02:16:58 PDT 2014
Author: vkutuzov
Date: Thu Jul 10 04:16:58 2014
New Revision: 212693
URL: http://llvm.org/viewvc/llvm-project?rev=212693&view=rev
Log:
Make sanitizers' interceptors non-weak on FreeBSD
Differential Revision: http://reviews.llvm.org/D4418
Modified:
compiler-rt/trunk/lib/interception/interception.h
Modified: compiler-rt/trunk/lib/interception/interception.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/interception.h?rev=212693&r1=212692&r2=212693&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/interception.h (original)
+++ compiler-rt/trunk/lib/interception/interception.h Thu Jul 10 04:16:58 2014
@@ -135,6 +135,16 @@ const interpose_substitution substitutio
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
More information about the llvm-commits
mailing list