aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-02-20 09:52:46 +0000
committerUlrich Drepper <drepper@redhat.com>1999-02-20 09:52:46 +0000
commit24d6084042539edf4ea7bf8dca3acfde8eea1600 (patch)
tree40325b8cefa3ce5782056e904103afc807563254 /elf/dl-load.c
parent57846308af51c23f3d442ad68ec667469961cb97 (diff)
downloadglibc-24d6084042539edf4ea7bf8dca3acfde8eea1600.zip
glibc-24d6084042539edf4ea7bf8dca3acfde8eea1600.tar.gz
glibc-24d6084042539edf4ea7bf8dca3acfde8eea1600.tar.bz2
Update.
* elf/dl-load.c (_dl_map_object_from_fd): Use global _dl_pf_to_proot array to convert p_flags value. * elf/dl-reloc.c (_dl_relocate_object): Likewise.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 2bc9af4..3de1dca 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -107,6 +107,18 @@ static const struct r_strlenpair *capstr;
static size_t ncapstr;
static size_t max_capstrlen;
+const unsigned char _dl_pf_to_prot[8] =
+{
+ [0] = PROT_NONE,
+ [PF_R] = PROT_READ,
+ [PF_W] = PROT_WRITE,
+ [PF_R | PF_W] = PROT_READ | PROT_WRITE,
+ [PF_X] = PROT_EXEC,
+ [PF_R | PF_X] = PROT_READ | PROT_EXEC,
+ [PF_W | PF_X] = PROT_WRITE | PROT_EXEC,
+ [PF_R | PF_W | PF_X] = PROT_READ | PROT_WRITE | PROT_EXEC
+};
+
/* This function has no public prototype. */
extern ssize_t __libc_read (int, void *, size_t);
@@ -782,20 +794,7 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
/* Optimize a common case. */
if ((PF_R | PF_W | PF_X) == 7
&& (PROT_READ | PROT_WRITE | PROT_EXEC) == 7)
- {
- static const unsigned char pf_to_prot[8] =
- {
- [0] = PROT_NONE,
- [PF_R] = PROT_READ,
- [PF_W] = PROT_WRITE,
- [PF_R | PF_W] = PROT_READ | PROT_WRITE,
- [PF_X] = PROT_EXEC,
- [PF_R | PF_X] = PROT_READ | PROT_EXEC,
- [PF_W | PF_X] = PROT_WRITE | PROT_EXEC,
- [PF_R | PF_W | PF_X] = PROT_READ | PROT_WRITE | PROT_EXEC
- };
- c->prot = pf_to_prot[ph->p_flags & (PF_R | PF_W | PF_X)];
- }
+ c->prot = _dl_pf_to_prot[ph->p_flags & (PF_R | PF_W | PF_X)];
else
{
c->prot = 0;