From: Siddhesh Poyarekar <siddhesh@sourceware.org>
To: libc-alpha@sourceware.org
Subject: [PATCH] Fix build and tests with --disable-tunables
Date: Fri, 23 Jul 2021 07:55:30 +0530 [thread overview]
Message-ID: <20210723022530.268766-1-siddhesh@sourceware.org> (raw)
In-Reply-To: <87pmvab0cp.fsf@linux.ibm.com>
Remove unused code and declare __libc_mallopt when !IS_IN (libc) to
allow the debug hook to build with --disable-tunables.
Also, run tst-ifunc-isa-2* tests only when tunables are enabled since
the result depends on it.
Tested on x86_64.
Reported-by: Matheus Castanho <msc@linux.ibm.com>
---
It's a trivial non-ABI change that is needed to get --disable-tunables
working correctly, so I'll push this if there are no objections.
malloc/arena.c | 5 -----
malloc/malloc-check.c | 2 ++
malloc/malloc.c | 51 ++++++++++++++++++++++---------------------
sysdeps/x86/Makefile | 8 +++++--
4 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/malloc/arena.c b/malloc/arena.c
index edcaa8816d..667484630e 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -332,7 +332,6 @@ ptmalloc_init (void)
# endif
TUNABLE_GET (mxfast, size_t, TUNABLE_CALLBACK (set_mxfast));
#else
- const char *s = NULL;
if (__glibc_likely (_environ != NULL))
{
char **runp = _environ;
@@ -351,10 +350,6 @@ ptmalloc_init (void)
switch (len)
{
- case 6:
- if (memcmp (envline, "CHECK_", 6) == 0)
- s = &envline[7];
- break;
case 8:
if (!__builtin_expect (__libc_enable_secure, 0))
{
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index a444c7478e..8ed67de3ff 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -376,6 +376,7 @@ memalign_check (size_t alignment, size_t bytes)
return mem2mem_check (tag_new_usable (mem), bytes);
}
+#if HAVE_TUNABLES
static void
TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
{
@@ -383,6 +384,7 @@ TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
if (value != 0)
__malloc_debug_enable (MALLOC_CHECK_HOOK);
}
+#endif
static bool
initialize_malloc_check (void)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 38b649fcba..e065785af7 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -687,31 +687,6 @@ void* __libc_valloc(size_t);
-/*
- mallopt(int parameter_number, int parameter_value)
- Sets tunable parameters The format is to provide a
- (parameter-number, parameter-value) pair. mallopt then sets the
- corresponding parameter to the argument value if it can (i.e., so
- long as the value is meaningful), and returns 1 if successful else
- 0. SVID/XPG/ANSI defines four standard param numbers for mallopt,
- normally defined in malloc.h. Only one of these (M_MXFAST) is used
- in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply,
- so setting them has no effect. But this malloc also supports four
- other options in mallopt. See below for details. Briefly, supported
- parameters are as follows (listed defaults are for "typical"
- configurations).
-
- Symbol param # default allowed param values
- M_MXFAST 1 64 0-80 (0 disables fastbins)
- M_TRIM_THRESHOLD -1 128*1024 any (-1U disables trimming)
- M_TOP_PAD -2 0 any
- M_MMAP_THRESHOLD -3 128*1024 any (or 0 if no MMAP support)
- M_MMAP_MAX -4 65536 any (0 disables use of mmap)
-*/
-int __libc_mallopt(int, int);
-libc_hidden_proto (__libc_mallopt)
-
-
/*
mallinfo()
Returns (by copy) a struct containing various summary statistics:
@@ -820,6 +795,32 @@ void __malloc_stats(void);
int __posix_memalign(void **, size_t, size_t);
#endif /* IS_IN (libc) */
+/*
+ mallopt(int parameter_number, int parameter_value)
+ Sets tunable parameters The format is to provide a
+ (parameter-number, parameter-value) pair. mallopt then sets the
+ corresponding parameter to the argument value if it can (i.e., so
+ long as the value is meaningful), and returns 1 if successful else
+ 0. SVID/XPG/ANSI defines four standard param numbers for mallopt,
+ normally defined in malloc.h. Only one of these (M_MXFAST) is used
+ in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply,
+ so setting them has no effect. But this malloc also supports four
+ other options in mallopt. See below for details. Briefly, supported
+ parameters are as follows (listed defaults are for "typical"
+ configurations).
+
+ Symbol param # default allowed param values
+ M_MXFAST 1 64 0-80 (0 disables fastbins)
+ M_TRIM_THRESHOLD -1 128*1024 any (-1U disables trimming)
+ M_TOP_PAD -2 0 any
+ M_MMAP_THRESHOLD -3 128*1024 any (or 0 if no MMAP support)
+ M_MMAP_MAX -4 65536 any (0 disables use of mmap)
+*/
+int __libc_mallopt(int, int);
+#if IS_IN (libc)
+libc_hidden_proto (__libc_mallopt)
+#endif
+
/* mallopt tuning options */
/*
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index 346ec491b3..bd4f6a13b9 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -19,14 +19,18 @@ ifeq (yes,$(have-ifunc))
ifeq (yes,$(have-gcc-ifunc))
tests += \
tst-ifunc-isa-1 \
- tst-ifunc-isa-1-static \
+ tst-ifunc-isa-1-static
+tests-static += \
+ tst-ifunc-isa-1-static
+ifneq ($(have-tunables),no)
+tests += \
tst-ifunc-isa-2 \
tst-ifunc-isa-2-static
tests-static += \
- tst-ifunc-isa-1-static \
tst-ifunc-isa-2-static
endif
endif
+endif
ifeq (yes,$(enable-x86-isa-level))
tests += tst-isa-level-1
modules-names += tst-isa-level-mod-1-baseline \
--
2.31.1
next prev parent reply other threads:[~2021-07-23 2:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-19 18:46 [PATCH v10 00/11] malloc hooks removal Siddhesh Poyarekar
2021-07-19 18:46 ` [PATCH v10 01/11] Make mcheck tests conditional on GLIBC_2.23 or earlier Siddhesh Poyarekar
2021-07-22 12:26 ` Carlos O'Donell
2021-07-19 18:46 ` [PATCH v10 02/11] Remove __after_morecore_hook Siddhesh Poyarekar
2021-07-19 18:46 ` [PATCH v10 03/11] Remove __morecore and __default_morecore Siddhesh Poyarekar
2021-07-19 18:46 ` [PATCH v10 04/11] Move malloc hooks into a compat DSO Siddhesh Poyarekar
2021-07-22 12:25 ` Carlos O'Donell
2021-07-19 18:46 ` [PATCH v10 05/11] mcheck: Wean away from malloc hooks [BZ #23489] Siddhesh Poyarekar
2021-07-22 19:57 ` Matheus Castanho
2021-07-23 2:25 ` Siddhesh Poyarekar [this message]
2021-07-23 4:55 ` [PATCH] Fix build and tests with --disable-tunables Carlos O'Donell
2021-07-19 18:46 ` [PATCH v10 06/11] Simplify __malloc_initialized Siddhesh Poyarekar
2021-07-19 18:46 ` [PATCH v10 07/11] mtrace: Wean away from malloc hooks Siddhesh Poyarekar
2021-07-19 18:46 ` [PATCH v10 08/11] glibc.malloc.check: " Siddhesh Poyarekar
2021-07-22 12:25 ` Carlos O'Donell
2021-07-19 18:46 ` [PATCH v10 09/11] Move malloc_{g,s}et_state to libc_malloc_debug Siddhesh Poyarekar
2021-07-22 12:25 ` Carlos O'Donell
2021-07-19 18:46 ` [PATCH v10 10/11] Remove malloc hooks [BZ #23328] Siddhesh Poyarekar
2021-07-19 18:46 ` [PATCH v10 11/11] mcheck Fix malloc_usable_size [BZ #22057] Siddhesh Poyarekar
2021-07-21 9:45 ` [PATCH v10 00/11] malloc hooks removal Siddhesh Poyarekar
2021-10-08 21:47 ` Stafford Horne
2021-10-08 22:22 ` DJ Delorie
2021-10-08 23:18 ` Stafford Horne
2021-10-08 23:24 ` DJ Delorie
2021-10-08 23:29 ` Stafford Horne
2021-10-08 23:48 ` Stafford Horne
2021-10-11 2:40 ` Siddhesh Poyarekar
2021-10-11 1:55 ` Siddhesh Poyarekar
2021-10-11 2:19 ` Siddhesh Poyarekar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210723022530.268766-1-siddhesh@sourceware.org \
--to=siddhesh@sourceware.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).