]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 10 Nov 2001 22:47:40 +0000 (22:47 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 10 Nov 2001 22:47:40 +0000 (22:47 +0000)
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.

ChangeLog
elf/dl-reloc.c
sysdeps/generic/ldsodefs.h

index 6f0381988e3f70822f373d700aaf8fef062fc747..3cb913873eee8a2e287b6b2809b21a44c03fb48a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
 2001-11-10  Andreas Jaeger  <aj@suse.de>
 
        * sysdeps/ieee754/ldbl-128/e_log2l.c: New file.
index efdccea1518655fc1e1ba98ff5b5b3ba1c0c5bf8..da964b79483689e4a62ce93f85b728311b502945 100644 (file)
@@ -167,20 +167,20 @@ cannot make segment writable for relocation"));
            caddr_t mapend = ((caddr_t) l->l_addr +
                              ((ph->p_vaddr + ph->p_memsz + _dl_pagesize - 1)
                               & ~(_dl_pagesize - 1)));
-           extern unsigned char _dl_pf_to_prot[8];
            int prot;
 
-           if ((PF_R | PF_W | PF_X) == 7
-               && (PROT_READ | PROT_WRITE | PROT_EXEC) == 7)
-             prot = _dl_pf_to_prot[ph->p_flags & (PF_R | PF_X)];
-           else
-             {
-               prot = 0;
-               if (ph->p_flags & PF_R)
-                 prot |= PROT_READ;
-               if (ph->p_flags & PF_X)
-                 prot |= PROT_EXEC;
-             }
+#if (PF_R | PF_W | PF_X) == 7 && (PROT_READ | PROT_WRITE | PROT_EXEC) == 7
+           prot = (PF_TO_PROT
+                   >> ((ph->p_flags & (PF_R | PF_W | PF_X)) * 4)) & 0xf;
+#else
+           prot = 0;
+           if (ph->p_flags & PF_R)
+             prot |= PROT_READ;
+           if (ph->p_flags & PF_W)
+             prot |= PROT_WRITE;
+           if (ph->p_flags & PF_X)
+             prot |= PROT_EXEC;
+#endif
 
            if (__builtin_expect (__mprotect (mapstart, mapend - mapstart,
                                              prot), 0) < 0)
index 2a4491d1f991b1a24110c03620f384d92f6c817b..8c2f16016098fb707f28760336a8270e9d6233b9 100644 (file)
@@ -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