[compiler-rt] r173928 - [sanitizer] Further split private and public sanitizer headers.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Wed Jan 30 05:47:43 PST 2013


I tried. Could you?

On Wed, Jan 30, 2013 at 5:40 PM, Alexey Samsonov <samsonov at google.com> wrote:
>
> On Wed, Jan 30, 2013 at 5:12 PM, Evgeniy Stepanov
> <eugeni.stepanov at gmail.com> wrote:
>>
>> Author: eugenis
>> Date: Wed Jan 30 07:12:08 2013
>> New Revision: 173928
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=173928&view=rev
>> Log:
>> [sanitizer] Further split private and public sanitizer headers.
>>
>> And make msan_interface.h C-compatible.
>>
>> Modified:
>>     compiler-rt/trunk/include/sanitizer/common_interface_defs.h
>>     compiler-rt/trunk/include/sanitizer/msan_interface.h
>>     compiler-rt/trunk/lib/asan/asan_flags.h
>>     compiler-rt/trunk/lib/interception/interception.h
>>     compiler-rt/trunk/lib/msan/msan_interface_internal.h
>>     compiler-rt/trunk/lib/msan/tests/msan_test.cc
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.h
>>
>> Modified: compiler-rt/trunk/include/sanitizer/common_interface_defs.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/common_interface_defs.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/include/sanitizer/common_interface_defs.h (original)
>> +++ compiler-rt/trunk/include/sanitizer/common_interface_defs.h Wed Jan 30
>> 07:12:08 2013
>> @@ -7,86 +7,32 @@
>>  //
>>
>> //===----------------------------------------------------------------------===//
>>  //
>> -// This file is shared between AddressSanitizer and ThreadSanitizer.
>> -// It contains basic macro and types.
>> -// NOTE: This file may be included into user code.
>> +// Common part of the public sanitizer interface.
>>
>> //===----------------------------------------------------------------------===//
>>
>>  #ifndef SANITIZER_COMMON_INTERFACE_DEFS_H
>>  #define SANITIZER_COMMON_INTERFACE_DEFS_H
>>
>> -// ----------- ATTENTION -------------
>> -// This header should NOT include any other headers to avoid portability
>> issues.
>> -
>> -#if defined(_WIN32)
>> -// FIXME find out what we need on Windows. __declspec(dllexport) ?
>> -# define SANITIZER_INTERFACE_ATTRIBUTE
>> -# define SANITIZER_WEAK_ATTRIBUTE
>> -#elif defined(SANITIZER_GO)
>> -# define SANITIZER_INTERFACE_ATTRIBUTE
>> -# define SANITIZER_WEAK_ATTRIBUTE
>> -#else
>> -# define SANITIZER_INTERFACE_ATTRIBUTE
>> __attribute__((visibility("default")))
>> -# define SANITIZER_WEAK_ATTRIBUTE  __attribute__((weak))
>> -#endif
>> -
>> -#ifdef __linux__
>> -# define SANITIZER_SUPPORTS_WEAK_HOOKS 1
>> -#else
>> -# define SANITIZER_SUPPORTS_WEAK_HOOKS 0
>> -#endif
>> -
>> -// __has_feature
>> -#if !defined(__has_feature)
>> -# define __has_feature(x) 0
>> -#endif
>> -
>> -// For portability reasons we do not include stddef.h, stdint.h or any
>> other
>> -// system header, but we do need some basic types that are not defined
>> -// in a portable way by the language itself.
>> -namespace __sanitizer {
>> -
>> -#if defined(_WIN64)
>> -// 64-bit Windows uses LLP64 data model.
>> -typedef unsigned long long uptr;  // NOLINT
>> -typedef signed   long long sptr;  // NOLINT
>> -#else
>> -typedef unsigned long uptr;  // NOLINT
>> -typedef signed   long sptr;  // NOLINT
>> -#endif  // defined(_WIN64)
>> -#if defined(__x86_64__)
>> -// Since x32 uses ILP32 data model in 64-bit hardware mode,  we must use
>> -// 64-bit pointer to unwind stack frame.
>> -typedef unsigned long long uhwptr;  // NOLINT
>> -#else
>> -typedef uptr uhwptr;   // NOLINT
>> -#endif
>> -typedef unsigned char u8;
>> -typedef unsigned short u16;  // NOLINT
>> -typedef unsigned int u32;
>> -typedef unsigned long long u64;  // NOLINT
>> -typedef signed   char s8;
>> -typedef signed   short s16;  // NOLINT
>> -typedef signed   int s32;
>> -typedef signed   long long s64;  // NOLINT
>> -
>> -}  // namespace __sanitizer
>> +#include <stddef.h>
>> +#include <stdint.h>
>>
>> +#ifdef __cplusplus
>>  extern "C" {
>> +#endif
>>    // Tell the tools to write their reports to "path.<pid>" instead of
>> stderr.
>> -  void __sanitizer_set_report_path(const char *path)
>> -      SANITIZER_INTERFACE_ATTRIBUTE;
>> +  void __sanitizer_set_report_path(const char *path);
>>
>>    // Tell the tools to write their reports to given file descriptor
>> instead of
>>    // stderr.
>> -  void __sanitizer_set_report_fd(int fd)
>> -      SANITIZER_INTERFACE_ATTRIBUTE;
>> +  void __sanitizer_set_report_fd(int fd);
>>
>>    // Notify the tools that the sandbox is going to be turned on. The
>> reserved
>>    // parameter will be used in the future to hold a structure with
>> functions
>>    // that the tools may call to bypass the sandbox.
>> -  void __sanitizer_sandbox_on_notify(void *reserved)
>> -      SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE;
>> +  void __sanitizer_sandbox_on_notify(void *reserved);
>> +
>> +#ifdef __cplusplus
>>  }  // extern "C"
>> +#endif
>>
>>  #endif  // SANITIZER_COMMON_INTERFACE_DEFS_H
>>
>> Modified: compiler-rt/trunk/include/sanitizer/msan_interface.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/msan_interface.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/include/sanitizer/msan_interface.h (original)
>> +++ compiler-rt/trunk/include/sanitizer/msan_interface.h Wed Jan 30
>> 07:12:08 2013
>> @@ -16,10 +16,6 @@
>>
>>  #include <sanitizer/common_interface_defs.h>
>>
>> -using __sanitizer::uptr;
>> -using __sanitizer::sptr;
>> -using __sanitizer::u32;
>> -
>>  #ifdef __cplusplus
>>  extern "C" {
>>  #endif
>> @@ -27,47 +23,37 @@ extern "C" {
>>  #if __has_feature(memory_sanitizer)
>>    /* Returns a string describing a stack origin.
>>       Return NULL if the origin is invalid, or is not a stack origin. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  const char *__msan_get_origin_descr_if_stack(u32 id);
>> +  const char *__msan_get_origin_descr_if_stack(uint32_t id);
>>
>>
>>    /* Set raw origin for the memory range. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  void __msan_set_origin(void *a, uptr size, u32 origin);
>> +  void __msan_set_origin(void *a, size_t size, uint32_t origin);
>>
>>    /* Get raw origin for an address. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  u32 __msan_get_origin(void *a);
>> +  uint32_t __msan_get_origin(void *a);
>>
>>    /* Returns non-zero if tracking origins. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>>    int __msan_get_track_origins();
>>
>>    /* Returns the origin id of the latest UMR in the calling thread. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  u32 __msan_get_umr_origin();
>> +  uint32_t __msan_get_umr_origin();
>>
>>    /* Make memory region fully initialized (without changing its
>> contents). */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  void __msan_unpoison(void *a, uptr size);
>> +  void __msan_unpoison(void *a, size_t size);
>>
>>    /* Make memory region fully uninitialized (without changing its
>> contents). */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  void __msan_poison(void *a, uptr size);
>> +  void __msan_poison(void *a, size_t size);
>>
>>    /* Make memory region partially uninitialized (without changing its
>> contents).
>>     */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  void __msan_partial_poison(void* data, void* shadow, uptr size);
>> +  void __msan_partial_poison(void* data, void* shadow, size_t size);
>>
>>    /* Returns the offset of the first (at least partially) poisoned byte
>> in the
>>       memory range, or -1 if the whole range is good. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  sptr __msan_test_shadow(const void *x, uptr size);
>> +  intptr_t __msan_test_shadow(const void *x, size_t size);
>>
>>    /* Set exit code when error(s) were detected.
>>       Value of 0 means don't change the program exit code. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>>    void __msan_set_exit_code(int exit_code);
>>
>>    /* For testing:
>> @@ -75,42 +61,37 @@ extern "C" {
>>       ... some buggy code ...
>>       __msan_set_expect_umr(0);
>>       The last line will verify that a UMR happened. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>>    void __msan_set_expect_umr(int expect_umr);
>>
>>    /* Print shadow and origin for the memory range to stdout in a
>> human-readable
>>       format. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  void __msan_print_shadow(const void *x, uptr size);
>> +  void __msan_print_shadow(const void *x, size_t size);
>>
>>    /* Print current function arguments shadow and origin to stdout in a
>>       human-readable format. */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>>    void __msan_print_param_shadow();
>>
>>    /* Returns true if running under a dynamic tool (DynamoRio-based). */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>>    int  __msan_has_dynamic_component();
>>
>>    /* Tell MSan about newly allocated memory (ex.: custom allocator).
>>       Memory will be marked uninitialized, with origin at the call site.
>> */
>> -  SANITIZER_INTERFACE_ATTRIBUTE
>> -  void __msan_allocated_memory(void* data, uptr size);
>> +  void __msan_allocated_memory(void* data, size_t size);
>>
>>  #else  // __has_feature(memory_sanitizer)
>>
>> -#define __msan_get_origin_descr_if_stack(u32 id) ((const char*)0)
>> -#define __msan_set_origin(void *a, uptr size, u32 origin)
>> -#define __msan_get_origin(void *a) ((u32)-1)
>> +#define __msan_get_origin_descr_if_stack(id) ((const char*)0)
>> +#define __msan_set_origin(a, size, origin)
>> +#define __msan_get_origin(a) ((uint32_t)-1)
>>  #define __msan_get_track_origins() (0)
>> -#define __msan_get_umr_origin() ((u32)-1)
>> -#define __msan_unpoison(void *a, uptr size)
>> -#define __msan_poison(void *a, uptr size)
>> -#define __msan_partial_poison(void* data, void* shadow, uptr size)
>> -#define __msan_test_shadow(const void *x, uptr size) ((sptr)-1)
>> -#define __msan_set_exit_code(int exit_code)
>> -#define __msan_set_expect_umr(int expect_umr)
>> -#define __msan_print_shadow(const void *x, uptr size)
>> +#define __msan_get_umr_origin() ((uint32_t)-1)
>> +#define __msan_unpoison(a, size)
>> +#define __msan_poison(a, size)
>> +#define __msan_partial_poison(data, shadow, size)
>> +#define __msan_test_shadow(x, size) ((intptr_t)-1)
>> +#define __msan_set_exit_code(exit_code)
>> +#define __msan_set_expect_umr(expect_umr)
>> +#define __msan_print_shadow(x, size)
>>  #define __msan_print_param_shadow()
>>  #define __msan_has_dynamic_component() (0)
>>  #define __msan_allocated_memory(data, size)
>>
>> Modified: compiler-rt/trunk/lib/asan/asan_flags.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_flags.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/asan/asan_flags.h (original)
>> +++ compiler-rt/trunk/lib/asan/asan_flags.h Wed Jan 30 07:12:08 2013
>> @@ -15,7 +15,7 @@
>>  #ifndef ASAN_FLAGS_H
>>  #define ASAN_FLAGS_H
>>
>> -#include "sanitizer/common_interface_defs.h"
>> +#include "sanitizer_common/sanitizer_internal_defs.h"
>>
>>  // ASan flag values can be defined in three ways:
>>  // 1) initialized with default values at startup.
>>
>> Modified: compiler-rt/trunk/lib/interception/interception.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/interception.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/interception/interception.h (original)
>> +++ compiler-rt/trunk/lib/interception/interception.h Wed Jan 30 07:12:08
>> 2013
>> @@ -19,7 +19,7 @@
>>  # error "Interception doesn't work on this operating system."
>>  #endif
>>
>> -#include "sanitizer/common_interface_defs.h"
>> +#include "../sanitizer_common/sanitizer_internal_defs.h"
>
>
> Can we set include directories instead of "#include "../" ?
>
>>
>>
>>  // These typedefs should be used only in the interceptor definitions to
>> replace
>>  // the standard system types (e.g. SSIZE_T instead of ssize_t)
>>
>> Modified: compiler-rt/trunk/lib/msan/msan_interface_internal.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interface_internal.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/msan/msan_interface_internal.h (original)
>> +++ compiler-rt/trunk/lib/msan/msan_interface_internal.h Wed Jan 30
>> 07:12:08 2013
>> @@ -15,7 +15,7 @@
>>  #ifndef MSAN_INTERFACE_INTERNAL_H
>>  #define MSAN_INTERFACE_INTERNAL_H
>>
>> -#include <sanitizer/common_interface_defs.h>
>> +#include "sanitizer_common/sanitizer_internal_defs.h"
>>
>>  extern "C" {
>>  // FIXME: document all interface functions.
>>
>> Modified: compiler-rt/trunk/lib/msan/tests/msan_test.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test.cc?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/msan/tests/msan_test.cc (original)
>> +++ compiler-rt/trunk/lib/msan/tests/msan_test.cc Wed Jan 30 07:12:08 2013
>> @@ -56,7 +56,7 @@ typedef   signed long long S8;  // NOLIN
>>  static bool TrackingOrigins() {
>>    S8 x;
>>    __msan_set_origin(&x, sizeof(x), 0x1234);
>> -  u32 origin = __msan_get_origin(&x);
>> +  U4 origin = __msan_get_origin(&x);
>>    __msan_set_origin(&x, sizeof(x), 0);
>>    return origin == 0x1234;
>>  }
>> @@ -82,7 +82,7 @@ static bool TrackingOrigins() {
>>        __msan_set_expect_umr(1);                     \
>>        action;                                       \
>>        __msan_set_expect_umr(0);                     \
>> -      u32 id = __msan_get_umr_origin();             \
>> +      U4 id = __msan_get_umr_origin();             \
>>        const char *str = __msan_get_origin_descr_if_stack(id); \
>>        if (!str || strcmp(str, stack_origin)) {      \
>>          fprintf(stderr, "EXPECT_POISONED_S: id=%u %s, %s", \
>> @@ -114,7 +114,7 @@ void ExpectPoisonedWithOrigin(const T& t
>>  template<typename T>
>>  void ExpectPoisonedWithStackOrigin(const T& t, const char *stack_origin)
>> {
>>    EXPECT_NE(-1, __msan_test_shadow((void*)&t, sizeof(t)));
>> -  u32 id = __msan_get_origin((void*)&t);
>> +  U4 id = __msan_get_origin((void*)&t);
>>    const char *str = __msan_get_origin_descr_if_stack(id);
>>    if (!str || strcmp(str, stack_origin)) {
>>      fprintf(stderr, "EXPECT_POISONED_S: id=%u %s, %s",
>> @@ -140,7 +140,7 @@ T *GetPoisoned(int i = 0, T val = 0) {
>>  }
>>
>>  template<class T>
>> -T *GetPoisonedO(int i, u32 origin, T val = 0) {
>> +T *GetPoisonedO(int i, U4 origin, T val = 0) {
>>    T *res = (T*)&poisoned_array[i];
>>    *res = val;
>>    __msan_poison(&poisoned_array[i], sizeof(T));
>> @@ -853,11 +853,11 @@ TEST(MemorySanitizer, ptrtoint) {
>>    // Test that shadow is propagated through pointer-to-integer
>> conversion.
>>    void* p = (void*)0xABCD;
>>    __msan_poison(((char*)&p) + 1, sizeof(p));
>> -  EXPECT_NOT_POISONED((((uptr)p) & 0xFF) == 0);
>> +  EXPECT_NOT_POISONED((((uintptr_t)p) & 0xFF) == 0);
>>
>>    void* q = (void*)0xABCD;
>>    __msan_poison(&q, sizeof(q) - 1);
>> -  EXPECT_POISONED((((uptr)q) & 0xFF) == 0);
>> +  EXPECT_POISONED((((uintptr_t)q) & 0xFF) == 0);
>>  }
>>
>>  static void vaargsfn2(int guard, ...) {
>> @@ -1490,7 +1490,7 @@ TEST(MemorySanitizerOrigins, DISABLED_In
>>    if (!TrackingOrigins()) return;
>>
>>    S s;
>> -  u32 origin = rand();  // NOLINT
>> +  U4 origin = rand();  // NOLINT
>>    s.a = *GetPoisonedO<U2>(0, origin);
>>    EXPECT_EQ(origin, __msan_get_origin(&s.a));
>>    EXPECT_EQ(origin, __msan_get_origin(&s.b));
>> @@ -1504,14 +1504,14 @@ TEST(MemorySanitizerOrigins, DISABLED_In
>>  template<class T, class BinaryOp>
>>  INLINE
>>  void BinaryOpOriginTest(BinaryOp op) {
>> -  u32 ox = rand();  //NOLINT
>> -  u32 oy = rand();  //NOLINT
>> +  U4 ox = rand();  //NOLINT
>> +  U4 oy = rand();  //NOLINT
>>    T *x = GetPoisonedO<T>(0, ox, 0);
>>    T *y = GetPoisonedO<T>(1, oy, 0);
>>    T *z = GetPoisonedO<T>(2, 0, 0);
>>
>>    *z = op(*x, *y);
>> -  u32 origin = __msan_get_origin(z);
>> +  U4 origin = __msan_get_origin(z);
>>    EXPECT_POISONED_O(*z, origin);
>>    EXPECT_EQ(true, origin == ox || origin == oy);
>>
>> @@ -1675,7 +1675,7 @@ TEST(MemorySanitizerOrigins, DISABLED_Al
>>    EXPECT_DEATH(AllocaTO(), "ORIGIN: stack allocation: ar at AllocaTO");
>>  }
>>
>> -NOINLINE int RetvalOriginTest(u32 origin) {
>> +NOINLINE int RetvalOriginTest(U4 origin) {
>>    int *a = new int;
>>    break_optimization(a);
>>    __msan_set_origin(a, sizeof(*a), origin);
>> @@ -1689,14 +1689,14 @@ TEST(MemorySanitizerOrigins, Retval) {
>>    EXPECT_POISONED_O(RetvalOriginTest(__LINE__), __LINE__);
>>  }
>>
>> -NOINLINE void ParamOriginTest(int param, u32 origin) {
>> +NOINLINE void ParamOriginTest(int param, U4 origin) {
>>    EXPECT_POISONED_O(param, origin);
>>  }
>>
>>  TEST(MemorySanitizerOrigins, Param) {
>>    if (!TrackingOrigins()) return;
>>    int *a = new int;
>> -  u32 origin = __LINE__;
>> +  U4 origin = __LINE__;
>>    break_optimization(a);
>>    __msan_set_origin(a, sizeof(*a), origin);
>>    ParamOriginTest(*a, origin);
>> @@ -1714,14 +1714,14 @@ TEST(MemorySanitizerOrigins, strlen) {
>>    break_optimization(&alignment);
>>    char x[4] = {'a', 'b', 0, 0};
>>    __msan_poison(&x[2], 1);
>> -  u32 origin = __LINE__;
>> +  U4 origin = __LINE__;
>>    __msan_set_origin(x, sizeof(x), origin);
>>    EXPECT_UMR_O(volatile unsigned y = strlen(x), origin);
>>  }
>>
>>  TEST(MemorySanitizerOrigins, wcslen) {
>>    wchar_t w[3] = {'a', 'b', 0};
>> -  u32 origin = __LINE__;
>> +  U4 origin = __LINE__;
>>    __msan_set_origin(w, sizeof(w), origin);
>>    __msan_poison(&w[2], sizeof(wchar_t));
>>    EXPECT_UMR_O(volatile unsigned y = wcslen(w), origin);
>> @@ -1730,7 +1730,7 @@ TEST(MemorySanitizerOrigins, wcslen) {
>>  #if MSAN_HAS_M128
>>  TEST(MemorySanitizerOrigins, StoreIntrinsic) {
>>    __m128 x, y;
>> -  u32 origin = __LINE__;
>> +  U4 origin = __LINE__;
>>    __msan_set_origin(&x, sizeof(x), origin);
>>    __msan_poison(&x, sizeof(x));
>>    __builtin_ia32_storeups((float*)&y, x);
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Wed
>> Jan 30 07:12:08 2013
>> @@ -13,7 +13,78 @@
>>  #ifndef SANITIZER_DEFS_H
>>  #define SANITIZER_DEFS_H
>>
>> -#include "sanitizer/common_interface_defs.h"
>> +#if defined(_WIN32)
>> +// FIXME find out what we need on Windows. __declspec(dllexport) ?
>> +# define SANITIZER_INTERFACE_ATTRIBUTE
>> +# define SANITIZER_WEAK_ATTRIBUTE
>> +#elif defined(SANITIZER_GO)
>> +# define SANITIZER_INTERFACE_ATTRIBUTE
>> +# define SANITIZER_WEAK_ATTRIBUTE
>> +#else
>> +# define SANITIZER_INTERFACE_ATTRIBUTE
>> __attribute__((visibility("default")))
>> +# define SANITIZER_WEAK_ATTRIBUTE  __attribute__((weak))
>> +#endif
>> +
>> +#ifdef __linux__
>> +# define SANITIZER_SUPPORTS_WEAK_HOOKS 1
>> +#else
>> +# define SANITIZER_SUPPORTS_WEAK_HOOKS 0
>> +#endif
>> +
>> +// __has_feature
>> +#if !defined(__has_feature)
>> +# define __has_feature(x) 0
>> +#endif
>> +
>> +// For portability reasons we do not include stddef.h, stdint.h or any
>> other
>> +// system header, but we do need some basic types that are not defined
>> +// in a portable way by the language itself.
>> +namespace __sanitizer {
>> +
>> +#if defined(_WIN64)
>> +// 64-bit Windows uses LLP64 data model.
>> +typedef unsigned long long uptr;  // NOLINT
>> +typedef signed   long long sptr;  // NOLINT
>> +#else
>> +typedef unsigned long uptr;  // NOLINT
>> +typedef signed   long sptr;  // NOLINT
>> +#endif  // defined(_WIN64)
>> +#if defined(__x86_64__)
>> +// Since x32 uses ILP32 data model in 64-bit hardware mode,  we must use
>> +// 64-bit pointer to unwind stack frame.
>> +typedef unsigned long long uhwptr;  // NOLINT
>> +#else
>> +typedef uptr uhwptr;   // NOLINT
>> +#endif
>> +typedef unsigned char u8;
>> +typedef unsigned short u16;  // NOLINT
>> +typedef unsigned int u32;
>> +typedef unsigned long long u64;  // NOLINT
>> +typedef signed   char s8;
>> +typedef signed   short s16;  // NOLINT
>> +typedef signed   int s32;
>> +typedef signed   long long s64;  // NOLINT
>> +
>> +}  // namespace __sanitizer
>> +
>> +extern "C" {
>> +  // Tell the tools to write their reports to "path.<pid>" instead of
>> stderr.
>> +  void __sanitizer_set_report_path(const char *path)
>> +      SANITIZER_INTERFACE_ATTRIBUTE;
>> +
>> +  // Tell the tools to write their reports to given file descriptor
>> instead of
>> +  // stderr.
>> +  void __sanitizer_set_report_fd(int fd)
>> +      SANITIZER_INTERFACE_ATTRIBUTE;
>> +
>> +  // Notify the tools that the sandbox is going to be turned on. The
>> reserved
>> +  // parameter will be used in the future to hold a structure with
>> functions
>> +  // that the tools may call to bypass the sandbox.
>> +  void __sanitizer_sandbox_on_notify(void *reserved)
>> +      SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE;
>> +}  // extern "C"
>> +
>> +
>>  using namespace __sanitizer;  // NOLINT
>>  // ----------- ATTENTION -------------
>>  // This header should NOT include any other headers to avoid portability
>> issues.
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h Wed Jan 30
>> 07:12:08 2013
>> @@ -11,14 +11,13 @@
>>  // run-time libraries.
>>  // These tools can not use some of the libc functions directly because
>> those
>>  // functions are intercepted. Instead, we implement a tiny subset of libc
>> here.
>> -// NOTE: This file may be included into user code.
>>
>> //===----------------------------------------------------------------------===//
>>  #ifndef SANITIZER_LIBC_H
>>  #define SANITIZER_LIBC_H
>>
>>  // ----------- ATTENTION -------------
>>  // This header should NOT include any other headers from sanitizer
>> runtime.
>> -#include "sanitizer/common_interface_defs.h"
>> +#include "sanitizer_internal_defs.h"
>>
>>  namespace __sanitizer {
>>
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stackdepot.h Wed Jan
>> 30 07:12:08 2013
>> @@ -13,7 +13,7 @@
>>  #ifndef SANITIZER_STACKDEPOT_H
>>  #define SANITIZER_STACKDEPOT_H
>>
>> -#include "sanitizer/common_interface_defs.h"
>> +#include "sanitizer_internal_defs.h"
>>
>>  namespace __sanitizer {
>>
>>
>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h (original)
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h Wed Jan 30 07:12:08
>> 2013
>> @@ -16,7 +16,7 @@
>>  #ifndef TSAN_INTERFACE_H
>>  #define TSAN_INTERFACE_H
>>
>> -#include <sanitizer/common_interface_defs.h>
>> +#include <sanitizer_common/sanitizer_internal_defs.h>
>>
>>  // This header should NOT include any other headers.
>>  // All functions in this header are extern "C" and start with __tsan_.
>>
>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.h?rev=173928&r1=173927&r2=173928&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.h (original)
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.h Wed Jan 30
>> 07:12:08 2013
>> @@ -14,7 +14,7 @@
>>  #ifndef TSAN_INTERFACE_ANN_H
>>  #define TSAN_INTERFACE_ANN_H
>>
>> -#include <sanitizer/common_interface_defs.h>
>> +#include <sanitizer_common/sanitizer_internal_defs.h>
>>
>>  // This header should NOT include any other headers.
>>  // All functions in this header are extern "C" and start with __tsan_.
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
>
> --
> Alexey Samsonov, MSK



More information about the llvm-commits mailing list