about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2014-04-03 10:47:14 -0700
committerRoland McGrath <roland@hack.frob.com>2014-04-03 10:47:14 -0700
commitfcccd51286acbf9c19ac57ab7143e257d58323fd (patch)
tree011b737ea7df67117682d2fd4e0a6998c8eca840 /sysdeps
parentf6488e2b7f13529cde762d02a0352071c078ff9a (diff)
downloadglibc-fcccd51286acbf9c19ac57ab7143e257d58323fd.tar.gz
glibc-fcccd51286acbf9c19ac57ab7143e257d58323fd.tar.xz
glibc-fcccd51286acbf9c19ac57ab7143e257d58323fd.zip
Factor mmap/munmap of PT_LOAD segments out of _dl_map_object_from_fd et al.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/aarch64/tlsdesc.c4
-rw-r--r--sysdeps/arm/tlsdesc.c4
-rw-r--r--sysdeps/generic/ldsodefs.h4
-rw-r--r--sysdeps/i386/tlsdesc.c4
-rw-r--r--sysdeps/tile/dl-runtime.c3
-rw-r--r--sysdeps/x86_64/tlsdesc.c4
6 files changed, 11 insertions, 12 deletions
diff --git a/sysdeps/aarch64/tlsdesc.c b/sysdeps/aarch64/tlsdesc.c
index 0921230676..1b4181956c 100644
--- a/sysdeps/aarch64/tlsdesc.c
+++ b/sysdeps/aarch64/tlsdesc.c
@@ -23,6 +23,7 @@
 #include <elf/dynamic-link.h>
 #include <tls.h>
 #include <dl-tlsdesc.h>
+#include <dl-unmap-segments.h>
 #include <tlsdeschtab.h>
 
 /* 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 fc754d6c42..e52034ded6 100644
--- a/sysdeps/arm/tlsdesc.c
+++ b/sysdeps/arm/tlsdesc.c
@@ -21,6 +21,7 @@
 #include <elf/dynamic-link.h>
 #include <tls.h>
 #include <dl-tlsdesc.h>
+#include <dl-unmap-segments.h>
 #include <tlsdeschtab.h>
 
 /* 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 65cd709fef..6cf5e1b0b8 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 9b6e359ae0..ef4a1ddf98 100644
--- a/sysdeps/i386/tlsdesc.c
+++ b/sysdeps/i386/tlsdesc.c
@@ -21,6 +21,7 @@
 #include <elf/dynamic-link.h>
 #include <tls.h>
 #include <dl-tlsdesc.h>
+#include <dl-unmap-segments.h>
 #include <tlsdeschtab.h>
 
 /* 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 3bfb830320..8bc2911850 100644
--- a/sysdeps/tile/dl-runtime.c
+++ b/sysdeps/tile/dl-runtime.c
@@ -27,6 +27,7 @@
 
 #include <sys/mman.h>
 #include <arch/sim.h>
+#include <dl-unmap-segments.h>
 
 /* 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 0daa87f8fd..c1c5e033c0 100644
--- a/sysdeps/x86_64/tlsdesc.c
+++ b/sysdeps/x86_64/tlsdesc.c
@@ -21,6 +21,7 @@
 #include <elf/dynamic-link.h>
 #include <tls.h>
 #include <dl-tlsdesc.h>
+#include <dl-unmap-segments.h>
 #include <tlsdeschtab.h>
 
 /* 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