]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix build and tests with --disable-tunables
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Fri, 23 Jul 2021 08:27:56 +0000 (13:57 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Fri, 23 Jul 2021 08:27:56 +0000 (13:57 +0530)
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>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
malloc/arena.c
malloc/malloc-check.c
malloc/malloc.c
sysdeps/x86/Makefile

index edcaa8816d6fd933fd80349d363c30cda37d25b5..667484630ed0afa5152fb324abd58e4c51b173e2 100644 (file)
@@ -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))
                 {
index a444c7478e3fe71de2499d3ce45fecaa6ff3f340..8ed67de3ff5565eee56c94dce4d72031eb950aae 100644 (file)
@@ -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)
index 38b649fcbaf19adb3d8fcae2cdc7c729f7d77264..e065785af77af72c17c773517c15b248b067b4ad 100644 (file)
@@ -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 */
 
 /*
index 346ec491b3b6143d2b28f3d314dc0ec35743ff9d..bd4f6a13b9d37ede48beb46f10ef8a4c5f66b84c 100644 (file)
@@ -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 \