rtld-routines = rtld $(all-dl-routines) dl-sysdep dl-environ dl-minimal \
dl-error-minimal dl-conflict dl-hwcaps dl-hwcaps_split dl-hwcaps-subdirs \
dl-usage dl-diagnostics dl-diagnostics-kernel dl-diagnostics-cpu \
- dl-mutex
+ dl-mutex dl-libc_freeres
all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
CFLAGS-dl-runtime.c += -fexceptions -fasynchronous-unwind-tables
--- /dev/null
+/* Deallocating malloc'ed memory from the dynamic loader.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <ldsodefs.h>
+
+void
+__rtld_libc_freeres (void)
+{
+}
._dl_catch_error = _rtld_catch_error,
._dl_error_free = _dl_error_free,
._dl_tls_get_addr_soft = _dl_tls_get_addr_soft,
+ ._dl_libc_freeres = __rtld_libc_freeres,
#ifdef HAVE_DL_DISCOVER_OSVERSION
._dl_discover_osversion = _dl_discover_osversion
#endif
#include <libc-internal.h>
#include <unwind-link.h>
#include <dlfcn/dlerror.h>
+#include <ldsodefs.h>
#include "../nss/nsswitch.h"
#include "../libio/libioP.h"
call_function_static_weak (__libc_dlerror_result_free);
+#ifdef SHARED
+ GLRO (dl_libc_freeres) ();
+#endif
+
for (p = symbol_set_first_element (__libc_freeres_ptrs);
!symbol_set_end_p (__libc_freeres_ptrs, p); ++p)
free (*p);
namespace. */
void (*_dl_error_free) (void *);
void *(*_dl_tls_get_addr_soft) (struct link_map *);
+
+ /* Called from __libc_shared to deallocate malloc'ed memory. */
+ void (*_dl_libc_freeres) (void);
+
#ifdef HAVE_DL_DISCOVER_OSVERSION
int (*_dl_discover_osversion) (void);
#endif
}
#endif /* !PTHREAD_IN_LIBC */
+/* Implementation of GL (dl_libc_freeres). */
+void __rtld_libc_freeres (void) attribute_hidden;
+
void __thread_gscope_wait (void) attribute_hidden;
# define THREAD_GSCOPE_WAIT() __thread_gscope_wait ()