Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop extraneous libc overrides #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions src/jemalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2978,49 +2978,30 @@ JEMALLOC_EXPORT void *(*__memalign_hook)(size_t alignment, size_t size) =
* be implemented also, so none of glibc's malloc.o functions are added to the
* link.
*/
# define ALIAS(je_fn) __attribute__((alias (#je_fn), visibility("default")))
# define ALIAS(je_fn) __attribute__((alias (#je_fn), used))
/* To force macro expansion of je_ prefix before stringification. */
# define PREALIAS(je_fn) ALIAS(je_fn)
# ifdef JEMALLOC_OVERRIDE___LIBC_CALLOC
void *__libc_calloc(size_t n, size_t size) PREALIAS(je_calloc);
void *calloc(size_t n, size_t size) PREALIAS(je_calloc);
# endif
# ifdef JEMALLOC_OVERRIDE___LIBC_FREE
void __libc_free(void* ptr) PREALIAS(je_free);
void free(void* ptr) PREALIAS(je_free);
# endif
# ifdef JEMALLOC_OVERRIDE___LIBC_MALLOC
void *__libc_malloc(size_t size) PREALIAS(je_malloc);
void *malloc(size_t size) PREALIAS(je_malloc);
# endif
# ifdef JEMALLOC_OVERRIDE___LIBC_MEMALIGN
void *__libc_memalign(size_t align, size_t s) PREALIAS(je_memalign);
void *memalign(size_t align, size_t s) PREALIAS(je_memalign);
# endif
# ifdef JEMALLOC_OVERRIDE___LIBC_REALLOC
void *__libc_realloc(void* ptr, size_t size) PREALIAS(je_realloc);
void *realloc(void* ptr, size_t size) PREALIAS(je_realloc);
# endif
# ifdef JEMALLOC_OVERRIDE___LIBC_VALLOC
void *__libc_valloc(size_t size) PREALIAS(je_valloc);
void *valloc(size_t size) PREALIAS(je_valloc);
# endif
# ifdef JEMALLOC_OVERRIDE___POSIX_MEMALIGN
int __posix_memalign(void** r, size_t a, size_t s) PREALIAS(je_posix_memalign);
int posix_memalign(void** r, size_t a, size_t s) PREALIAS(je_posix_memalign);
# endif

void *aligned_alloc(size_t a, size_t s) PREALIAS(je_aligned_alloc);

// If we replace libc malloc and an application calls the malloc_usable_size then we can get a crash
// Symbol doesn't alias exactly so just wrap it
JEMALLOC_EXPORT size_t __malloc_usable_size(void *ptr) {
return je_malloc_usable_size(ptr);
}
JEMALLOC_EXPORT size_t malloc_usable_size(void *ptr) {
return je_malloc_usable_size(ptr);
}

# undef PREALIAS
# undef ALIAS
# endif
Expand Down