diff --git a/0002-correct-the-parameter-ordering-for-the-memalign-hook.patch b/0002-correct-the-parameter-ordering-for-the-memalign-hook.patch new file mode 100644 index 0000000000000000000000000000000000000000..8fe462974bf0ea313fdf4d7ec303b5e12dad549d --- /dev/null +++ b/0002-correct-the-parameter-ordering-for-the-memalign-hook.patch @@ -0,0 +1,26 @@ +From a16c8c3c7a49a83b0f61606dcad7bcb201342dff Mon Sep 17 00:00:00 2001 +From: wez +Date: Tue, 6 Apr 2010 00:45:32 +0000 +Subject: [PATCH] correct the parameter ordering for the memalign hook on glibc + systems + +--- + malloc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/malloc.c b/malloc.c +index 7eec207..1ad008e 100644 +--- a/malloc.c ++++ b/malloc.c +@@ -157,7 +157,7 @@ calloc(size_t nelem, size_t elsize) + */ + + #ifdef __GLIBC__ +-static void *umem_memalign_hook(size_t size_arg, size_t align, const void *caller) ++static void *umem_memalign_hook(size_t align, size_t size_arg, const void *caller) + #else + void * + memalign(size_t align, size_t size_arg) +-- +2.27.0 + diff --git a/0003-Apparently-the-glibc-malloc-hooks-are-now-deprecated.patch b/0003-Apparently-the-glibc-malloc-hooks-are-now-deprecated.patch new file mode 100644 index 0000000000000000000000000000000000000000..b3420e50545f20c6e9269c295ea8438631e79b6b --- /dev/null +++ b/0003-Apparently-the-glibc-malloc-hooks-are-now-deprecated.patch @@ -0,0 +1,137 @@ +From a99f53d401219d59363ea4f10104a6a566813a99 Mon Sep 17 00:00:00 2001 +From: wez +Date: Fri, 30 Apr 2010 21:31:37 +0000 +Subject: [PATCH] Apparently, the glibc malloc hooks are now deprecated due to + thread safety issues, so we simply eliminate the glibc specific code from our + malloc preload to resolve this issue. + +--- + malloc.c | 40 ---------------------------------------- + 1 file changed, 40 deletions(-) + +diff --git a/malloc.c b/malloc.c +index 1ad008e..6596db7 100644 +--- a/malloc.c ++++ b/malloc.c +@@ -41,10 +41,6 @@ + + #include "misc.h" + +-#ifdef __GLIBC__ +-# include +-#endif +- + /* + * malloc_data_t is an 8-byte structure which is located "before" the pointer + * returned from {m,c,re}alloc and memalign. The first four bytes give +@@ -62,12 +58,8 @@ typedef struct malloc_data { + uint32_t malloc_stat; /* = UMEM_MALLOC_ENCODE(state, malloc_size) */ + } malloc_data_t; + +-#ifdef __GLIBC__ +-static void *umem_malloc_hook(size_t size_arg, const void *caller) +-#else + void * + malloc(size_t size_arg) +-#endif + { + #ifdef _LP64 + uint32_t high_size = 0; +@@ -128,7 +120,6 @@ malloc(size_t size_arg) + return ((void *)ret); + } + +-#ifndef __GLIBC__ + void * + calloc(size_t nelem, size_t elsize) + { +@@ -147,7 +138,6 @@ calloc(size_t nelem, size_t elsize) + (void) memset(retval, 0, size); + return (retval); + } +-#endif + + /* + * memalign uses vmem_xalloc to do its work. +@@ -156,12 +146,8 @@ calloc(size_t nelem, size_t elsize) + * code. + */ + +-#ifdef __GLIBC__ +-static void *umem_memalign_hook(size_t align, size_t size_arg, const void *caller) +-#else + void * + memalign(size_t align, size_t size_arg) +-#endif + { + size_t size; + uintptr_t phase; +@@ -240,13 +226,11 @@ memalign(size_t align, size_t size_arg) + return ((void *)ret); + } + +-#ifndef __GLIBC__ + void * + valloc(size_t size) + { + return (memalign(pagesize, size)); + } +-#endif + + /* + * process_free: +@@ -392,12 +376,8 @@ process_memalign: + return (1); + } + +-#ifdef __GLIBC__ +-static void umem_free_hook(void *buf, const void *caller) +-#else + void + free(void *buf) +-#endif + { + if (buf == NULL) + return; +@@ -408,12 +388,8 @@ free(void *buf) + (void) process_free(buf, 1, NULL); + } + +-#ifdef __GLIBC__ +-static void *umem_realloc_hook(void *buf_arg, size_t newsize, const void *caller) +-#else + void * + realloc(void *buf_arg, size_t newsize) +-#endif + { + size_t oldsize; + void *buf; +@@ -441,25 +417,9 @@ realloc(void *buf_arg, size_t newsize) + return (buf); + } + +-#ifdef __GLIBC__ +-static void __attribute__((constructor)) umem_malloc_init_hook(void) +-{ +- if (__malloc_hook != umem_malloc_hook) { +- umem_startup(NULL, 0, 0, NULL, NULL); +- __malloc_hook = umem_malloc_hook; +- __free_hook = umem_free_hook; +- __realloc_hook = umem_realloc_hook; +- __memalign_hook = umem_memalign_hook; +- } +-} +- +-void (*__malloc_initialize_hook)(void) = umem_malloc_init_hook; +- +-#else + void __attribute__((constructor)) + __malloc_umem_init (void) + { + umem_startup(NULL, 0, 0, NULL, NULL); + } +-#endif + +-- +2.27.0 + diff --git a/libumem.spec b/libumem.spec index 7841222c0c75bcc9cceebadae4335622088832dd..75d57f710fbe177fde9c1fa2a43b7276a8e17c25 100644 --- a/libumem.spec +++ b/libumem.spec @@ -3,7 +3,7 @@ Name: libumem Version: 1.0 -Release: 3 +Release: 4 Summary: Port of Solaris's slab allocator. Group: System Environment/Libraries @@ -11,6 +11,8 @@ License: CDDL-1.0 URL: https://github.com/omniti-labs/portableumem Source0: %{name}-%{version}.tar.gz Patch9000: 0001-Fix-build-problem-on-linux.patch +Patch9001: 0002-correct-the-parameter-ordering-for-the-memalign-hook.patch +Patch9002: 0003-Apparently-the-glibc-malloc-hooks-are-now-deprecated.patch BuildRequires: autoconf >= 2.50 BuildRequires: automake >= 1.4 @@ -105,6 +107,9 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/pkgconfig/*.pc %changelog +* Thu Dec 29 2022 luocheng - 1.0-4 +- Fix build error in glibc 2.34 + * Wed Jul 20 2022 Chenyx - 1.0-3 - License compliance rectification