From 9d63abbc7fa8a80190d80b4fbc088fdc3f0c7e4d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 10 Nov 2001 22:47:40 +0000 Subject: Update. 2001-11-10 Ulrich Drepper * 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. --- sysdeps/generic/ldsodefs.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'sysdeps') diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 2a4491d..8c2f160 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 -- cgit v1.1