b1dca6
commit 3a0ecccb599a6b1ad4b149dc569c0080e92d057b
b1dca6
Author: Florian Weimer <fweimer@redhat.com>
b1dca6
Date:   Sat Feb 8 19:58:43 2020 +0100
b1dca6
b1dca6
    ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]
b1dca6
    
b1dca6
    Exporting functions and relying on symbol interposition from libc.so
b1dca6
    makes the choice of implementation dependent on DT_NEEDED order, which
b1dca6
    is not what some compiler drivers expect.
b1dca6
    
b1dca6
    This commit replaces one magic mechanism (symbol interposition) with
b1dca6
    another one (preprocessor-/compiler-based redirection).  This makes
b1dca6
    the hand-over from the minimal malloc to the full malloc more
b1dca6
    explicit.
b1dca6
    
b1dca6
    Removing the ABI symbols is backwards-compatible because libc.so is
b1dca6
    always in scope, and the dynamic loader will find the malloc-related
b1dca6
    symbols there since commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c
b1dca6
    ("ld.so: Support moving versioned symbols between sonames
b1dca6
    [BZ #24741]").
b1dca6
    
b1dca6
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
b1dca6
b1dca6
Conflicts:
b1dca6
	sysdeps/unix/sysv/linux/arm/le/ld.abilist
b1dca6
	sysdeps/unix/sysv/linux/sh/le/ld.abilist
b1dca6
	  (Missing abilist split.)
b1dca6
	sysdeps/unix/sysv/linux/csky/ld.abilist
b1dca6
	sysdeps/unix/sysv/linux/csky/localplt.data
b1dca6
	  (Missing architecture.)
b1dca6
b1dca6
diff --git a/elf/Makefile b/elf/Makefile
b1dca6
index a1ea44f231d8cec5..5b0aeccb0a53c182 100644
b1dca6
--- a/elf/Makefile
b1dca6
+++ b/elf/Makefile
b1dca6
@@ -478,7 +478,11 @@ $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
b1dca6
 # their implementation is provided differently in rtld, and the symbol
b1dca6
 # discovery mechanism is not compatible with the libc implementation
b1dca6
 # when compiled for libc.
b1dca6
-rtld-stubbed-symbols =
b1dca6
+rtld-stubbed-symbols = \
b1dca6
+  calloc \
b1dca6
+  free \
b1dca6
+  malloc \
b1dca6
+  realloc \
b1dca6
 
b1dca6
 # The GCC arguments that implement $(rtld-stubbed-symbols).
b1dca6
 rtld-stubbed-symbols-args = \
b1dca6
diff --git a/elf/Versions b/elf/Versions
b1dca6
index 3b09901f6c31e3d4..705489fc51f4ac5f 100644
b1dca6
--- a/elf/Versions
b1dca6
+++ b/elf/Versions
b1dca6
@@ -35,9 +35,6 @@ libc {
b1dca6
 
b1dca6
 ld {
b1dca6
   GLIBC_2.0 {
b1dca6
-    # Functions which are interposed from libc.so.
b1dca6
-    calloc; free; malloc; realloc;
b1dca6
-
b1dca6
     _r_debug;
b1dca6
   }
b1dca6
   GLIBC_2.1 {
b1dca6
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
b1dca6
index 42fdaed99296137f..e4c479de9a1fd6ec 100644
b1dca6
--- a/elf/dl-lookup.c
b1dca6
+++ b/elf/dl-lookup.c
b1dca6
@@ -291,7 +291,7 @@ do_lookup_unique (const char *undef_name, uint_fast32_t new_hash,
b1dca6
 	  tab->size = newsize;
b1dca6
 	  size = newsize;
b1dca6
 	  entries = tab->entries = newentries;
b1dca6
-	  tab->free = free;
b1dca6
+	  tab->free = __rtld_free;
b1dca6
 	}
b1dca6
     }
b1dca6
   else
b1dca6
@@ -322,7 +322,7 @@ do_lookup_unique (const char *undef_name, uint_fast32_t new_hash,
b1dca6
 
b1dca6
       tab->entries = entries;
b1dca6
       tab->size = size;
b1dca6
-      tab->free = free;
b1dca6
+      tab->free = __rtld_free;
b1dca6
     }
b1dca6
 
b1dca6
   if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
b1dca6
diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
b1dca6
index 25ceded6fe120b07..95ea7b024044864f 100644
b1dca6
--- a/elf/dl-minimal.c
b1dca6
+++ b/elf/dl-minimal.c
b1dca6
@@ -26,11 +26,87 @@
b1dca6
 #include <sys/param.h>
b1dca6
 #include <sys/types.h>
b1dca6
 #include <ldsodefs.h>
b1dca6
+#include <dl-irel.h>
b1dca6
+#include <dl-hash.h>
b1dca6
+#include <dl-sym-post.h>
b1dca6
 #include <_itoa.h>
b1dca6
 #include <malloc/malloc-internal.h>
b1dca6
 
b1dca6
 #include <assert.h>
b1dca6
 
b1dca6
+/* The rtld startup code calls __rtld_malloc_init_stubs after the
b1dca6
+  first self-relocation to adjust the pointers to the minimal
b1dca6
+  implementation below.  Before the final relocation,
b1dca6
+  __rtld_malloc_init_real is called to replace the pointers with the
b1dca6
+  real implementation.  */
b1dca6
+__typeof (calloc) *__rtld_calloc;
b1dca6
+__typeof (free) *__rtld_free;
b1dca6
+__typeof (malloc) *__rtld_malloc;
b1dca6
+__typeof (realloc) *__rtld_realloc;
b1dca6
+
b1dca6
+/* Defined below.  */
b1dca6
+static __typeof (calloc) rtld_calloc attribute_relro;
b1dca6
+static __typeof (free) rtld_free attribute_relro;
b1dca6
+static __typeof (malloc) rtld_malloc attribute_relro;
b1dca6
+static __typeof (realloc) rtld_realloc attribute_relro;
b1dca6
+
b1dca6
+void
b1dca6
+__rtld_malloc_init_stubs (void)
b1dca6
+{
b1dca6
+  __rtld_calloc = &rtld_calloc;
b1dca6
+  __rtld_free = &rtld_free;
b1dca6
+  __rtld_malloc = &rtld_malloc;
b1dca6
+  __rtld_realloc = &rtld_realloc;
b1dca6
+}
b1dca6
+
b1dca6
+/* Lookup NAME at VERSION in the scope of MATCH.  */
b1dca6
+static void *
b1dca6
+lookup_malloc_symbol (struct link_map *main_map, const char *name,
b1dca6
+		      struct r_found_version *version)
b1dca6
+{
b1dca6
+
b1dca6
+  const ElfW(Sym) *ref = NULL;
b1dca6
+  lookup_t result = _dl_lookup_symbol_x (name, main_map, &ref,
b1dca6
+					 main_map->l_scope,
b1dca6
+					 version, 0, 0, NULL);
b1dca6
+
b1dca6
+  assert (ELFW(ST_TYPE) (ref->st_info) != STT_TLS);
b1dca6
+  void *value = DL_SYMBOL_ADDRESS (result, ref);
b1dca6
+
b1dca6
+  return _dl_sym_post (result, ref, value, 0, main_map);
b1dca6
+}
b1dca6
+
b1dca6
+void
b1dca6
+__rtld_malloc_init_real (struct link_map *main_map)
b1dca6
+{
b1dca6
+  /* We cannot use relocations and initializers for this because the
b1dca6
+     changes made by __rtld_malloc_init_stubs break REL-style
b1dca6
+     (non-RELA) relocations that depend on the previous pointer
b1dca6
+     contents.  Also avoid direct relocation depedencies for the
b1dca6
+     malloc symbols so this function can be called before the final
b1dca6
+     rtld relocation (which enables RELRO, after which the pointer
b1dca6
+     variables cannot be written to).  */
b1dca6
+
b1dca6
+  struct r_found_version version;
b1dca6
+  version.name = symbol_version_string (libc, GLIBC_2_0);
b1dca6
+  version.hidden = 0;
b1dca6
+  version.hash = _dl_elf_hash (version.name);
b1dca6
+  version.filename = NULL;
b1dca6
+
b1dca6
+  void *new_calloc = lookup_malloc_symbol (main_map, "calloc", &version);
b1dca6
+  void *new_free = lookup_malloc_symbol (main_map, "free", &version);
b1dca6
+  void *new_malloc = lookup_malloc_symbol (main_map, "malloc", &version);
b1dca6
+  void *new_realloc = lookup_malloc_symbol (main_map, "realloc", &version);
b1dca6
+
b1dca6
+  /* Update the pointers in one go, so that any internal allocations
b1dca6
+     performed by lookup_malloc_symbol see a consistent
b1dca6
+     implementation.  */
b1dca6
+  __rtld_calloc = new_calloc;
b1dca6
+  __rtld_free = new_free;
b1dca6
+  __rtld_malloc = new_malloc;
b1dca6
+  __rtld_realloc = new_realloc;
b1dca6
+}
b1dca6
+
b1dca6
 /* Minimal malloc allocator for used during initial link.  After the
b1dca6
    initial link, a full malloc implementation is interposed, either
b1dca6
    the one in libc, or a different one supplied by the user through
b1dca6
@@ -38,14 +114,9 @@
b1dca6
 
b1dca6
 static void *alloc_ptr, *alloc_end, *alloc_last_block;
b1dca6
 
b1dca6
-/* Declarations of global functions.  */
b1dca6
-extern void weak_function free (void *ptr);
b1dca6
-extern void * weak_function realloc (void *ptr, size_t n);
b1dca6
-
b1dca6
-
b1dca6
 /* Allocate an aligned memory block.  */
b1dca6
-void * weak_function
b1dca6
-malloc (size_t n)
b1dca6
+static void *
b1dca6
+rtld_malloc (size_t n)
b1dca6
 {
b1dca6
   if (alloc_end == 0)
b1dca6
     {
b1dca6
@@ -87,8 +158,8 @@ malloc (size_t n)
b1dca6
 /* We use this function occasionally since the real implementation may
b1dca6
    be optimized when it can assume the memory it returns already is
b1dca6
    set to NUL.  */
b1dca6
-void * weak_function
b1dca6
-calloc (size_t nmemb, size_t size)
b1dca6
+static void *
b1dca6
+rtld_calloc (size_t nmemb, size_t size)
b1dca6
 {
b1dca6
   /* New memory from the trivial malloc above is always already cleared.
b1dca6
      (We make sure that's true in the rare occasion it might not be,
b1dca6
@@ -104,8 +175,8 @@ calloc (size_t nmemb, size_t size)
b1dca6
 }
b1dca6
 
b1dca6
 /* This will rarely be called.  */
b1dca6
-void weak_function
b1dca6
-free (void *ptr)
b1dca6
+void
b1dca6
+rtld_free (void *ptr)
b1dca6
 {
b1dca6
   /* We can free only the last block allocated.  */
b1dca6
   if (ptr == alloc_last_block)
b1dca6
@@ -118,8 +189,8 @@ free (void *ptr)
b1dca6
 }
b1dca6
 
b1dca6
 /* This is only called with the most recent block returned by malloc.  */
b1dca6
-void * weak_function
b1dca6
-realloc (void *ptr, size_t n)
b1dca6
+void *
b1dca6
+rtld_realloc (void *ptr, size_t n)
b1dca6
 {
b1dca6
   if (ptr == NULL)
b1dca6
     return malloc (n);
b1dca6
diff --git a/elf/rtld.c b/elf/rtld.c
b1dca6
index 18335bc666f2b89d..f755dc30331f799f 100644
b1dca6
--- a/elf/rtld.c
b1dca6
+++ b/elf/rtld.c
b1dca6
@@ -532,6 +532,9 @@ _dl_start (void *arg)
b1dca6
      header table in core.  Put the rest of _dl_start into a separate
b1dca6
      function, that way the compiler cannot put accesses to the GOT
b1dca6
      before ELF_DYNAMIC_RELOCATE.  */
b1dca6
+
b1dca6
+  __rtld_malloc_init_stubs ();
b1dca6
+
b1dca6
   {
b1dca6
 #ifdef DONT_USE_BOOTSTRAP_MAP
b1dca6
     ElfW(Addr) entry = _dl_start_final (arg);
b1dca6
@@ -2203,6 +2206,10 @@ ERROR: '%s': cannot process note segment.\n", _dl_argv[0]);
b1dca6
 	  rtld_timer_stop (&relocate_time, start);
b1dca6
 	}
b1dca6
 
b1dca6
+      /* The library defining malloc has already been relocated due to
b1dca6
+	 prelinking.  Resolve the malloc symbols for the dynamic
b1dca6
+	 loader.  */
b1dca6
+      __rtld_malloc_init_real (main_map);
b1dca6
 
b1dca6
       /* Mark all the objects so we know they have been already relocated.  */
b1dca6
       for (struct link_map *l = main_map; l != NULL; l = l->l_next)
b1dca6
@@ -2303,6 +2310,11 @@ ERROR: '%s': cannot process note segment.\n", _dl_argv[0]);
b1dca6
 	 re-relocation, we might call a user-supplied function
b1dca6
 	 (e.g. calloc from _dl_relocate_object) that uses TLS data.  */
b1dca6
 
b1dca6
+      /* The malloc implementation has been relocated, so resolving
b1dca6
+	 its symbols (and potentially calling IFUNC resolvers) is safe
b1dca6
+	 at this point.  */
b1dca6
+      __rtld_malloc_init_real (main_map);
b1dca6
+
b1dca6
       RTLD_TIMING_VAR (start);
b1dca6
       rtld_timer_start (&start;;
b1dca6
 
b1dca6
diff --git a/include/inline-hashtab.h b/include/inline-hashtab.h
b1dca6
index ad73650ecc59dec1..b658e4a54b9c8187 100644
b1dca6
--- a/include/inline-hashtab.h
b1dca6
+++ b/include/inline-hashtab.h
b1dca6
@@ -53,7 +53,7 @@ htab_create (void)
b1dca6
     return NULL;
b1dca6
   ht->size = 3;
b1dca6
   ht->entries = malloc (sizeof (void *) * ht->size);
b1dca6
-  ht->free = free;
b1dca6
+  ht->free = __rtld_free;
b1dca6
   if (! ht->entries)
b1dca6
     {
b1dca6
       if (ht->free)
b1dca6
@@ -172,7 +172,7 @@ htab_expand (struct hashtab *htab, int (*hash_fn) (void *))
b1dca6
 
b1dca6
   /* Use the free() corresponding to the malloc() above to free this
b1dca6
      up.  */
b1dca6
-  htab->free = free;
b1dca6
+  htab->free = __rtld_free;
b1dca6
 
b1dca6
   return 1;
b1dca6
 }
b1dca6
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
b1dca6
index 8b9273c13a19f265..41436050d060b89f 100644
b1dca6
--- a/include/libc-symbols.h
b1dca6
+++ b/include/libc-symbols.h
b1dca6
@@ -413,7 +413,14 @@ for linking")
b1dca6
 #  define _default_symbol_version(real, name, version) \
b1dca6
      __asm__ (".symver " #real "," #name "@@" #version)
b1dca6
 # endif
b1dca6
-#else
b1dca6
+
b1dca6
+/* Evalutes to a string literal for VERSION in LIB.  */
b1dca6
+# define symbol_version_string(lib, version) \
b1dca6
+  _symbol_version_stringify_1 (VERSION_##lib##_##version)
b1dca6
+# define _symbol_version_stringify_1(arg) _symbol_version_stringify_2 (arg)
b1dca6
+# define _symbol_version_stringify_2(arg) #arg
b1dca6
+
b1dca6
+#else /* !SHARED */
b1dca6
 # define symbol_version(real, name, version)
b1dca6
 # define default_symbol_version(real, name, version) \
b1dca6
   strong_alias(real, name)
b1dca6
diff --git a/include/malloc.h b/include/malloc.h
b1dca6
index d4cd9a5ffc929a96..e528718ac0734e5e 100644
b1dca6
--- a/include/malloc.h
b1dca6
+++ b/include/malloc.h
b1dca6
@@ -1,7 +1,9 @@
b1dca6
 #ifndef _MALLOC_H
b1dca6
+
b1dca6
 #include <malloc/malloc.h>
b1dca6
 
b1dca6
 # ifndef _ISOMAC
b1dca6
+#  include <rtld-malloc.h>
b1dca6
 
b1dca6
 /* In the GNU libc we rename the global variable
b1dca6
    `__malloc_initialized' to `__libc_malloc_initialized'.  */
b1dca6
diff --git a/include/rtld-malloc.h b/include/rtld-malloc.h
b1dca6
new file mode 100644
b1dca6
index 0000000000000000..b026a3270cd24819
b1dca6
--- /dev/null
b1dca6
+++ b/include/rtld-malloc.h
b1dca6
@@ -0,0 +1,85 @@
b1dca6
+/* Redirection of malloc inside the dynamic linker.
b1dca6
+   Copyright (C) 2020 Free Software Foundation, Inc.
b1dca6
+   This file is part of the GNU C Library.
b1dca6
+
b1dca6
+   The GNU C Library is free software; you can redistribute it and/or
b1dca6
+   modify it under the terms of the GNU Lesser General Public
b1dca6
+   License as published by the Free Software Foundation; either
b1dca6
+   version 2.1 of the License, or (at your option) any later version.
b1dca6
+
b1dca6
+   The GNU C Library is distributed in the hope that it will be useful,
b1dca6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
b1dca6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b1dca6
+   Lesser General Public License for more details.
b1dca6
+
b1dca6
+   You should have received a copy of the GNU Lesser General Public
b1dca6
+   License along with the GNU C Library; if not, see
b1dca6
+   <https://www.gnu.org/licenses/>.  */
b1dca6
+
b1dca6
+/* The dynamic linker needs to use its own minimal malloc before libc
b1dca6
+   has been relocated, and the libc malloc afterwards.  The active
b1dca6
+   malloc implementation is reached via the __rtld_* function pointers
b1dca6
+   declared below.  They are initialized to the minimal malloc by
b1dca6
+   __rtld_malloc_init_stubs, and set to the final implementation by
b1dca6
+   __rtld_malloc_init_real.  */
b1dca6
+
b1dca6
+#ifndef _RTLD_MALLOC_H
b1dca6
+#define _RTLD_MALLOC_H
b1dca6
+
b1dca6
+#if IS_IN (rtld)
b1dca6
+
b1dca6
+extern __typeof (calloc) *__rtld_calloc attribute_hidden;
b1dca6
+extern __typeof (free) *__rtld_free attribute_hidden;
b1dca6
+extern __typeof (malloc) *__rtld_malloc attribute_hidden;
b1dca6
+extern __typeof (realloc) *__rtld_realloc attribute_hidden;
b1dca6
+
b1dca6
+/* Wrapper functions which call through the function pointers above.
b1dca6
+   Note that it is not supported to take the address of those
b1dca6
+   functions.  Instead the function pointers must be used
b1dca6
+   directly.  */
b1dca6
+
b1dca6
+__extern_inline void *
b1dca6
+calloc (size_t a, size_t b)
b1dca6
+{
b1dca6
+  return __rtld_calloc (a, b);
b1dca6
+}
b1dca6
+
b1dca6
+__extern_inline void
b1dca6
+free (void *ptr)
b1dca6
+{
b1dca6
+   __rtld_free (ptr);
b1dca6
+}
b1dca6
+
b1dca6
+__extern_inline void *
b1dca6
+malloc (size_t size)
b1dca6
+{
b1dca6
+  return __rtld_malloc (size);
b1dca6
+}
b1dca6
+
b1dca6
+__extern_inline void *
b1dca6
+realloc (void *ptr, size_t size)
b1dca6
+{
b1dca6
+  return __rtld_realloc (ptr, size);
b1dca6
+}
b1dca6
+
b1dca6
+/* Called after the first self-relocation to activate the minimal malloc
b1dca6
+   implementation.  */
b1dca6
+void __rtld_malloc_init_stubs (void) attribute_hidden;
b1dca6
+
b1dca6
+/* Called shortly before the final self-relocation (when RELRO
b1dca6
+   variables are still writable) to activate the real malloc
b1dca6
+   implementation.  MAIN_MAP is the link map of the executable.  */
b1dca6
+struct link_map;
b1dca6
+void __rtld_malloc_init_real (struct link_map *main_map) attribute_hidden;
b1dca6
+
b1dca6
+#else /* !IS_IN (rtld) */
b1dca6
+
b1dca6
+/* This allows static/non-rtld builds to get a pointer to the
b1dca6
+   functions, in the same way that is required inside rtld.  */
b1dca6
+# define __rtld_calloc (&calloc)
b1dca6
+# define __rtld_free (&free)
b1dca6
+# define __rtld_malloc (&malloc)
b1dca6
+# define __rtld_realloc (&realloc)
b1dca6
+
b1dca6
+#endif /* !IS_IN (rtld) */
b1dca6
+#endif /* _RTLD_MALLOC_H */
b1dca6
diff --git a/include/stdlib.h b/include/stdlib.h
b1dca6
index 114e12d255977676..d7720967448f2a8f 100644
b1dca6
--- a/include/stdlib.h
b1dca6
+++ b/include/stdlib.h
b1dca6
@@ -9,6 +9,8 @@
b1dca6
 #if !defined _ISOMAC
b1dca6
 # include <sys/stat.h>
b1dca6
 
b1dca6
+# include <rtld-malloc.h>
b1dca6
+
b1dca6
 extern __typeof (strtol_l) __strtol_l;
b1dca6
 extern __typeof (strtoul_l) __strtoul_l;
b1dca6
 extern __typeof (strtoll_l) __strtoll_l;
b1dca6
diff --git a/sysdeps/generic/localplt.data b/sysdeps/generic/localplt.data
b1dca6
index 2d5c66ae28a2e851..e2083c0ce6869572 100644
b1dca6
--- a/sysdeps/generic/localplt.data
b1dca6
+++ b/sysdeps/generic/localplt.data
b1dca6
@@ -7,12 +7,6 @@ libc.so: malloc
b1dca6
 libc.so: memalign
b1dca6
 libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/mach/hurd/i386/ld.abilist b/sysdeps/mach/hurd/i386/ld.abilist
b1dca6
index c76b913486acf6d8..6f591b249699e10c 100644
b1dca6
--- a/sysdeps/mach/hurd/i386/ld.abilist
b1dca6
+++ b/sysdeps/mach/hurd/i386/ld.abilist
b1dca6
@@ -16,10 +16,6 @@ GLIBC_2.2.6 _dl_mcount F
b1dca6
 GLIBC_2.2.6 _hurd_intr_rpc_mach_msg F
b1dca6
 GLIBC_2.2.6 _r_debug D 0x14
b1dca6
 GLIBC_2.2.6 abort F
b1dca6
-GLIBC_2.2.6 calloc F
b1dca6
-GLIBC_2.2.6 free F
b1dca6
-GLIBC_2.2.6 malloc F
b1dca6
-GLIBC_2.2.6 realloc F
b1dca6
 GLIBC_2.3 ___tls_get_addr F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
 GLIBC_2.4 __stack_chk_guard D 0x4
b1dca6
diff --git a/sysdeps/mach/hurd/i386/localplt.data b/sysdeps/mach/hurd/i386/localplt.data
b1dca6
index a5b5241b84812425..4b9dbf5acc088cff 100644
b1dca6
--- a/sysdeps/mach/hurd/i386/localplt.data
b1dca6
+++ b/sysdeps/mach/hurd/i386/localplt.data
b1dca6
@@ -9,12 +9,6 @@ libc.so: malloc + REL R_386_GLOB_DAT
b1dca6
 libc.so: memalign + REL R_386_GLOB_DAT
b1dca6
 libc.so: realloc + REL R_386_GLOB_DAT
b1dca6
 libm.so: matherr + REL R_386_GLOB_DAT
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc + REL R_386_GLOB_DAT
b1dca6
-ld.so: calloc + REL R_386_GLOB_DAT
b1dca6
-ld.so: realloc + REL R_386_GLOB_DAT
b1dca6
-ld.so: free + REL R_386_GLOB_DAT
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error + REL R_386_GLOB_DAT
b1dca6
 ld.so: _dl_catch_error + REL R_386_GLOB_DAT
b1dca6
diff --git a/sysdeps/unix/sysv/linux/aarch64/ld.abilist b/sysdeps/unix/sysv/linux/aarch64/ld.abilist
b1dca6
index 4ffe688649ca02e2..80b2fe672541c6e9 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/aarch64/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/aarch64/ld.abilist
b1dca6
@@ -3,7 +3,3 @@ GLIBC_2.17 __stack_chk_guard D 0x8
b1dca6
 GLIBC_2.17 __tls_get_addr F
b1dca6
 GLIBC_2.17 _dl_mcount F
b1dca6
 GLIBC_2.17 _r_debug D 0x28
b1dca6
-GLIBC_2.17 calloc F
b1dca6
-GLIBC_2.17 free F
b1dca6
-GLIBC_2.17 malloc F
b1dca6
-GLIBC_2.17 realloc F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/aarch64/localplt.data b/sysdeps/unix/sysv/linux/aarch64/localplt.data
b1dca6
index 08af68b5e840b5d8..2c14b652efbfdf44 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/aarch64/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/aarch64/localplt.data
b1dca6
@@ -12,12 +12,6 @@ libm.so: matherr
b1dca6
 libc.so: __getauxval ?
b1dca6
 # The dynamic loader needs __tls_get_addr for TLS.
b1dca6
 ld.so: __tls_get_addr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/alpha/ld.abilist b/sysdeps/unix/sysv/linux/alpha/ld.abilist
b1dca6
index 98b66edabf1a79c7..98a03f611f98f3a4 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/alpha/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/alpha/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.0 _r_debug D 0x28
b1dca6
-GLIBC_2.0 calloc F
b1dca6
-GLIBC_2.0 free F
b1dca6
-GLIBC_2.0 malloc F
b1dca6
-GLIBC_2.0 realloc F
b1dca6
 GLIBC_2.1 __libc_stack_end D 0x8
b1dca6
 GLIBC_2.1 _dl_mcount F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/alpha/localplt.data b/sysdeps/unix/sysv/linux/alpha/localplt.data
b1dca6
index c69eb04ce53e292e..43f6fdaea18b25f3 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/alpha/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/alpha/localplt.data
b1dca6
@@ -26,12 +26,6 @@ libm.so: matherr + RELA R_ALPHA_GLOB_DAT
b1dca6
 libm.so: __atan2
b1dca6
 # The dynamic loader needs __tls_get_addr for TLS.
b1dca6
 ld.so: __tls_get_addr ?
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc + RELA R_ALPHA_GLOB_DAT
b1dca6
-ld.so: calloc + RELA R_ALPHA_GLOB_DAT
b1dca6
-ld.so: realloc + RELA R_ALPHA_GLOB_DAT
b1dca6
-ld.so: free + RELA R_ALPHA_GLOB_DAT
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error + RELA R_ALPHA_GLOB_DAT
b1dca6
 ld.so: _dl_catch_error + RELA R_ALPHA_GLOB_DAT
b1dca6
diff --git a/sysdeps/unix/sysv/linux/arm/ld.abilist b/sysdeps/unix/sysv/linux/arm/ld.abilist
b1dca6
index a301c6ebc49db1d7..cc8825c3bc68ad4a 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/arm/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/arm/ld.abilist
b1dca6
@@ -3,7 +3,3 @@ GLIBC_2.4 __stack_chk_guard D 0x4
b1dca6
 GLIBC_2.4 __tls_get_addr F
b1dca6
 GLIBC_2.4 _dl_mcount F
b1dca6
 GLIBC_2.4 _r_debug D 0x14
b1dca6
-GLIBC_2.4 calloc F
b1dca6
-GLIBC_2.4 free F
b1dca6
-GLIBC_2.4 malloc F
b1dca6
-GLIBC_2.4 realloc F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/arm/localplt.data b/sysdeps/unix/sysv/linux/arm/localplt.data
b1dca6
index 7bd541c28a842526..0c3af0c64e95df4b 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/arm/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/arm/localplt.data
b1dca6
@@ -8,12 +8,6 @@ libm.so: matherr
b1dca6
 libpthread.so: raise
b1dca6
 # The dynamic loader needs __tls_get_addr for TLS.
b1dca6
 ld.so: __tls_get_addr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/hppa/ld.abilist b/sysdeps/unix/sysv/linux/hppa/ld.abilist
b1dca6
index 0387614d8fd784eb..d155a59843df9091 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/hppa/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/hppa/ld.abilist
b1dca6
@@ -1,9 +1,5 @@
b1dca6
 GLIBC_2.2 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.2 _dl_mcount F
b1dca6
 GLIBC_2.2 _r_debug D 0x14
b1dca6
-GLIBC_2.2 calloc F
b1dca6
-GLIBC_2.2 free F
b1dca6
-GLIBC_2.2 malloc F
b1dca6
-GLIBC_2.2 realloc F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
 GLIBC_2.4 __stack_chk_guard D 0x4
b1dca6
diff --git a/sysdeps/unix/sysv/linux/hppa/localplt.data b/sysdeps/unix/sysv/linux/hppa/localplt.data
b1dca6
index 867413f0c54d3d71..09893d4dcfd3a1f3 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/hppa/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/hppa/localplt.data
b1dca6
@@ -10,12 +10,6 @@ libc.so: __sigsetjmp
b1dca6
 libc.so: _IO_funlockfile
b1dca6
 libc.so: __errno_location
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/i386/ld.abilist b/sysdeps/unix/sysv/linux/i386/ld.abilist
b1dca6
index edb7307228110c33..0478e220712a55e6 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/i386/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/i386/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.0 _r_debug D 0x14
b1dca6
-GLIBC_2.0 calloc F
b1dca6
-GLIBC_2.0 free F
b1dca6
-GLIBC_2.0 malloc F
b1dca6
-GLIBC_2.0 realloc F
b1dca6
 GLIBC_2.1 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.1 _dl_mcount F
b1dca6
 GLIBC_2.3 ___tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/i386/localplt.data b/sysdeps/unix/sysv/linux/i386/localplt.data
b1dca6
index f6f20a5d15bc79e4..5334875b4b4a4dee 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/i386/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/i386/localplt.data
b1dca6
@@ -7,12 +7,6 @@ libc.so: malloc + REL R_386_GLOB_DAT
b1dca6
 libc.so: memalign + REL R_386_GLOB_DAT
b1dca6
 libc.so: realloc + REL R_386_GLOB_DAT
b1dca6
 libm.so: matherr + REL R_386_GLOB_DAT
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc + REL R_386_GLOB_DAT
b1dca6
-ld.so: calloc + REL R_386_GLOB_DAT
b1dca6
-ld.so: realloc + REL R_386_GLOB_DAT
b1dca6
-ld.so: free + REL R_386_GLOB_DAT
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error + REL R_386_GLOB_DAT
b1dca6
 ld.so: _dl_catch_error + REL R_386_GLOB_DAT
b1dca6
diff --git a/sysdeps/unix/sysv/linux/ia64/ld.abilist b/sysdeps/unix/sysv/linux/ia64/ld.abilist
b1dca6
index 82042472c3089a29..33f91199bfa516fb 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/ia64/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/ia64/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.2 __libc_stack_end D 0x8
b1dca6
 GLIBC_2.2 _dl_mcount F
b1dca6
 GLIBC_2.2 _r_debug D 0x28
b1dca6
-GLIBC_2.2 calloc F
b1dca6
-GLIBC_2.2 free F
b1dca6
-GLIBC_2.2 malloc F
b1dca6
-GLIBC_2.2 realloc F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/ia64/localplt.data b/sysdeps/unix/sysv/linux/ia64/localplt.data
b1dca6
index 3820e2a4e682af2e..1c566a503e2eba00 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/ia64/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/ia64/localplt.data
b1dca6
@@ -6,12 +6,6 @@ libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
 libm.so: matherrf
b1dca6
 libm.so: matherrl
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist
b1dca6
index a301c6ebc49db1d7..cc8825c3bc68ad4a 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist
b1dca6
@@ -3,7 +3,3 @@ GLIBC_2.4 __stack_chk_guard D 0x4
b1dca6
 GLIBC_2.4 __tls_get_addr F
b1dca6
 GLIBC_2.4 _dl_mcount F
b1dca6
 GLIBC_2.4 _r_debug D 0x14
b1dca6
-GLIBC_2.4 calloc F
b1dca6
-GLIBC_2.4 free F
b1dca6
-GLIBC_2.4 malloc F
b1dca6
-GLIBC_2.4 realloc F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/localplt.data b/sysdeps/unix/sysv/linux/m68k/coldfire/localplt.data
b1dca6
index 4a07bf387e2da296..3c5efb7204281e2a 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/localplt.data
b1dca6
@@ -5,12 +5,6 @@ libc.so: malloc
b1dca6
 libc.so: memalign
b1dca6
 libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist
b1dca6
index c9ec45cf1cf6c1c5..3ba474c27f62fb10 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.0 _r_debug D 0x14
b1dca6
-GLIBC_2.0 calloc F
b1dca6
-GLIBC_2.0 free F
b1dca6
-GLIBC_2.0 malloc F
b1dca6
-GLIBC_2.0 realloc F
b1dca6
 GLIBC_2.1 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.1 _dl_mcount F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/localplt.data b/sysdeps/unix/sysv/linux/m68k/m680x0/localplt.data
b1dca6
index c70d6ea3011c4511..843f4e25f213d632 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/localplt.data
b1dca6
@@ -6,12 +6,6 @@ libc.so: malloc
b1dca6
 libc.so: memalign
b1dca6
 libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/microblaze/ld.abilist b/sysdeps/unix/sysv/linux/microblaze/ld.abilist
b1dca6
index aa0d71150af8c62c..a4933c3541119538 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/microblaze/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/microblaze/ld.abilist
b1dca6
@@ -3,7 +3,3 @@ GLIBC_2.18 __stack_chk_guard D 0x4
b1dca6
 GLIBC_2.18 __tls_get_addr F
b1dca6
 GLIBC_2.18 _dl_mcount F
b1dca6
 GLIBC_2.18 _r_debug D 0x14
b1dca6
-GLIBC_2.18 calloc F
b1dca6
-GLIBC_2.18 free F
b1dca6
-GLIBC_2.18 malloc F
b1dca6
-GLIBC_2.18 realloc F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/microblaze/localplt.data b/sysdeps/unix/sysv/linux/microblaze/localplt.data
b1dca6
index 8ca23897dfa5b01c..0e98d5251ee14475 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/microblaze/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/microblaze/localplt.data
b1dca6
@@ -7,12 +7,6 @@ libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
 # The dynamic loader needs __tls_get_addr for TLS.
b1dca6
 ld.so: __tls_get_addr ?
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/ld.abilist b/sysdeps/unix/sysv/linux/mips/mips32/ld.abilist
b1dca6
index 55d48868e8b686dc..be09641a48962434 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/mips/mips32/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/mips/mips32/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.0 _r_debug D 0x14
b1dca6
-GLIBC_2.0 calloc F
b1dca6
-GLIBC_2.0 free F
b1dca6
-GLIBC_2.0 malloc F
b1dca6
-GLIBC_2.0 realloc F
b1dca6
 GLIBC_2.2 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.2 _dl_mcount F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist
b1dca6
index 55d48868e8b686dc..be09641a48962434 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.0 _r_debug D 0x14
b1dca6
-GLIBC_2.0 calloc F
b1dca6
-GLIBC_2.0 free F
b1dca6
-GLIBC_2.0 malloc F
b1dca6
-GLIBC_2.0 realloc F
b1dca6
 GLIBC_2.2 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.2 _dl_mcount F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist
b1dca6
index 44b345b7cf31e854..1ea36e13f294a249 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.0 _r_debug D 0x28
b1dca6
-GLIBC_2.0 calloc F
b1dca6
-GLIBC_2.0 free F
b1dca6
-GLIBC_2.0 malloc F
b1dca6
-GLIBC_2.0 realloc F
b1dca6
 GLIBC_2.2 __libc_stack_end D 0x8
b1dca6
 GLIBC_2.2 _dl_mcount F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/nios2/ld.abilist b/sysdeps/unix/sysv/linux/nios2/ld.abilist
b1dca6
index 110f1039fa39fb1c..52178802dd82b59a 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/nios2/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/nios2/ld.abilist
b1dca6
@@ -3,7 +3,3 @@ GLIBC_2.21 __stack_chk_guard D 0x4
b1dca6
 GLIBC_2.21 __tls_get_addr F
b1dca6
 GLIBC_2.21 _dl_mcount F
b1dca6
 GLIBC_2.21 _r_debug D 0x14
b1dca6
-GLIBC_2.21 calloc F
b1dca6
-GLIBC_2.21 free F
b1dca6
-GLIBC_2.21 malloc F
b1dca6
-GLIBC_2.21 realloc F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/nios2/localplt.data b/sysdeps/unix/sysv/linux/nios2/localplt.data
b1dca6
index 4430a5891e847aed..39009a62d6385849 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/nios2/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/nios2/localplt.data
b1dca6
@@ -27,12 +27,6 @@ libc.so: __nedf2
b1dca6
 libc.so: __eqdf2
b1dca6
 libc.so: __extendsfdf2
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/localplt.data b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/localplt.data
b1dca6
index e822e0a4809e5088..a02dd5cc246329a0 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/localplt.data
b1dca6
@@ -5,12 +5,6 @@ libc.so: malloc
b1dca6
 libc.so: memalign
b1dca6
 libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist
b1dca6
index e8b0ea3a9bd98b92..4bbfba7a61c7a5ef 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.0 _r_debug D 0x14
b1dca6
-GLIBC_2.0 calloc F
b1dca6
-GLIBC_2.0 free F
b1dca6
-GLIBC_2.0 malloc F
b1dca6
-GLIBC_2.0 realloc F
b1dca6
 GLIBC_2.1 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.1 _dl_mcount F
b1dca6
 GLIBC_2.22 __tls_get_addr_opt F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data
b1dca6
index fead931d4e5c4bc4..a4cd7cfb04249ae3 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data
b1dca6
@@ -35,12 +35,6 @@ libc.so: realloc
b1dca6
 libm.so: copysignl ?
b1dca6
 libm.so: fabsl
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist
b1dca6
index 37c8f6684b54341b..b1f313c7cd33defc 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist
b1dca6
@@ -2,9 +2,5 @@ GLIBC_2.17 __libc_stack_end D 0x8
b1dca6
 GLIBC_2.17 __tls_get_addr F
b1dca6
 GLIBC_2.17 _dl_mcount F
b1dca6
 GLIBC_2.17 _r_debug D 0x28
b1dca6
-GLIBC_2.17 calloc F
b1dca6
-GLIBC_2.17 free F
b1dca6
-GLIBC_2.17 malloc F
b1dca6
-GLIBC_2.17 realloc F
b1dca6
 GLIBC_2.22 __tls_get_addr_opt F
b1dca6
 GLIBC_2.23 __parse_hwcap_and_convert_at_platform F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist
b1dca6
index edfc9ca56f2e4fee..283fb4510bea40ba 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist
b1dca6
@@ -4,7 +4,3 @@ GLIBC_2.3 __libc_stack_end D 0x8
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
 GLIBC_2.3 _dl_mcount F
b1dca6
 GLIBC_2.3 _r_debug D 0x28
b1dca6
-GLIBC_2.3 calloc F
b1dca6
-GLIBC_2.3 free F
b1dca6
-GLIBC_2.3 malloc F
b1dca6
-GLIBC_2.3 realloc F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/localplt.data b/sysdeps/unix/sysv/linux/powerpc/powerpc64/localplt.data
b1dca6
index c1209336d2d339d4..bb498fbe3ae28d03 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/localplt.data
b1dca6
@@ -4,12 +4,6 @@ libc.so: malloc
b1dca6
 libc.so: memalign
b1dca6
 libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/riscv/localplt.data b/sysdeps/unix/sysv/linux/riscv/localplt.data
b1dca6
index 14c02cb2d6c016d3..0ed8650b65a0ecbf 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/riscv/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/riscv/localplt.data
b1dca6
@@ -6,12 +6,6 @@ libc.so: free
b1dca6
 libc.so: malloc
b1dca6
 libc.so: memalign
b1dca6
 libc.so: realloc
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist
b1dca6
index b411871d0631e1a3..845f356c3c3fad54 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist
b1dca6
@@ -3,7 +3,3 @@ GLIBC_2.27 __stack_chk_guard D 0x8
b1dca6
 GLIBC_2.27 __tls_get_addr F
b1dca6
 GLIBC_2.27 _dl_mcount F
b1dca6
 GLIBC_2.27 _r_debug D 0x28
b1dca6
-GLIBC_2.27 calloc F
b1dca6
-GLIBC_2.27 free F
b1dca6
-GLIBC_2.27 malloc F
b1dca6
-GLIBC_2.27 realloc F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/s390/localplt.data b/sysdeps/unix/sysv/linux/s390/localplt.data
b1dca6
index e822e0a4809e5088..a02dd5cc246329a0 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/s390/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/s390/localplt.data
b1dca6
@@ -5,12 +5,6 @@ libc.so: malloc
b1dca6
 libc.so: memalign
b1dca6
 libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist
b1dca6
index 0576c9575ea6118e..b56f005bebd3baf1 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.0 _r_debug D 0x14
b1dca6
-GLIBC_2.0 calloc F
b1dca6
-GLIBC_2.0 free F
b1dca6
-GLIBC_2.0 malloc F
b1dca6
-GLIBC_2.0 realloc F
b1dca6
 GLIBC_2.1 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.1 _dl_mcount F
b1dca6
 GLIBC_2.3 __tls_get_offset F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
b1dca6
index 1fbb890d1dc495e5..6f788a086d68aaa5 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.2 __libc_stack_end D 0x8
b1dca6
 GLIBC_2.2 _dl_mcount F
b1dca6
 GLIBC_2.2 _r_debug D 0x28
b1dca6
-GLIBC_2.2 calloc F
b1dca6
-GLIBC_2.2 free F
b1dca6
-GLIBC_2.2 malloc F
b1dca6
-GLIBC_2.2 realloc F
b1dca6
 GLIBC_2.3 __tls_get_offset F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/sh/ld.abilist b/sysdeps/unix/sysv/linux/sh/ld.abilist
b1dca6
index 0387614d8fd784eb..d155a59843df9091 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/sh/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/sh/ld.abilist
b1dca6
@@ -1,9 +1,5 @@
b1dca6
 GLIBC_2.2 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.2 _dl_mcount F
b1dca6
 GLIBC_2.2 _r_debug D 0x14
b1dca6
-GLIBC_2.2 calloc F
b1dca6
-GLIBC_2.2 free F
b1dca6
-GLIBC_2.2 malloc F
b1dca6
-GLIBC_2.2 realloc F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
 GLIBC_2.4 __stack_chk_guard D 0x4
b1dca6
diff --git a/sysdeps/unix/sysv/linux/sh/localplt.data b/sysdeps/unix/sysv/linux/sh/localplt.data
b1dca6
index babb19d71785515d..3225177c50956972 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/sh/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/sh/localplt.data
b1dca6
@@ -12,12 +12,6 @@ libc.so: __errno_location
b1dca6
 libm.so: matherr
b1dca6
 # Generated by the compiler because there is no trap insn pattern.
b1dca6
 libc.so: abort ?
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist
b1dca6
index fd0b33f86d3f9c5c..0c6610e3c2f00cf3 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.0 _r_debug D 0x14
b1dca6
-GLIBC_2.0 calloc F
b1dca6
-GLIBC_2.0 free F
b1dca6
-GLIBC_2.0 malloc F
b1dca6
-GLIBC_2.0 realloc F
b1dca6
 GLIBC_2.1 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.1 _dl_mcount F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data b/sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data
b1dca6
index 1668f4017e0f28f0..be40910c4de9859a 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data
b1dca6
@@ -17,12 +17,6 @@ libc.so: malloc
b1dca6
 libc.so: memalign
b1dca6
 libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist
b1dca6
index 82042472c3089a29..33f91199bfa516fb 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.2 __libc_stack_end D 0x8
b1dca6
 GLIBC_2.2 _dl_mcount F
b1dca6
 GLIBC_2.2 _r_debug D 0x28
b1dca6
-GLIBC_2.2 calloc F
b1dca6
-GLIBC_2.2 free F
b1dca6
-GLIBC_2.2 malloc F
b1dca6
-GLIBC_2.2 realloc F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data b/sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data
b1dca6
index b881b9096d9fa38f..809062d46c1b4837 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data
b1dca6
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data
b1dca6
@@ -18,12 +18,6 @@ libc.so: malloc
b1dca6
 libc.so: memalign
b1dca6
 libc.so: realloc
b1dca6
 libm.so: matherr
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc
b1dca6
-ld.so: calloc
b1dca6
-ld.so: realloc
b1dca6
-ld.so: free
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error
b1dca6
 ld.so: _dl_catch_error
b1dca6
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist b/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist
b1dca6
index 0dc943061197d374..d3cdf7611eb9cab3 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist
b1dca6
@@ -1,8 +1,4 @@
b1dca6
 GLIBC_2.2.5 __libc_stack_end D 0x8
b1dca6
 GLIBC_2.2.5 _dl_mcount F
b1dca6
 GLIBC_2.2.5 _r_debug D 0x28
b1dca6
-GLIBC_2.2.5 calloc F
b1dca6
-GLIBC_2.2.5 free F
b1dca6
-GLIBC_2.2.5 malloc F
b1dca6
-GLIBC_2.2.5 realloc F
b1dca6
 GLIBC_2.3 __tls_get_addr F
b1dca6
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist
b1dca6
index 80f3161586414674..c70bccf78245a552 100644
b1dca6
--- a/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist
b1dca6
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist
b1dca6
@@ -2,7 +2,3 @@ GLIBC_2.16 __libc_stack_end D 0x4
b1dca6
 GLIBC_2.16 __tls_get_addr F
b1dca6
 GLIBC_2.16 _dl_mcount F
b1dca6
 GLIBC_2.16 _r_debug D 0x14
b1dca6
-GLIBC_2.16 calloc F
b1dca6
-GLIBC_2.16 free F
b1dca6
-GLIBC_2.16 malloc F
b1dca6
-GLIBC_2.16 realloc F
b1dca6
diff --git a/sysdeps/x86_64/localplt.data b/sysdeps/x86_64/localplt.data
b1dca6
index c27a02b66acd2ab4..8f41e928708d9a42 100644
b1dca6
--- a/sysdeps/x86_64/localplt.data
b1dca6
+++ b/sysdeps/x86_64/localplt.data
b1dca6
@@ -9,12 +9,6 @@ libc.so: malloc + RELA R_X86_64_GLOB_DAT
b1dca6
 libc.so: memalign + RELA R_X86_64_GLOB_DAT
b1dca6
 libc.so: realloc + RELA R_X86_64_GLOB_DAT
b1dca6
 libm.so: matherr + RELA R_X86_64_GLOB_DAT
b1dca6
-# The main malloc is interposed into the dynamic linker, for
b1dca6
-# allocations after the initial link (when dlopen is used).
b1dca6
-ld.so: malloc + RELA R_X86_64_GLOB_DAT
b1dca6
-ld.so: calloc + RELA R_X86_64_GLOB_DAT
b1dca6
-ld.so: realloc + RELA R_X86_64_GLOB_DAT
b1dca6
-ld.so: free + RELA R_X86_64_GLOB_DAT
b1dca6
 # The TLS-enabled version of these functions is interposed from libc.so.
b1dca6
 ld.so: _dl_signal_error + RELA R_X86_64_GLOB_DAT
b1dca6
 ld.so: _dl_catch_error + RELA R_X86_64_GLOB_DAT