This is the mail archive of the
mailing list for the glibc project.
Re: Propose to Use madvise API on Runtime Loader
- From: lin zuojian <manjian2006 at gmail dot com>
- To: Rich Felker <dalias at libc dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 23 May 2014 12:21:33 +0800
- Subject: Re: Propose to Use madvise API on Runtime Loader
- Authentication-results: sourceware.org; auth=none
- References: <20140523012855 dot GC14217 at ubuntu> <20140523025730 dot GL507 at brightrain dot aerifal dot cx> <20140523031242 dot GA24355 at ubuntu> <20140523040146 dot GM507 at brightrain dot aerifal dot cx>
On Fri, May 23, 2014 at 12:01:46AM -0400, Rich Felker wrote:
> Your code as written drops from the beginning of the map up to a
> length based on the position and number of reloctions, which is utter
> nonsense. But even if that were fixed, it would be incorrect because
> madvise has page granularity.
My code is to point out the range of a mapped elf file that may be
dropped. The page granularity problem is easy to fix, in my real
solution there is a round-down operation before passing the
parameter like this : end = end & ~PAGE_MASK.
A cplusplus program usually contain many virtual tables. Their
contents require relocation.So the .rel.dyn is a huge section.They
are just needed when relocation. After that their useless. So
dropping these content makes sense.