[compiler-rt | interceptors] Provide an intercept override knob.

This knob is useful for downstream users who want that some of their
libc functions to not be intercepted.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D97740
This commit is contained in:
Siva Chandra Reddy 2021-03-01 14:58:14 -08:00
parent f893312c1a
commit 0106370bee
1 changed files with 21 additions and 0 deletions

View File

@ -585,4 +585,25 @@
#define SANITIZER_INTERCEPT_UNAME (SI_POSIX && !SI_FREEBSD)
#define SANITIZER_INTERCEPT___XUNAME SI_FREEBSD
// This macro gives a way for downstream users to override the above
// interceptor macros irrespective of the platform they are on. They have
// to do two things:
// 1. Build compiler-rt with -DSANITIZER_OVERRIDE_INTERCEPTORS.
// 2. Provide a header file named sanitizer_intercept_overriders.h in the
// include path for their compiler-rt build.
// An example of an overrider for strlen interceptor that one can list in
// sanitizer_intercept_overriders.h is as follows:
//
// #ifdef SANITIZER_INTERCEPT_STRLEN
// #undef SANITIZER_INTERCEPT_STRLEN
// #define SANITIZER_INTERCEPT_STRLEN <value of choice>
// #endif
//
// This "feature" is useful for downstream users who do not want some of
// their libc funtions to be intercepted. They can selectively disable
// interception of those functions.
#ifdef SANITIZER_OVERRIDE_INTERCEPTORS
#include <sanitizer_intercept_overriders.h>
#endif
#endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H