about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-11-10 22:47:40 +0000
committerUlrich Drepper <drepper@redhat.com>2001-11-10 22:47:40 +0000
commit9d63abbc7fa8a80190d80b4fbc088fdc3f0c7e4d (patch)
tree877f2dc684212b1858a5b2727512fe12666a9b7f /sysdeps
parent94a758fe850a09fd39dcb61e49ac9060959f8aa5 (diff)
downloadglibc-9d63abbc7fa8a80190d80b4fbc088fdc3f0c7e4d.tar.gz
glibc-9d63abbc7fa8a80190d80b4fbc088fdc3f0c7e4d.tar.xz
glibc-9d63abbc7fa8a80190d80b4fbc088fdc3f0c7e4d.zip
Update.
2001-11-10  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-load.c (_dl_map_object_from_fd): Remove use of
	_dl_pf_to_prot.  Use arithmetic operation using PF_TO_PROT macro.
	* sysdeps/generic/ldsodefs.h (PF_TO_PROT): New macro.
	* elf/dl-reloc.c (_dl_relocate_object): Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/ldsodefs.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 2a4491d1f9..8c2f160160 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -95,6 +95,20 @@ typedef ElfW(Addr) lookup_t;
 #define ELF_RTYPE_CLASS_PLT 1
 #define ELF_RTYPE_CLASS_COPY 2
 
+/* ELF uses the PF_x macros to specify the segment permissions, mmap
+   uses PROT_xxx.  In most cases the three macros have the values 1, 2,
+   and 3 but not in a matching order.  The following macros allows
+   converting from the PF_x values to PROT_xxx values.  */
+#define PF_TO_PROT \
+  ((PROT_READ << (PF_R * 4))						      \
+   | (PROT_WRITE << (PF_W * 4))						      \
+   | (PROT_EXEC << (PF_X * 4))						      \
+   | ((PROT_READ | PROT_WRITE) << ((PF_R | PF_W) * 4))			      \
+   | ((PROT_READ | PROT_EXEC) << ((PF_R | PF_X) * 4))			      \
+   | ((PROT_WRITE | PROT_EXEC) << (PF_W | PF_X) * 4)			      \
+   | ((PROT_READ | PROT_WRITE | PROT_EXEC) << ((PF_R | PF_W | PF_X) * 4)))
+
+
 /* For the version handling we need an array with only names and their
    hash values.  */
 struct r_found_version