diff options
author | Stephen Hines <srhines@google.com> | 2014-07-21 00:49:56 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-07-21 00:49:56 -0700 |
commit | 6a211c5814e25d6745a5058cc0e499e5235d3821 (patch) | |
tree | 12956caa69324b4f169a58e88ca3dd95f518317b /include | |
parent | 65e7b1d5aa3878e95eab8772d7c299660b8e7d0c (diff) | |
download | compiler-rt-6a211c5814e25d6745a5058cc0e499e5235d3821.tar.gz |
Update compiler-rt for rebase to r212749.
Includes a cherry-pick of:
r213309 - fixes umodsi3
Change-Id: Ic7367e3586b6af7ef74bee6a8cf437d5f28d975a
Diffstat (limited to 'include')
-rw-r--r-- | include/CMakeLists.txt | 1 | ||||
-rw-r--r-- | include/sanitizer/allocator_interface.h | 66 | ||||
-rw-r--r-- | include/sanitizer/asan_interface.h | 15 | ||||
-rw-r--r-- | include/sanitizer/msan_interface.h | 13 |
4 files changed, 93 insertions, 2 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index b5d98a805..7f8664e09 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,4 +1,5 @@ set(SANITIZER_HEADERS + sanitizer/allocator_interface.h sanitizer/asan_interface.h sanitizer/common_interface_defs.h sanitizer/dfsan_interface.h diff --git a/include/sanitizer/allocator_interface.h b/include/sanitizer/allocator_interface.h new file mode 100644 index 000000000..ab251f89c --- /dev/null +++ b/include/sanitizer/allocator_interface.h @@ -0,0 +1,66 @@ +//===-- allocator_interface.h ---------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Public interface header for allocator used in sanitizers (ASan/TSan/MSan). +//===----------------------------------------------------------------------===// +#ifndef SANITIZER_ALLOCATOR_INTERFACE_H +#define SANITIZER_ALLOCATOR_INTERFACE_H + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + /* Returns the estimated number of bytes that will be reserved by allocator + for request of "size" bytes. If allocator can't allocate that much + memory, returns the maximal possible allocation size, otherwise returns + "size". */ + size_t __sanitizer_get_estimated_allocated_size(size_t size); + + /* Returns true if p was returned by the allocator and + is not yet freed. */ + int __sanitizer_get_ownership(const volatile void *p); + + /* Returns the number of bytes reserved for the pointer p. + Requires (get_ownership(p) == true) or (p == 0). */ + size_t __sanitizer_get_allocated_size(const volatile void *p); + + /* Number of bytes, allocated and not yet freed by the application. */ + size_t __sanitizer_get_current_allocated_bytes(); + + /* Number of bytes, mmaped by the allocator to fulfill allocation requests. + Generally, for request of X bytes, allocator can reserve and add to free + lists a large number of chunks of size X to use them for future requests. + All these chunks count toward the heap size. Currently, allocator never + releases memory to OS (instead, it just puts freed chunks to free + lists). */ + size_t __sanitizer_get_heap_size(); + + /* Number of bytes, mmaped by the allocator, which can be used to fulfill + allocation requests. When a user program frees memory chunk, it can first + fall into quarantine and will count toward __sanitizer_get_free_bytes() + later. */ + size_t __sanitizer_get_free_bytes(); + + /* Number of bytes in unmapped pages, that are released to OS. Currently, + always returns 0. */ + size_t __sanitizer_get_unmapped_bytes(); + + /* Malloc hooks that may be optionally provided by user. + __sanitizer_malloc_hook(ptr, size) is called immediately after + allocation of "size" bytes, which returned "ptr". + __sanitizer_free_hook(ptr) is called immediately before + deallocation of "ptr". */ + void __sanitizer_malloc_hook(const volatile void *ptr, size_t size); + void __sanitizer_free_hook(const volatile void *ptr); +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/include/sanitizer/asan_interface.h b/include/sanitizer/asan_interface.h index d244346e4..23fc1789f 100644 --- a/include/sanitizer/asan_interface.h +++ b/include/sanitizer/asan_interface.h @@ -87,28 +87,42 @@ extern "C" { // for request of "size" bytes. If ASan allocator can't allocate that much // memory, returns the maximal possible allocation size, otherwise returns // "size". + /* DEPRECATED: Use __sanitizer_get_estimated_allocated_size instead. */ size_t __asan_get_estimated_allocated_size(size_t size); + // Returns 1 if p was returned by the ASan allocator and is not yet freed. // Otherwise returns 0. + /* DEPRECATED: Use __sanitizer_get_ownership instead. */ int __asan_get_ownership(const void *p); + // Returns the number of bytes reserved for the pointer p. // Requires (get_ownership(p) == true) or (p == 0). + /* DEPRECATED: Use __sanitizer_get_allocated_size instead. */ size_t __asan_get_allocated_size(const void *p); + // Number of bytes, allocated and not yet freed by the application. + /* DEPRECATED: Use __sanitizer_get_current_allocated_bytes instead. */ size_t __asan_get_current_allocated_bytes(); + // Number of bytes, mmaped by asan allocator to fulfill allocation requests. // Generally, for request of X bytes, allocator can reserve and add to free // lists a large number of chunks of size X to use them for future requests. // All these chunks count toward the heap size. Currently, allocator never // releases memory to OS (instead, it just puts freed chunks to free lists). + /* DEPRECATED: Use __sanitizer_get_heap_size instead. */ size_t __asan_get_heap_size(); + // Number of bytes, mmaped by asan allocator, which can be used to fulfill // allocation requests. When a user program frees memory chunk, it can first // fall into quarantine and will count toward __asan_get_free_bytes() later. + /* DEPRECATED: Use __sanitizer_get_free_bytes instead. */ size_t __asan_get_free_bytes(); + // Number of bytes in unmapped pages, that are released to OS. Currently, // always returns 0. + /* DEPRECATED: Use __sanitizer_get_unmapped_bytes instead. */ size_t __asan_get_unmapped_bytes(); + // Prints accumulated stats to stderr. Used for debugging. void __asan_print_accumulated_stats(); @@ -121,6 +135,7 @@ extern "C" { // allocation of "size" bytes, which returned "ptr". // __asan_free_hook(ptr) is called immediately before // deallocation of "ptr". + /* DEPRECATED: Use __sanitizer_malloc_hook / __sanitizer_free_hook instead. */ void __asan_malloc_hook(void *ptr, size_t size); void __asan_free_hook(void *ptr); diff --git a/include/sanitizer/msan_interface.h b/include/sanitizer/msan_interface.h index e8c510be9..f6a62be5c 100644 --- a/include/sanitizer/msan_interface.h +++ b/include/sanitizer/msan_interface.h @@ -89,8 +89,8 @@ extern "C" { a string containing Msan runtime options. See msan_flags.h for details. */ const char* __msan_default_options(); - // Sets the callback to be called right before death on error. - // Passing 0 will unset the callback. + /* Sets the callback to be called right before death on error. + Passing 0 will unset the callback. */ void __msan_set_death_callback(void (*callback)(void)); /***********************************/ @@ -100,17 +100,21 @@ extern "C" { for request of "size" bytes. If Msan allocator can't allocate that much memory, returns the maximal possible allocation size, otherwise returns "size". */ + /* DEPRECATED: Use __sanitizer_get_estimated_allocated_size instead. */ size_t __msan_get_estimated_allocated_size(size_t size); /* Returns true if p was returned by the Msan allocator and is not yet freed. */ + /* DEPRECATED: Use __sanitizer_get_ownership instead. */ int __msan_get_ownership(const volatile void *p); /* Returns the number of bytes reserved for the pointer p. Requires (get_ownership(p) == true) or (p == 0). */ + /* DEPRECATED: Use __sanitizer_get_allocated_size instead. */ size_t __msan_get_allocated_size(const volatile void *p); /* Number of bytes, allocated and not yet freed by the application. */ + /* DEPRECATED: Use __sanitizer_get_current_allocated_bytes instead. */ size_t __msan_get_current_allocated_bytes(); /* Number of bytes, mmaped by msan allocator to fulfill allocation requests. @@ -119,16 +123,19 @@ extern "C" { All these chunks count toward the heap size. Currently, allocator never releases memory to OS (instead, it just puts freed chunks to free lists). */ + /* DEPRECATED: Use __sanitizer_get_heap_size instead. */ size_t __msan_get_heap_size(); /* Number of bytes, mmaped by msan allocator, which can be used to fulfill allocation requests. When a user program frees memory chunk, it can first fall into quarantine and will count toward __msan_get_free_bytes() later. */ + /* DEPRECATED: Use __sanitizer_get_free_bytes instead. */ size_t __msan_get_free_bytes(); /* Number of bytes in unmapped pages, that are released to OS. Currently, always returns 0. */ + /* DEPRECATED: Use __sanitizer_get_unmapped_bytes instead. */ size_t __msan_get_unmapped_bytes(); /* Malloc hooks that may be optionally provided by user. @@ -136,8 +143,10 @@ extern "C" { allocation of "size" bytes, which returned "ptr". __msan_free_hook(ptr) is called immediately before deallocation of "ptr". */ + /* DEPRECATED: Use __sanitizer_malloc_hook / __sanitizer_free_hook instead. */ void __msan_malloc_hook(const volatile void *ptr, size_t size); void __msan_free_hook(const volatile void *ptr); + #ifdef __cplusplus } // extern "C" #endif |