diff options
author | Viktor Kutuzov <vkutuzov@accesssoftek.com> | 2014-07-10 09:16:58 +0000 |
---|---|---|
committer | Viktor Kutuzov <vkutuzov@accesssoftek.com> | 2014-07-10 09:16:58 +0000 |
commit | 44895ce925cd291e676b8e2bdd5bc07fe8a74f33 (patch) | |
tree | ffa81786cec5b1843d91db4524ed9766a0db47a8 /lib/interception | |
parent | 2f00afa9fbd028eeb20302cc9a86ca40f3317dab (diff) |
Make sanitizers' interceptors non-weak on FreeBSD
Differential Revision: http://reviews.llvm.org/D4418
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212693 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/interception')
-rw-r--r-- | lib/interception/interception.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/interception/interception.h b/lib/interception/interception.h index ac982f71d..743c88dd7 100644 --- a/lib/interception/interception.h +++ b/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 |