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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 const void*) = | 69 const void*) = |
70 &GlibcFreeHook; | 70 &GlibcFreeHook; |
71 | 71 |
72 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __memalign_hook)( | 72 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __memalign_hook)( |
73 size_t, | 73 size_t, |
74 size_t, | 74 size_t, |
75 const void*) = &GlibcMemalignHook; | 75 const void*) = &GlibcMemalignHook; |
76 | 76 |
77 // 2) Redefine libc symbols themselves. | 77 // 2) Redefine libc symbols themselves. |
78 | 78 |
79 SHIM_ALWAYS_EXPORT void* __libc_malloc(size_t size) | 79 SHIM_ALWAYS_EXPORT void* __libc_malloc(size_t size) SHIM_ALIAS_SYMBOL(malloc); |
Primiano Tucci (use gerrit)
2017/02/28 12:18:49
honestly if we go down this road (i.e. adding an e
pcc1
2017/02/28 22:27:35
Done, as discussed on crbug.com/696986
| |
80 SHIM_ALIAS_SYMBOL(ShimMalloc); | |
81 | 80 |
82 SHIM_ALWAYS_EXPORT void __libc_free(void* ptr) SHIM_ALIAS_SYMBOL(ShimFree); | 81 SHIM_ALWAYS_EXPORT void __libc_free(void* ptr) SHIM_ALIAS_SYMBOL(free); |
83 | 82 |
84 SHIM_ALWAYS_EXPORT void* __libc_realloc(void* ptr, size_t size) | 83 SHIM_ALWAYS_EXPORT void* __libc_realloc(void* ptr, size_t size) |
85 SHIM_ALIAS_SYMBOL(ShimRealloc); | 84 SHIM_ALIAS_SYMBOL(realloc); |
86 | 85 |
87 SHIM_ALWAYS_EXPORT void* __libc_calloc(size_t n, size_t size) | 86 SHIM_ALWAYS_EXPORT void* __libc_calloc(size_t n, size_t size) |
88 SHIM_ALIAS_SYMBOL(ShimCalloc); | 87 SHIM_ALIAS_SYMBOL(calloc); |
89 | 88 |
90 SHIM_ALWAYS_EXPORT void __libc_cfree(void* ptr) SHIM_ALIAS_SYMBOL(ShimFree); | 89 SHIM_ALWAYS_EXPORT void __libc_cfree(void* ptr) SHIM_ALIAS_SYMBOL(cfree); |
91 | 90 |
92 SHIM_ALWAYS_EXPORT void* __libc_memalign(size_t align, size_t s) | 91 SHIM_ALWAYS_EXPORT void* __libc_memalign(size_t align, size_t s) |
93 SHIM_ALIAS_SYMBOL(ShimMemalign); | 92 SHIM_ALIAS_SYMBOL(memalign); |
94 | 93 |
95 SHIM_ALWAYS_EXPORT void* __libc_valloc(size_t size) | 94 SHIM_ALWAYS_EXPORT void* __libc_valloc(size_t size) SHIM_ALIAS_SYMBOL(valloc); |
96 SHIM_ALIAS_SYMBOL(ShimValloc); | |
97 | 95 |
98 SHIM_ALWAYS_EXPORT void* __libc_pvalloc(size_t size) | 96 SHIM_ALWAYS_EXPORT void* __libc_pvalloc(size_t size) SHIM_ALIAS_SYMBOL(pvalloc); |
99 SHIM_ALIAS_SYMBOL(ShimPvalloc); | |
100 | 97 |
101 SHIM_ALWAYS_EXPORT int __posix_memalign(void** r, size_t a, size_t s) | 98 SHIM_ALWAYS_EXPORT int __posix_memalign(void** r, size_t a, size_t s) |
102 SHIM_ALIAS_SYMBOL(ShimPosixMemalign); | 99 SHIM_ALIAS_SYMBOL(posix_memalign); |
103 | 100 |
104 } // extern "C" | 101 } // extern "C" |
105 | 102 |
106 // Safety check. | 103 // Safety check. |
107 #if !defined(__GLIBC__) | 104 #if !defined(__GLIBC__) |
108 #error The target platform does not seem to use Glibc. Disable the allocator \ | 105 #error The target platform does not seem to use Glibc. Disable the allocator \ |
109 shim by setting use_experimental_allocator_shim=false in GN args. | 106 shim by setting use_experimental_allocator_shim=false in GN args. |
110 #endif | 107 #endif |
OLD | NEW |