From 5680cf6dc6e25cffa3930e9cb06f6982fcb80209 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Thu, 22 Aug 2024 17:06:58 +0100 Subject: [PATCH] jemalloc: don't expose 3.0 compat symbols Don't provide default linkage for jemalloc 3.0 compatability symbols. We stopped declaring these interfaces with the introduction of jemalloc 4.0 prior to FreeBSD 11.0. Any code using them would have had to declare them manually so stop declaring them and export the symbols directly for compatability. Arguably they should be x86 only as they were never declared on other Tier-1 architectures. Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D46407 --- .../include/jemalloc/jemalloc_FreeBSD.h | 26 +++++++++++-------- lib/libc/stdlib/malloc/Symbol.map | 10 ------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h index 00848c0c48e3ed..dee4679838d824 100644 --- a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h +++ b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h @@ -118,7 +118,6 @@ extern int __isthreaded; #undef je_malloc_stats_print #undef je_allocm #undef je_rallocm -#undef je_sallocm #undef je_dallocm #undef je_nallocm #define je_malloc __malloc @@ -139,11 +138,6 @@ extern int __isthreaded; #define je_mallctlnametomib __mallctlnametomib #define je_mallctlbymib __mallctlbymib #define je_malloc_stats_print __malloc_stats_print -#define je_allocm __allocm -#define je_rallocm __rallocm -#define je_sallocm __sallocm -#define je_dallocm __dallocm -#define je_nallocm __nallocm #define open _open #define read _read #define write _write @@ -183,9 +177,19 @@ __weak_reference(__mallctl, mallctl); __weak_reference(__mallctlnametomib, mallctlnametomib); __weak_reference(__mallctlbymib, mallctlbymib); __weak_reference(__malloc_stats_print, malloc_stats_print); -__weak_reference(__allocm, allocm); -__weak_reference(__rallocm, rallocm); -__weak_reference(__sallocm, sallocm); -__weak_reference(__dallocm, dallocm); -__weak_reference(__nallocm, nallocm); +__weak_reference(je_allocm, weak_allocm); +__weak_reference(je_rallocm, weak_rallocm); +__weak_reference(je_sallocm, weak_sallocm); +__weak_reference(je_dallocm, weak_dallocm); +__weak_reference(je_nallocm, weak_nallocm); +__sym_compat(__allocm, je_allocm, FBSD_1.3); +__sym_compat(__rallocm, je_rallocm, FBSD_1.3); +__sym_compat(__sallocm, je_sallocm, FBSD_1.3); +__sym_compat(__dallocm, je_dallocm, FBSD_1.3); +__sym_compat(__nallocm, je_nallocm, FBSD_1.3); +__sym_compat(allocm, weak_allocm, FBSD_1.3); +__sym_compat(rallocm, weak_rallocm, FBSD_1.3); +__sym_compat(sallocm, weak_sallocm, FBSD_1.3); +__sym_compat(dallocm, weak_dallocm, FBSD_1.3); +__sym_compat(nallocm, weak_nallocm, FBSD_1.3); #endif diff --git a/lib/libc/stdlib/malloc/Symbol.map b/lib/libc/stdlib/malloc/Symbol.map index 15e4f9e6c69c78..d3aa7f3f99886a 100644 --- a/lib/libc/stdlib/malloc/Symbol.map +++ b/lib/libc/stdlib/malloc/Symbol.map @@ -23,11 +23,6 @@ FBSD_1.3 { sallocx; dallocx; nallocx; - allocm; - rallocm; - sallocm; - dallocm; - nallocm; __malloc; __calloc; __realloc; @@ -40,11 +35,6 @@ FBSD_1.3 { __sallocx; __dallocx; __nallocx; - __allocm; - __rallocm; - __sallocm; - __dallocm; - __nallocm; }; FBSD_1.4 {