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.
This commit is contained in:
Ulrich Drepper 2001-11-10 22:47:40 +00:00
parent 94a758fe85
commit 9d63abbc7f
3 changed files with 33 additions and 12 deletions

View File

@ -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.

View 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)

View 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