aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-10-27 11:36:44 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-10-27 11:36:44 +0200
commit6f360366f7f76b158a0f4bf20d42f2854ad56264 (patch)
tree28f8951950311cfab96b60143e28ef96d9f9d036 /sysdeps/generic
parenta65ff76c9a1811dd2396ab45563f645579c0e687 (diff)
downloadglibc-6f360366f7f76b158a0f4bf20d42f2854ad56264.tar
glibc-6f360366f7f76b158a0f4bf20d42f2854ad56264.tar.gz
glibc-6f360366f7f76b158a0f4bf20d42f2854ad56264.tar.bz2
glibc-6f360366f7f76b158a0f4bf20d42f2854ad56264.zip
elf: Introduce to _dl_call_fini
This consolidates the destructor invocations from _dl_fini and dlclose. Remove the micro-optimization that avoids calling _dl_call_fini if they are no destructors (as dlclose is quite expensive anyway). The debug log message is now printed unconditionally. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/ldsodefs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 0223aa9f12..2747f88d0e 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -105,6 +105,9 @@ typedef struct link_map *lookup_t;
DT_PREINIT_ARRAY. */
typedef void (*dl_init_t) (int, char **, char **);
+/* Type of a constructor function, in DT_FINI, DT_FINI_ARRAY. */
+typedef void (*fini_t) (void);
+
/* On some architectures a pointer to a function is not just a pointer
to the actual code of the function but rather an architecture
specific descriptor. */
@@ -1048,6 +1051,11 @@ extern void _dl_init (struct link_map *main_map, int argc, char **argv,
initializer functions have completed. */
extern void _dl_fini (void) attribute_hidden;
+/* Invoke the DT_FINI_ARRAY and DT_FINI destructors for MAP, which
+ must be a struct link_map *. Can be used as an argument to
+ _dl_catch_exception. */
+void _dl_call_fini (void *map) attribute_hidden;
+
/* Sort array MAPS according to dependencies of the contained objects.
If FORCE_FIRST, MAPS[0] keeps its place even if the dependencies
say otherwise. */