mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Use ALIGN_* macros in _dl_map_object_from_fd.
Cleanup _dl_map_object_from_fd to make it clear exactly what we're doing with the mappings i.e. extending the the start of the map down to a page boundary, extending the end of the map up to a page boundary, and offset itself also to page boundary. The result is much easier to read as expected from the ALIGN_* cleanups.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2015-09-18 Carlos O'Donell <carlos@redhat.com>
|
||||||
|
|
||||||
|
* elf/dl-load.c: Include libc-internal.h.
|
||||||
|
(_dl_map_object_from_fd): Use ALIGN_UP and ALIGN_DOWN.
|
||||||
|
|
||||||
2015-09-18 Vincent Bernat <vincent@bernat.im>
|
2015-09-18 Vincent Bernat <vincent@bernat.im>
|
||||||
|
|
||||||
[BZ #17887]
|
[BZ #17887]
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <caller.h>
|
#include <caller.h>
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#include <stap-probe.h>
|
#include <stap-probe.h>
|
||||||
|
#include <libc-internal.h>
|
||||||
|
|
||||||
#include <dl-dst.h>
|
#include <dl-dst.h>
|
||||||
#include <dl-load.h>
|
#include <dl-load.h>
|
||||||
@ -1077,12 +1078,11 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct loadcmd *c = &loadcmds[nloadcmds++];
|
struct loadcmd *c = &loadcmds[nloadcmds++];
|
||||||
c->mapstart = ph->p_vaddr & ~(GLRO(dl_pagesize) - 1);
|
c->mapstart = ALIGN_DOWN (ph->p_vaddr, GLRO(dl_pagesize));
|
||||||
c->mapend = ((ph->p_vaddr + ph->p_filesz + GLRO(dl_pagesize) - 1)
|
c->mapend = ALIGN_UP (ph->p_vaddr + ph->p_filesz, GLRO(dl_pagesize));
|
||||||
& ~(GLRO(dl_pagesize) - 1));
|
|
||||||
c->dataend = ph->p_vaddr + ph->p_filesz;
|
c->dataend = ph->p_vaddr + ph->p_filesz;
|
||||||
c->allocend = ph->p_vaddr + ph->p_memsz;
|
c->allocend = ph->p_vaddr + ph->p_memsz;
|
||||||
c->mapoff = ph->p_offset & ~(GLRO(dl_pagesize) - 1);
|
c->mapoff = ALIGN_DOWN (ph->p_offset, GLRO(dl_pagesize));
|
||||||
|
|
||||||
/* Determine whether there is a gap between the last segment
|
/* Determine whether there is a gap between the last segment
|
||||||
and this one. */
|
and this one. */
|
||||||
|
Reference in New Issue
Block a user