diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-11-10 22:47:40 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-11-10 22:47:40 +0000 |
commit | 9d63abbc7fa8a80190d80b4fbc088fdc3f0c7e4d (patch) | |
tree | 877f2dc684212b1858a5b2727512fe12666a9b7f /elf | |
parent | 94a758fe850a09fd39dcb61e49ac9060959f8aa5 (diff) | |
download | glibc-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 'elf')
-rw-r--r-- | elf/dl-reloc.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c index efdccea151..da964b7948 100644 --- a/elf/dl-reloc.c +++ b/elf/dl-reloc.c @@ -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) |