diff options
author | Etienne Bergeron <etienneb@google.com> | 2016-07-27 16:16:54 +0000 |
---|---|---|
committer | Etienne Bergeron <etienneb@google.com> | 2016-07-27 16:16:54 +0000 |
commit | be0a85814add5c9b64daeceb0042cc81a0ebd487 (patch) | |
tree | f9320b2ab6584f6e2a2a55efdba3c414c6aa42d5 /lib/interception | |
parent | 1b184ea395ef74d1b9339b5186ca15ca70003c8a (diff) |
[compiler-rt] Fix warnings in interception code
Summary:
This patch is re-introducing the code to fix the
dynamic hooking on windows and to fix a compiler
warning on Apple.
Related patches:
* https://reviews.llvm.org/D22641
* https://reviews.llvm.org/D22610
* https://reviews.llvm.org/rL276311
* https://reviews.llvm.org/rL276490
Both architecture are using different techniques to
hook on library functions (memchr, strcpy,...).
On Apple, the function is not dynamically hooked and
the symbol always points to a valid function
(i.e. can't be null). The REAL macro returns the
symbol.
On windows, the function is dynamically patch and the
REAL(...) function may or may not be null. It depend
on whether or not the function was hooked correctly.
Also, on windows memcpy and memmove are the same.
```
#if !defined(__APPLE__)
[...]
# define REAL(x) __interception::PTR_TO_REAL(x)
# define ASSIGN_REAL(dst, src) REAL(dst) = REAL(src)
[...]
#else // __APPLE__
[...]
# define REAL(x) x
# define ASSIGN_REAL(x, y)
[...]
#endif // __APPLE__
Reviewers: rnk
Subscribers: kcc, hans, kubabrecka, llvm-commits, bruno, chrisha
Differential Revision: https://reviews.llvm.org/D22758
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276885 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/interception')
-rw-r--r-- | lib/interception/interception.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/interception/interception.h b/lib/interception/interception.h index 9e9aca215..f490c3961 100644 --- a/lib/interception/interception.h +++ b/lib/interception/interception.h @@ -158,10 +158,12 @@ const interpose_substitution substitution_##func_name[] \ namespace __interception { \ extern FUNC_TYPE(func) PTR_TO_REAL(func); \ } +# define ASSIGN_REAL(dst, src) REAL(dst) = REAL(src) #else // __APPLE__ # define REAL(x) x # define DECLARE_REAL(ret_type, func, ...) \ extern "C" ret_type func(__VA_ARGS__); +# define ASSIGN_REAL(x, y) #endif // __APPLE__ #define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...) \ |