1 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Its purpose is to SHIM_ALIAS_SYMBOL the Libc symbols for malloc/new to the 6 // shim layer entry points. 7 8 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LIBC_SYMBOLS_H_ 9 #error This header is meant to be included only once by allocator_shim.cc 10 #endif 11 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_LIBC_SYMBOLS_H_ 12 13 #include <malloc.h> 14 15 #include "base/allocator/allocator_shim_internals.h" 16 17 extern "C" { 18 19 SHIM_ALWAYS_EXPORT void* malloc(size_t size) __THROW 20 SHIM_ALIAS_SYMBOL(ShimMalloc); 21 22 SHIM_ALWAYS_EXPORT void free(void* ptr) __THROW 23 SHIM_ALIAS_SYMBOL(ShimFree); 24 25 SHIM_ALWAYS_EXPORT void* realloc(void* ptr, size_t size) __THROW 26 SHIM_ALIAS_SYMBOL(ShimRealloc); 27 28 SHIM_ALWAYS_EXPORT void* calloc(size_t n, size_t size) __THROW 29 SHIM_ALIAS_SYMBOL(ShimCalloc); 30 31 SHIM_ALWAYS_EXPORT void cfree(void* ptr) __THROW 32 SHIM_ALIAS_SYMBOL(ShimFree); 33 34 SHIM_ALWAYS_EXPORT void* memalign(size_t align, size_t s) __THROW 35 SHIM_ALIAS_SYMBOL(ShimMemalign); 36 37 SHIM_ALWAYS_EXPORT void* valloc(size_t size) __THROW 38 SHIM_ALIAS_SYMBOL(ShimValloc); 39 40 SHIM_ALWAYS_EXPORT void* pvalloc(size_t size) __THROW 41 SHIM_ALIAS_SYMBOL(ShimPvalloc); 42 43 SHIM_ALWAYS_EXPORT int posix_memalign(void** r, size_t a, size_t s) __THROW 44 SHIM_ALIAS_SYMBOL(ShimPosixMemalign); 45 46 // The default dispatch translation unit has to define also the following 47 // symbols (unless they are ultimately routed to the system symbols): 48 // void malloc_stats(void); 49 // int mallopt(int, int); 50 // struct mallinfo mallinfo(void); 51 // size_t malloc_size(void*); 52 // size_t malloc_usable_size(const void*); 53 54 } // extern "C" 55