[PATCH] Interception macros for sanitizers on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Thu Feb 20 10:30:54 PST 2014



================
Comment at: lib/interception/interception.h:145
@@ +144,3 @@
+    extern "C" ret_type func(__VA_ARGS__) \
+    __attribute__((alias("__interceptor_" #func), visibility("default")));
+# else
----------------
Kostya Serebryany wrote:
> doesn't "weak" work on FeeBSD? (just curious)
I just tried it and it does work (thanks for the catch). Since most of the changes were originally prepared by different people for a somewhat old revision, there may be issues like that. I will try my best to handle them on my side.

Now, given DECLARE_WRAPPER() and GetRealFunctionAddress() are common for Linux and FreeBSD, would it make sense if we not duplicate them in "interception_freebsd.h" and "interception_freebsd.cc"?

================
Comment at: lib/interception/interception_freebsd.h:25
@@ +24,3 @@
+namespace __interception {
+namespace freebsd {
+
----------------
Kostya Serebryany wrote:
> Why namespace freebsd?
> Only one version of GetRealFunctionAddress should exist, which is enforced by #ifdef __FreeBSD__, etc.
> If this enforcement breaks, we'll get GetRealFunctionAddress and freebsd::GetRealFunctionAddress, which is a mess. 
> I'd prefer to not introduce "namespace freebsd" or at least add a comment why you need one here. 
> 
Yes, I agree. Will fix.


http://llvm-reviews.chandlerc.com/D2828



More information about the llvm-commits mailing list