From fcccd51286acbf9c19ac57ab7143e257d58323fd Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 3 Apr 2014 10:47:14 -0700 Subject: Factor mmap/munmap of PT_LOAD segments out of _dl_map_object_from_fd et al. --- sysdeps/aarch64/tlsdesc.c | 4 ++-- sysdeps/arm/tlsdesc.c | 4 ++-- sysdeps/generic/ldsodefs.h | 4 +--- sysdeps/i386/tlsdesc.c | 4 ++-- sysdeps/tile/dl-runtime.c | 3 ++- sysdeps/x86_64/tlsdesc.c | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/aarch64/tlsdesc.c b/sysdeps/aarch64/tlsdesc.c index 0921230..1b41819 100644 --- a/sysdeps/aarch64/tlsdesc.c +++ b/sysdeps/aarch64/tlsdesc.c @@ -23,6 +23,7 @@ #include #include #include +#include #include /* The following functions take an entry_check_offset argument. It's @@ -144,8 +145,7 @@ void internal_function _dl_unmap (struct link_map *map) { - __munmap ((void *) (map)->l_map_start, - (map)->l_map_end - (map)->l_map_start); + _dl_unmap_segments (map); #if SHARED if (map->l_mach.tlsdesc_table) diff --git a/sysdeps/arm/tlsdesc.c b/sysdeps/arm/tlsdesc.c index fc754d6..e52034d 100644 --- a/sysdeps/arm/tlsdesc.c +++ b/sysdeps/arm/tlsdesc.c @@ -21,6 +21,7 @@ #include #include #include +#include #include /* This function is used to lazily resolve TLS_DESC REL relocations @@ -146,8 +147,7 @@ void internal_function _dl_unmap (struct link_map *map) { - __munmap ((void *) (map)->l_map_start, - (map)->l_map_end - (map)->l_map_start); + _dl_unmap_segments (map); #if SHARED /* _dl_unmap is only called for dlopen()ed libraries, for which diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 65cd709..6cf5e1b 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -91,9 +91,7 @@ typedef struct link_map *lookup_t; /* Unmap a loaded object, called by _dl_close (). */ #ifndef DL_UNMAP_IS_SPECIAL -# define DL_UNMAP(map) \ - __munmap ((void *) (map)->l_map_start, \ - (map)->l_map_end - (map)->l_map_start) +# define DL_UNMAP(map) _dl_unmap_segments (map) #endif /* By default we do not need special support to initialize DSOs loaded diff --git a/sysdeps/i386/tlsdesc.c b/sysdeps/i386/tlsdesc.c index 9b6e359..ef4a1dd 100644 --- a/sysdeps/i386/tlsdesc.c +++ b/sysdeps/i386/tlsdesc.c @@ -21,6 +21,7 @@ #include #include #include +#include #include /* The following 4 functions take an entry_check_offset argument. @@ -258,8 +259,7 @@ void internal_function _dl_unmap (struct link_map *map) { - __munmap ((void *) (map)->l_map_start, - (map)->l_map_end - (map)->l_map_start); + _dl_unmap_segments (map); #if SHARED if (map->l_mach.tlsdesc_table) diff --git a/sysdeps/tile/dl-runtime.c b/sysdeps/tile/dl-runtime.c index 3bfb830..8bc2911 100644 --- a/sysdeps/tile/dl-runtime.c +++ b/sysdeps/tile/dl-runtime.c @@ -27,6 +27,7 @@ #include #include +#include /* Like realpath(), but simplified: no dynamic memory use, no lstat(), no set_errno(), no valid "rpath" on error, etc. This handles some @@ -154,5 +155,5 @@ void internal_function _dl_unmap (struct link_map *l) { sim_dlclose (l->l_map_start); - __munmap ((void *) l->l_map_start, l->l_map_end - l->l_map_start); + _dl_unmap_segments (map); } diff --git a/sysdeps/x86_64/tlsdesc.c b/sysdeps/x86_64/tlsdesc.c index 0daa87f..c1c5e03 100644 --- a/sysdeps/x86_64/tlsdesc.c +++ b/sysdeps/x86_64/tlsdesc.c @@ -21,6 +21,7 @@ #include #include #include +#include #include /* The following 2 functions take a caller argument, that contains the @@ -136,8 +137,7 @@ void internal_function _dl_unmap (struct link_map *map) { - __munmap ((void *) (map)->l_map_start, - (map)->l_map_end - (map)->l_map_start); + _dl_unmap_segments (map); #if SHARED /* _dl_unmap is only called for dlopen()ed libraries, for which -- cgit v1.1