Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_ | 5 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_ |
| 6 #error This header is meant to be included only once by allocator_shim.cc | 6 #error This header is meant to be included only once by allocator_shim.cc |
| 7 #endif | 7 #endif |
| 8 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_ | 8 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_ |
| 9 | 9 |
| 10 // Alias the internal Glibc symbols to the shim entry points. | 10 // Alias the internal Glibc symbols to the shim entry points. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 void GlibcFreeHook(void* ptr, const void* caller) { | 49 void GlibcFreeHook(void* ptr, const void* caller) { |
| 50 return ShimFree(ptr, nullptr); | 50 return ShimFree(ptr, nullptr); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void* GlibcMemalignHook(size_t align, size_t size, const void* caller) { | 53 void* GlibcMemalignHook(size_t align, size_t size, const void* caller) { |
| 54 return ShimMemalign(align, size, nullptr); | 54 return ShimMemalign(align, size, nullptr); |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __malloc_hook)( | 59 __attribute__((visibility("default"))) void* ( |
|
Primiano Tucci (use gerrit)
2017/03/15 11:42:59
Why are you changing this?
If is just about perfor
| |
| 60 size_t, | 60 *MALLOC_HOOK_MAYBE_VOLATILE __malloc_hook)(size_t, |
| 61 const void*) = &GlibcMallocHook; | 61 const void*) = &GlibcMallocHook; |
| 62 | 62 |
| 63 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __realloc_hook)( | 63 __attribute__((visibility("default"))) void* ( |
| 64 void*, | 64 *MALLOC_HOOK_MAYBE_VOLATILE __realloc_hook)(void*, size_t, const void*) = |
| 65 size_t, | 65 &GlibcReallocHook; |
| 66 const void*) = &GlibcReallocHook; | |
| 67 | 66 |
| 68 SHIM_ALWAYS_EXPORT void (*MALLOC_HOOK_MAYBE_VOLATILE __free_hook)(void*, | 67 __attribute__((visibility("default"))) void ( |
| 69 const void*) = | 68 *MALLOC_HOOK_MAYBE_VOLATILE __free_hook)(void*, |
| 70 &GlibcFreeHook; | 69 const void*) = &GlibcFreeHook; |
| 71 | 70 |
| 72 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __memalign_hook)( | 71 __attribute__((visibility("default"))) void* ( |
| 73 size_t, | 72 *MALLOC_HOOK_MAYBE_VOLATILE __memalign_hook)(size_t, size_t, const void*) = |
| 74 size_t, | 73 &GlibcMemalignHook; |
| 75 const void*) = &GlibcMemalignHook; | |
| 76 | 74 |
| 77 // 2) Redefine libc symbols themselves. | 75 // 2) Redefine libc symbols themselves. |
| 78 | 76 |
| 79 SHIM_ALWAYS_EXPORT void* __libc_malloc(size_t size) { | 77 SHIM_ALWAYS_EXPORT void* __libc_malloc(size_t size) { |
| 80 return ShimMalloc(size, nullptr); | 78 return ShimMalloc(size, nullptr); |
| 81 } | 79 } |
| 82 | 80 |
| 83 SHIM_ALWAYS_EXPORT void __libc_free(void* ptr) { | 81 SHIM_ALWAYS_EXPORT void __libc_free(void* ptr) { |
| 84 ShimFree(ptr, nullptr); | 82 ShimFree(ptr, nullptr); |
| 85 } | 83 } |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 112 return ShimPosixMemalign(r, a, s); | 110 return ShimPosixMemalign(r, a, s); |
| 113 } | 111 } |
| 114 | 112 |
| 115 } // extern "C" | 113 } // extern "C" |
| 116 | 114 |
| 117 // Safety check. | 115 // Safety check. |
| 118 #if !defined(__GLIBC__) | 116 #if !defined(__GLIBC__) |
| 119 #error The target platform does not seem to use Glibc. Disable the allocator \ | 117 #error The target platform does not seem to use Glibc. Disable the allocator \ |
| 120 shim by setting use_experimental_allocator_shim=false in GN args. | 118 shim by setting use_experimental_allocator_shim=false in GN args. |
| 121 #endif | 119 #endif |
| OLD | NEW |