Skip to content

Commit

Permalink
add ASAN fiber extern definitions and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Sep 13, 2019
1 parent 47f2800 commit 26d21e0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,36 @@
# define JL_THREAD_LOCAL
#endif

#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define JL_ASAN_ENABLED // Clang flavor
#endif
#elif defined(__SANITIZE_ADDRESS__)
#define JL_ASAN_ENABLED // GCC flavor
#endif

#ifdef JL_ASAN_ENABLED

#ifdef __cplusplus
extern "C" {
#endif
void __sanitizer_start_switch_fiber(void**, const void*, size_t);
void __sanitizer_finish_switch_fiber(void*, const void**, size_t*);
#ifdef __cplusplus
}
#endif

static inline void sanitizer_start_switch_fiber(const void* bottom, size_t size) {
__sanitizer_start_switch_fiber(NULL, bottom, size);
}
static inline void sanitizer_finish_switch_fiber() {
__sanitizer_finish_switch_fiber(NULL, NULL, NULL);
}
#else
static inline void sanitizer_start_switch_fiber(const void* bottom, size_t size) {}
static inline void sanitizer_finish_switch_fiber() {}
#endif

#define container_of(ptr, type, member) \
((type *) ((char *)(ptr) - offsetof(type, member)))

Expand Down
1 change: 1 addition & 0 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define JL_ASAN_ENABLED // GCC flavor
#endif


#if defined(__has_feature)
#if __has_feature(memory_sanitizer)
#define JL_MSAN_ENABLED
Expand Down

0 comments on commit 26d21e0

Please sign in to comment.